Zabbix running-slave check fails

Bug #1310723 reported by Pavel A.
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Monitoring Plugins
Fix Released
Medium
Unassigned

Bug Description

I've just noticed running slave check fails for me(debian wheezy, percona 5.5, zabbix 2.2.3 from repos). zabbix_agentd.log reports:
ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: NO).
That's inspite there are all checks like ok. Quick digging into revealed that it fails at running slave check:

if [ "$ITEM" = "running-slave" ]; then
    # Check for running slave
    RES=`mysql -e 'SHOW SLAVE STATUS\G' | egrep '(Slave_IO_Running|Slave_SQL_Running):' | awk -F: '{print $2}' | tr '\n' ','`

I would proposed to fix like

ITEM=$1
HOST=localhost
+ HOME=/var/lib/zabbix
DIR=`dirname $0`

RES=`${HOME} mysql -e 'SHOW SLAVE STATUS\G' | egrep '(Slave_IO_Running|Slave_SQL_Running):' | awk -F: '{print $2}' | tr '\n' ','`

That works here.

Tags: zabbix
Revision history for this message
Roman Vynar (roman-vynar) wrote :

On Debian/Ubuntu, zabbix home dir is /var/run/zabbix instead of /var/lib/zabbix like it is on Redhat/Centos.

The documentation http://www.percona.com/doc/percona-monitoring-plugins/1.1/zabbix/index.html#installation-instructions was corrected at some point of time in the past, to create ~zabbix/.my.cnf instead of previous /var/lib/zabbix/.my.cnf.

So if you place your .my.cnf under ~zabbix/ no matter what's the actual dir is, it should work.

Changed in percona-monitoring-plugins:
status: New → Invalid
Revision history for this message
Pavel A. (vpaul) wrote :

Nope. The issue is ~zabbix/.my.cnf existed but slave check doesn't work. To process .my.cnf HOME variable has to be set.

http://dev.mysql.com/doc/refman/5.5/en/option-files.html

"~ represents the current user's home directory (the value of $HOME)."

Revision history for this message
Roman Vynar (roman-vynar) wrote :

Pavel, will it work if we add
HOME=~zabbix

Changed in percona-monitoring-plugins:
status: Invalid → Opinion
status: Opinion → Incomplete
tags: added: zabbix
Revision history for this message
Pavel A. (vpaul) wrote :

yes, fix I've proposed works for me.

RES=`HOME=/var/lib/zabbix mysql -e 'SHOW SLAVE STATUS\G' | egrep '(Slave_IO_Running|Slave_SQL_Running):' | awk -F: '{print $2}' | tr '\n' ','`

should work as well but defining HOME in the beginning is more clear, imho. It will be also easier to describe that in docu.

Changed in percona-monitoring-plugins:
status: Incomplete → In Progress
importance: Undecided → Medium
milestone: none → 1.1.4
Revision history for this message
Roman Vynar (roman-vynar) wrote :

I will prepend HOME=~zabbix to the mysql command.

Note, on debian, zabbix home is /var/run/zabbix-server, so you have to place .my.cnf in this folder.

Changed in percona-monitoring-plugins:
status: In Progress → Fix Committed
summary: - running-slave check fails
+ Zabbix running-slave check fails
Changed in percona-monitoring-plugins:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.