侧重于于对系统硬件和系统性能的监控 1. 下载
http://www.zabbix.com/download.php
- 安装
tar -zxvf zabbix-2.0.3.tar.gz
useradd zabbix //运行zabbix需要zabbix用户.只需创建用户即可.
yum install mysql-devel //安装zabbix服务端需要mysql-devel
yum install net-snmp-devel
yum install libcurl-devel
yum install php-bcmath
yum install php-xml
cd zabbix-2.0.3
./configure --prefix=/monitor/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl [--with-ssh2] //服务器端,客户端一同编译
./configure --prefix=/monitor/zabbix --enable-agent //仅编译客户端(客户机操作)
make install
- 创建数据库
shell> mysql -u<username> -p<password>
mysql> create database zabbix character set utf8;
mysql> quit;
shell> mysql -u<username> -p<password> zabbix < database/mysql/schema.sql //sql文件在安装包的目录下面
shell> mysql -u<username> -p<password> zabbix < database/mysql/images.sql
shell> mysql -u<username> -p<password> zabbix < database/mysql/data.sql
- 创建web访问页面
把安装包总frontends/php目录下的全部文件cp到web根目录的zabbix目录下。
- 启动
/monitor/zabbix/sbin/zabbix_server //启动服务器端
/monitor/zabbix/sbin/zabbix_agentd //启动客户端端(服务器端也需要启动)
- 访问
http://127.0.0.1/zabbix //web页面安装.
注意:/opt/lampp/htdocs/zabbix/conf/这个目录需要有写入权限
初始账户:Admin/zabbix
- 注意
php.ini的一些配置:
max_execution_time = 300
memory_limit = 128M
max_input_time = 300
[Date]
date.timezone = Asia/Shanghai
中文界面图形显示乱码:
cp -rp /usr/share/fonts/chinese/TrueType/uming.ttf /var/www/html/zabbix/fonts/DejaVuSans.ttf //用系统字体替换掉zabbix在web里面使用的字体.
- 服务器端配置文件:
/monitor/zabbix/etc/zabbix_server.conf //可以配置日志文件位置,数据库的一些信息 - 客户端配置文件:
/monitor/zabbix/etc/zabbix_agentd.conf //配置允许访问的服务器端IP(逗号隔开):Server=x.x.x.x,x.x.x.x 服务端使用10051端口,客户端使用10050端口.
性能调优
Zabbix discoverer processes 75% busy StartDiscoverers=5
Zabbix busy trapper processes, in % StartTrappers=5
Zabbix busy poller processes, in % StartPollers=5
Zabbix busy ipmi poller processes, in % StartIPMIPollers=0
Zabbix busy discoverer processes, in % StartDiscoverers=1
Zabbix busy icmp pinger processes, in % StartPingers=1
Zabbix busy http poller processes, in % StartHTTPPollers=1
Zabbix busy proxy poller processes, in % StartProxyPollers=1
Zabbix busy unreachable poller processes, in % StartPollersUnreachable=1
Zabbix busy java poller processes, in % StartJavaPollers=0
Zabbix busy snmp trapper processes, in % StartSNMPTrapper=0
Zabbix busy vmware collector processes, in % StartVMwareCollectors=0
Zabbix-server: Zabbix trend write cache, % free TrendCacheSize=4M
Zabbix-server: Zabbix configuration cache, % free CacheSize=8M
Zabbix-server: Zabbix text write cache, % free HistoryTextCacheSize=16M
Zabbix-server: Zabbix history write cache, % free HistoryCacheSize=8M
Zabbix-server: Zabbix value cache, % free ValueCacheSize=8M
Zabbix-server: Zabbix vmware cache, % free VMwareCacheSize=8M
zabbix清理数据
date +%s -d "2018-2-9"
delete from history where clock < 1518014400;
delete from history_text where clock < 1518014400;
delete from history_uint where clock < 1518014400;
optimize table history_uint;
配置文件
vi /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
DBName=zabbix
DBUser=zabbix
DBPassword=fsdfs$ff123SH
StartPollers=10
StartTrappers=10
CacheSize=128M
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=30
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
ValueCacheSize=128M
vi /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.200.150
ServerActive=192.168.200.150
Include=/etc/zabbix/zabbix_agentd.d/
UnsafeUserParameters=1
UserParameter=blizzmi.runshell[*],$1
Hostname=localhost