1.yum -y install zabbix-agent;
2.安装完成后配置文件一般在 /etc/zabbix/zabbix_agentd.conf,打开把里面内容全部清空然后加入
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log #错误日志
LogFileSize=0
ListenPort=10050 #启动监听端口
StartAgents=3 #被动模式下选择,主动模式则为0
ListenIP=0.0.0.0 #监听所有IP
Server=10.27.146.250 #被动模式下必填,将zabbix-server端的ip填入
#ServerActive=10.27.146.250 #主动模式下填写
Hostname=Api1Bearead #本机的hostname,此值必须与zabbix的网页上创建的主机名一致即可
Include=/etc/zabbix/zabbix_agentd.d/
3.service zabbix-agent restart #启动客户端
4.在zabbix的网页端创建一个新的项目
请确保这里的主机名和配置的主机名一致,这里的IP填写的是安装客户端服务器的IP地址
[root@db_m1_slave_1 zabbix-3.0.2]# tail -f/var/log/zabbix/zabbix_agentd.log
……
17336:20160422:163813.319 no active checkson server [192.168.121.12:10051]: host [hch_test_121_12] not found
17336:20160422:164013.503 no active checks onserver [192.168.121.12:10051]: host [hch_test_121_12] not found
解决办法:
出现该错误的原因是一般是zabbix_agentd.conf里面的Hostname和前端zabbix web里面的配置不一样所造成的,即在zabbix web页面Monitoring->Configuration->Hosts 页面的Host Name和zabbix_agentd.conf里面的Hostname要一样。
再看后台日志信息,正常如下:
[root@db_m1_slave_1 zabbix-3.0.2]# tail -f/var/log/zabbix/zabbix_agentd.log
17468:20160422:164350.284 IPv6 support: YES
17468:20160422:164350.284 TLS support: YES
17468:20160422:164350.284**************************
17468:20160422:164350.284 using configurationfile: /etc/zabbix/zabbix_agentd.conf
17468:20160422:164350.293 agent #0 started[main process]
17469:20160422:164350.294 agent #1 started[collector]
17470:20160422:164350.294 agent #2 started[listener #1]
17471:20160422:164350.294 agent #3 started[listener #2]
17472:20160422:164350.295 agent #4 started[listener #3]
17473:20160422:164350.295 agent #5 started[active checks #1]
问题is not suitable for value type [Numeric (unsigned)] and datatype [Decimal]
12394:20160422:200640.676 error reason for "db_master_1:mysql.status[Questions]" changed: Received value [Warning: Using a password on the command line interface can be insecure.18463244] is not suitable for value type [Numeric (float)] 12393:20160422:200642.678 error reason for "db_master_1:mysql.status[Uptime]" changed: Received value [Warning: Using a password on the command line interface can be insecure.580661] is not suitable for value type [Numeric (unsigned)] and data type [Decimal]
后台zabbix服务器日志: [root@hch_test_121_12 ~]# /usr/local/zabbix/bin/zabbix_get -s 192.168.1..71 -p10050 -k mysql.status[Com_update] Warning: Using a password on the command line interface can be insecure. 92315 [root@hch_test_121_12 ~]#
解决办法是,在zabbix客户端,添加用户名密码配置,这样避免shell密码外泄也不会报错,(这里报这种错误是因为返回的结果集中有字符串提醒信息,而后台zabbix的item的是decimal所以存储不进去报错): vim /usr/local/mysql/my.cnf [mysqladmin] user=zabbix password=ys_ipowerlong0418
然后重启zabbix_agent 然后在后台zabbix测试,没有报多余的信息: [root@hch_test_121_12 ~]# /usr/local/zabbix/bin/zabbix_get -s 192.168.1..71 -p10050 -k mysql.status[Com_insert] 58272 [root@hch_test_121_12 ~]#
之后再看zabbix_server后台日志,正常了不会报错了,如下所示: 12855:20160422:233520.636 item "db_master_2:mysql.status[Bytes_received]" became supported 12857:20160422:233521.636 item "db_master_2:mysql.status[Bytes_sent]" became supported 12854:20160422:233522.637 item "db_master_2:mysql.status[Com_begin]" became supported 12856:20160422:233523.638 item "db_master_2:mysql.status[Com_commit]" became supported 12857:20160422:233524.641 item "db_master_2:mysql.status[Com_delete]" became supported 12855:20160422:233525.642 item "db_master_2:mysql.status[Com_insert]" became supported 12856:20160422:233526.642 item "db_master_2:mysql.status[Com_rollback]" became supported 12854:20160422:233527.643 item "db_master_2:mysql.status[Com_select]" became supported 12855:20160422:233528.645 item "db_master_2:mysql.status[Com_update]" became supported 12857:20160422:233529.646 item "db_master_2:mysql.status[Questions]" became supported 12856:20160422:233530.646 item "db_master_2:mysql.status[Slow_queries]" became supported
|
报错Check access restrictions in Zabbix agent configuration:
[root@hch_test_121_12 alertscripts]#zabbix_get -s 192.168.1..72 -p10050 -k "system.hostname";
zabbix_get [17730]: Check accessrestrictions in Zabbix agent configuration
[root@hch_test_121_12 alertscripts]#
解决:
配置文件坏了,copy一个备份的过来,改下,重启agent。
在zabbix服务器上测试:
[root@hch_test_121_12 alertscripts]#/usr/local/zabbix/bin/zabbix_get -s 192.168.1.63 -p10050 -k mysql.ping
(Not all processes could be identified,non-owned process info
willnot be shown, you would have to be root to see it all.)
0
[root@hch_test_121_12 alertscripts]#
去mysql服务器上赋予s权限
[root@db_m1_slave2 soft]# chmod +s /bin/netstat
You have new mail in /var/spool/mail/root
[root@db_m1_slave2 soft]#
zabbix_get [1291]: Get value error
[root@hch_test_121_12 ~]#/usr/local/zabbix/bin/zabbix_get -s 192.168.1.21 -p10050 -k system.info
zabbix_get [1291]: Get value error: cannotconnect to [[10.254.1.21]:10050]: [111] Connection refused
[root@hch_test_121_12 ~]#