Ad Widget

Collapse

Weird problem with MySQL monitoring on CentOS7

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Weird problem with MySQL monitoring on CentOS7

    Hi.

    I've made a new deployment of Zabbix 4.2 and it's working great. I've just a problem with a single linux host for which I'm unable to monitor MySQL. I have another twin machine for which works perfectly, on this single server I'm unable to make it work!
    If I manually test the item it works:
    # zabbix_agentd -t mysql.status[Com_begin]
    mysql.status[Com_begin] [t|2]


    If I test if from zabbix user with sudo or su it returns the correct value. But when run by zabbix agent:

    25258:20190614:105750.418 EXECUTE_STR() command:'echo "show global status where Variable_name='Uptime';" | HOME=/var/lib/zabbix mysql -N | awk '{print $2}'' len:103 cmd_result:'ERROR 2002 (HY000): '
    25258:20190614:105750.418 Sending back [ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)]


    again manually running the commands shown in the debug return the correct value.
    I cannot really understand what's different in zabbix agent daemon which makes it fail!
    Any hint is welcome.


    [[email protected] zabbix_agentd.d]# cat /etc/centos-release
    CentOS Linux release 7.6.1810 (Core)
    [[email protected] zabbix_agentd.d]# zabbix_agentd -V
    zabbix_agentd (daemon) (Zabbix) 4.2.3
    Revision 3685611ba5 5 June 2019, compilation time: Jun 7 2019 10:27:34

    Copyright (C) 2019 Zabbix SIA
    License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it according to
    the license. There is NO WARRANTY, to the extent permitted by law.

    This product includes software developed by the OpenSSL Project
    for use in the OpenSSL Toolkit (http://www.openssl.org/).

    Compiled with OpenSSL 1.0.1e-fips 11 Feb 2013
    Running with OpenSSL 1.0.1e-fips 11 Feb 2013



    #2
    Hi,

    Permissions of zabbix agent user run without sudo.

    Check "ls -lah /var/lib/zabbix"

    You may consider changing the ownership of the file to start with.
    Code:
    # chown zabbix:zabbix /var/lib/zabbix/.my.cnf
    # chmod 600 /var/lib/zabbix/.my.cnf

    Comment


      #3
      Thanks but permissions were already ok, I just had .my.cnf as 622 but after setting it to 600 nothing changed

      Comment


        #4
        Is zabbix user the owner of the .my.cnf file?

        How about the location of var/lib/mysql/mysql.sock file? Does that exist?

        Comment


          #5
          Originally posted by ingus.vilnis View Post
          Is zabbix user the owner of the .my.cnf file?

          How about the location of var/lib/mysql/mysql.sock file? Does that exist?
          The path exists, all permissions are fine for user zabbix. I tried forcing TCP connection in my.cnf but still returns failed login, but for tcp. It's really weird!!

          Comment


            #6
            After restarting the server Zabbix managed to collect MySQL data. Inexplicable, but at least it works.

            Comment

            Working...
            X