环境是CentOS 6.5 x86_64系统
Zabbix版本:3.0.4
MySQL Server 版本:5.6.29 二进制安装
zabbix_agentd.conf的配置文件如下:
[root@iZuf67iz9o3i4wixgtwybnZ alertscripts]# cat /usr/local/zabbix/etc/zabbix_agentd.conf | grep -v '^#' | grep -v '^$'
LogFile=/tmp/zabbix_agentd.log
EnableRemoteCommands=1
Server=10.18.3.193
ListenPort=10050
ServerActive=10.18.3.193
Hostname=10.18.3.191
AllowRoot=1
Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*.conf
UnsafeUserParameters=1
#下面两行是自定义的key
UserParameter=mysql.slave,/usr/local/zabbix/share/zabbix/alertscripts/check_mysql_slave.sh | grep -c 'ok'
UserParameter=mysql.status[*],/usr/local/zabbix/share/zabbix/alertscripts/mysql_server_status.sh $1
查看mysql授权:
mysql授权需要密码才能访问,但是使用密码mysql会提示明文密码,就会有下面的提示:
[root@iZuf67iz9o3i4wixgtwybnZ alertscripts]# sh check_mysql_slave.sh
Warning: Using a password on the command line interface can be insecure.
ok -slave is running
解决办法如下:
[root@iZuf67iz9o3i4wixgtwybnZ alertscripts]# cat /etc/my.cnf | tail -4
[c