- First add the template to the host in the web interface and enable it.
- Second add following content to /etc/zabbix/zabbix_agentd.conf.d/userparameters_mysql.conf on the agent host:
UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/etc/zabbix mysql -N | awk '{print $$2}' UserParameter=mysql.size[*],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" = "all" || ! "$1" ]] || echo " where table_schema='$1'")$([[ "$2" = "all" || ! "$2" ]] || echo "and table_name='$2'");" | HOME=/etc/zabbix mysql -N UserParameter=mysql.ping,HOME=/etc/zabbix mysqladmin -s ping | grep -c alive UserParameter=mysql.version,mysql -V- Third, add following to /etc/zabbix/.my.cnf :
- In MySQL run (adjust username/password):[client]
user=zabbix
password=yourpassword
GRANT USAGE ON *.* TO 'zabbix'@'127.0.0.1' IDENTIFIED BY '123456'- Restart Zabbix Agent, Data takes 1-2minute before it shows up on server
No comments:
Post a Comment