Zabbix mysql

Iš Žinynas.
Jump to navigation Jump to search

Zabbix mysql monitoringas.

/etc/zabbix/zabbix_agentd.conf[keisti]

Pažiūrime ar yra toksai include:

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

Jeigu yra ok.

Sukuriam mysql vartotoja monitoringui[keisti]

create user 'zabbix_admin'@'localhost' IDENTIFIED BY 'Password';
GRANT USAGE ON *.* TO 'zabbix_admin'@'localhost' IDENTIFIED BY 'Password';
flush privileges;

/etc/zabbix/.my.cnf[keisti]

[mysql]
user=zabbix_admin
password=Password
[mysqladmin]
user=zabbix_admin
password=Password

/etc/zabbix/zabbix_agentd.conf.d/userparameter_mysql.conf[keisti]

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
UserParameter=mysql.version,mysql -V
UserParameter=mysql.size[*],bash -c 'echo "select sum($(case "$3" in both|"") echo "data_length+index_length";; data|index) echo "$3_length";; free) echo "data_free";; esac)) from information_schema.tables$(| ! "$1"  || echo " where table_schema=\"$1\"")$(| ! "$2"  || echo "and table_name=\"$2\"");" | HOME=/etc/zabbix mysql -N'