I'm planning to use Temple MySQL to monitor MySQL detail instances. Unfortunatelly I can't get result. What am I still missing in configuration. Check it out zabbix-agent log those are piece of log not the whole log.
XECUTE_STR() command:'/usr/lib/zabbix/externalscripts/mysql_check.pl' len:0 cmd_result:''
28786:20160121:141008.072 Sending back []
28786:20160121:141008.072 listener #2 [waiting for connection]
28788:20160121:141008.648 In send_buffer() host:'127.0.0.1' port:10051 values:0/100
28788:20160121:141008.648 End of send_buffer():SUCCEED
28788:20160121:141008.648 active checks #1 [idle 1 sec]
28784:20160121:141008.795 collector [processing data]
28784:20160121:141008.796 In update_cpustats()
28784:20160121:141008.796 End of update_cpustats()
28784:20160121:141008.796 collector [idle 1 sec]
28785:20160121:141009.075 listener #1 [processing request]
28785:20160121:141009.075 Requested [mysql[root,Qwestions,lld]]
1. Add special user for MySQL:
example:
GRANT USAGE ON *.* TO 'zabbix'@'%' IDENTIFIED BY 'superpassword';
FLUSH PRIVILEGES;
2. Add user params into zabbix-agent configuration
Edit /etc/zabbix/zabbix_agentd.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
# 'sum' on data_length or index_length alone needed when we are getting this information for whole database instead of a single table
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
if you want to extend monitoring items just add another UserParameter
with proper SQL-query
3. Add auth-file for MySQL:
create .my.cnf
file into /etc/zabbix/
[client]
user = zabbix
password = superpassword
4. Restart agent (and zabbix-proxy if you use it)