Operations 6 min read

Step-by-Step Guide to Configure Zabbix MySQL Monitoring on CentOS

This tutorial walks through setting up Zabbix to monitor MySQL on a CentOS server, covering environment preparation, creating configuration files, adjusting paths, restarting services, applying the MySQL template on the Zabbix server, and customizing triggers and actions.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Step-by-Step Guide to Configure Zabbix MySQL Monitoring on CentOS

1. System Environment

Software and versions OS: CentOS 6.8 zabbix: zabbix-3.2.4.tar.gz nginx: nginx-1.10.3.tar.gz MySQL: mysql-5.5.53-linux2.6-x86_64.tar.gz PHP: php-5.5.38.tar.gz

Installation paths Zabbix: /usr/local/zabbix MySQL:

/usr/local/mysql

2. Operations on the MySQL Server

2.1 Create .my.conf

The hidden .my.conf file stores MySQL credentials for Zabbix. Place it in the Zabbix etc directory, e.g.:

vim /usr/local/zabbix/etc/.my.conf
[mysql]
host=localhost
user=zabbix
password=zabbix
socket=/tmp/mysql.sock
[mysqladmin]
host=localhost
user=zabbix
password=zabbix
socket=/tmp/mysql.sock

2.2 Deploy userparameter_mysql.conf

Copy the supplied user‑parameter file and adjust paths:

cp ~/softwares/zabbix-3.2.4/conf/zabbix_agentd/userparameter_mysql.conf /usr/local/zabbix/etc/zabbix_agentd.conf.d/

Edit the file:

Change HOME=/var/lib/zabbix to HOME=/usr/local/zabbix/etc (the directory containing .my.conf).

Replace the relative mysql and mysqladmin commands with absolute paths, e.g.:

UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/usr/local/zabbix/etc /usr/local/mysql/bin/mysql -N | awk '{print $$2}'
UserParameter=mysql.ping,HOME=/usr/local/zabbix/etc /usr/local/mysql/bin/mysqladmin ping | grep -c alive
UserParameter=mysql.version,HOME=/usr/local/zabbix/etc /usr/local/mysql/bin/mysql -V

2.3 Include the file in zabbix_agentd.conf

Add the include line and uncomment it:

Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/

2.4 Restart the agent

service zabbix_agentd restart

3. Operations on the Zabbix Server

3.1 Apply the MySQL monitoring template

In the host configuration, add Template App MySQL. Screenshots illustrate the template selection.

3.2 View monitoring data

Navigate to Monitoring → Latest data, filter by host, and examine MySQL status, slow queries, etc. Screenshots show the data view.

4. Configure triggers and actions

Based on actual business needs, create appropriate triggers and actions. By default, a trigger fires when MySQL is down; further customization can be added as needed.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

ConfigurationLinuxmysqlZabbix
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.