1. 在MySQL里创建监控的账号
GRANT PROCESS,REPLICATION CLIENT ON *.* TO mysql_monitor@'localhost' IDENTIFIED BY 'Nt8eWv';
# process通过这个权限,用户可以执行SHOW PROCESSLIST和KILL命令。
# replication client拥有此权限可以查询master server、slave server状态。
2. 在MySQL服务器的 C:\Infinit-Server\zabbix\script 目录下新建三个脚本文件
mysql_ping.vbs
Set objFS =CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
str1 = getCommandOutput("C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqladmin.exe -umysql_monitor -pNt8eWv ping")
If Instr(str1,"alive") > 0 Then
WScript.Echo 1

本文详细介绍了如何在Windows环境中使用Zabbix监控MySQL。包括在MySQL中创建监控账号,配置C:Infinit-Serverzabbixscript下的监控脚本,修改zabbix_agentd.win.conf文件,并在Zabbix主机上测试及添加MySQL模板。

1459





