Skip to content

Zabbix MySQL monitoring

Конфиги на агенте

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

Cоздать отдельного пользователя в Mysql

-- MySQL
GRANT USAGE ON *.* TO 'zabbix'@'localhost' IDENTIFIED BY 'zabbixpassword';
FLUSH PRIVILEGES;

-- Ver 14.14 Distrib 5.6.35-80.0 Percona
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'zabbixpassword';
GRANT USAGE ON *.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;

/etc/zabbix/.my.cnf

ZABPASS=`shuf -ez -n20  {A..Z} {a..z} {0..9}`

[client]
user=zabbix
password=zabbixpassword