Geek stuff

Primary Menu

Zabbix – Monitor MySQL on Windows

Getting the Zabbix MySQL template to work on a Windows host requires a little bit of tweaking. None of this is documented in the Zabbix manual. Fortunately, the work effort is minimal and you can you use the default Zabbix MySQL template without any changes.

What you need

Functioning Zabbix server installation. All of the steps below were performed with Zabbix 3.0.2, but should work in version 2.x as well.

Functioning Zabbix agent installed on a Microsoft Windows server with MySQL installed. The steps below were performed with MySQL 5.6, but should work in any 5.x release.

What to do

On the Windows MySQL Host

Create a MySQL user to be used by Zabbix for monitoring.mysql -uroot -p -e "GRANT PROCESS ON *.* TO 'zabbix'@'127.0.0.1' IDENTIFIED BY 'ZabbixPassword'";mysql -uroot -p -e "flush privileges"
Set the user and password to whatever you like. If you’re using MySQL workbench, you will need to assign the MonitorAdmin role.

Append the path to the MySQL binaries to your system PATH variable. This is done via Control Panel -> System and Security -> System -> Advanced System Settings -> Environment Variables.
The path to the binaries will vary based on the installed version of MySQL and whether you used the installer or zip package. For version 5.6, the default path is C:\Program Files\MySQL\MySQL Server 5.6\bin.

Create two files in the same directory as your Zabbix agent configuration file – zabbix_agentd.userparams.conf and zabbix_mysql.cnf.

Open zabbix_mysql.cnf and place the following in the file:[client]user = zabbixpassword = "ZabbixPassword"host = 127.0.0.1
Replace the bold sections with your user name and password. I highly recommend you enclose your password in double quotes – especially if you have special characters in your password.

Open zabbix_agentd.win.conf and search for “# Include”. Add the following line:Include=C:\Program Files\Zabbix\conf\zabbix_agentd.userparams.conf
Replace the bold section with the actual path to your zabbix_agentd.userparams.conf file.

Restart the Zabbix agent service.

In the Zabbix UI

Navigate to the Windows MySQL host.

Associate the “Template App MySQL” Zabbix template with the host.

Conclusion

As you can see, it’s a simple process to enable MySQL monitoring within Zabbix. There’s just a lack of documentation. Thoughts, comments, suggestions – post below or contact me.