I am trying to check whether MySql is up by using a UserParameter in zabbix.
UserParameter looks like this.
UserParameter=mysql.ping,sudo mysqladmin ping | grep -c alive | wc -l
When I execute mysqladmin ping | grep -c alive
in the server, it is giving me the correct response.
#mysqladmin ping | grep alive | wc -l
1
But when I try to run the command as a zabbix user, It is giving the following error:
# sudo -u zabbix sudo mysqladmin ping | grep alive | wc -l mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using >password: NO)'
0
Just running the following works:
# sudo -u zabbix mysqladmin
..listing out various commands in mysqladmin
I have added zabbix to the sudoers list, requiring no password.
The issue is just for MySql, all other UserParameters (e.g. mail,load etc.) are working fine.