5.修改zabbix_agentd.conf添加以下参数:
UserParameter=mysql.version,mysql -V UserParameter=mysql.status[*], /usr/local/zabbix/scripts/chk_mysql.sh $1 UserParameter=mysql.ping,/usr/local/mysql/bin/mysqladmin -ulqb ping | grep -c alive [root@localhost scripts]# grep '^[a-Z]' /usr/local/zabbix/etc/zabbix_agentd.conf LogFile=/tmp/zabbix_agentd.log Server=172.20.66.110 Hostname=172.21.100.12 RefreshActiveChecks=120 Timeout=20 UserParameter=mysql.version,mysql -V UserParameter=mysql.status[*], /usr/local/zabbix/scripts/chk_mysql.sh $1 UserParameter=mysql.ping,/usr/local/mysql/bin/mysqladmin -ulqb ping | grep -c alive6.重启zabbix_agentd客户端服务,查看有没有报错。
[root@localhost scripts]# /etc/init.d/zabbix_agentd restart Restarting zabbix_agentd (via systemctl): [ OK ] [root@localhost scripts]# tail -f /tmp/zabbix_agentd.log 24025:20180104:041135.331 **** Enabled features **** 24025:20180104:041135.331 IPv6 support: NO 24025:20180104:041135.331 TLS support: NO 24025:20180104:041135.331 ************************** 24025:20180104:041135.331 using configuration file: /usr/local/zabbix/etc/zabbix_agentd.conf 24025:20180104:041135.331 agent #0 started [main process] 24030:20180104:041135.332 agent #4 started [listener #3] 24028:20180104:041135.332 agent #2 started [listener #1] 24027:20180104:041135.332 agent #1 started [collector] 24029:20180104:041135.333 agent #3 started [listener #2]二.在zabbix_server端的浏览器设置
1.收下在zabbix_server端查看下mysql脚本信息是否可以正常获取
2.添加主机。配置--主机填写相关信息。
3.链接相关模板。点击模板选项卡--选择--选中Templeate DB MySQL模板--添加--更新
4.查看监控项有没有红色告警,没有就算正常的。
5.等两分钟(数据默认1分钟来获取数据),就可以获取相关数据了
6.
至此监控mysql完成。
更多Zabbix相关教程集合:
在Ubuntu 16.04服务器上安装Zabbix 3.2
CentOS 7 LNMP环境搭建Zabbix3.0