Ad Widget

Collapse

MySQL.ping not returning the same value on 2 different hosts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phil570
    Junior Member
    • Oct 2018
    • 9

    #1

    MySQL.ping not returning the same value on 2 different hosts

    Hello,

    I'm experiencing something strange with the MySQL template (mysql.ping item)

    I have 2 MySQL servers, both with the same userparameter in /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf :

    Code:
    UserParameter=mysql.ping,HOME=/etc/zabbix mysqladmin -s ping | grep -c alive

    On both servers, I also have /etc/zabbix/.my.cnf (the credentials in .my.cnf have been tested)

    The problem is that on 1 server, the zabbix agent returns me the right value (1) and on the second server, the agent returns me 0, but MySQL service is running, I can connect to the DB, and if I run the command manually it returns me the right value (1) :

    Code:
    [root@h042d1app02p ~]# mysqladmin --defaults-file=/etc/zabbix/.my.cnf -s ping | grep -c alive
    1
    or
    Code:
    [root@h042d1app02p ~]# HOME=/etc/zabbix mysqladmin -s ping | grep -c alive
    1
    The agent that is returning the right value is version 3.4.4 and the other one is 3.4.11

    Did someone already encountered this issue?

    Thanks in advance

    Best regards,

    Philippe

  • dimir
    Zabbix developer
    • Apr 2011
    • 1080

    #2
    Perhaps on one machine Zabbix agent is running as root, on another not? Try on both sides
    Code:
    sudo -u zabbix mysqladmin --defaults-file=/etc/zabbix/.my.cnf -s ping

    Comment

    • phil570
      Junior Member
      • Oct 2018
      • 9

      #3
      Hello dimir,

      Thanks for your answer

      I just made the test and it seems to return the right value on both side when I run this command manually :

      Code:
      [root@h042d1app02p loginuser]# sudo -u zabbix mysqladmin --defaults-file=/etc/zabbix/.my.cnf -s ping
      mysqld is alive
      [root@h042d1app02p loginuser]# sudo -u zabbix mysqladmin --defaults-file=/etc/zabbix/.my.cnf -s ping | grep -c alive
      1
      I also checked on both side, the Zabbix agent is running as zabbix user :

      Code:
      [root@h042d1app01p loginuser]# ps -aux | grep zabbix
      zabbix   151006  0.0  0.0  84892  1240 ?        S    Dec13   0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
      zabbix   151008  0.0  0.0  84892  1412 ?        S    Dec13   0:52 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
      zabbix   151009  0.0  0.0  85016  2576 ?        S    Dec13   0:28 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
      zabbix   151010  0.0  0.0  85016  2576 ?        S    Dec13   0:27 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
      zabbix   151011  0.0  0.0  85016  2576 ?        S    Dec13   0:28 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
      zabbix   151012  0.0  0.0  85024  2224 ?        S    Dec13   0:08 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]

      Comment

      Working...