Ad Widget

Collapse

Template App MySQL issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jrdnyquist
    Junior Member
    • Jun 2007
    • 6

    #1

    Template App MySQL issue

    In Zabbix 3.0.2, Template App MySQL is failing with status "unknown". This is a Plesk server and mysql is accessed like this:

    # mysqladmin -u admin -p$(cat /etc/psa/.psa.shadow) ping
    mysqld is alive

    Notice admin is the username and the password is catted and encrypted in /etc/psa/.psa.shadow

    In the agent on CentOS 7, there is /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf

    Inside is:

    UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin ping | grep -c alive

    I've tried modifying that so that it includes the user/pass setup like this:

    UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin -u admin -p$(cat /etc/psa/.psa.shadow) ping | grep -c alive

    I've restarted the agent each time after also trying to escape the $

    This still doesn't work. Any ideas what I am doing wrong here?

    Thanks!
  • kloczek
    Senior Member
    • Jun 2006
    • 1771

    #2
    If you are using mysql 5.6 it allows use access to mysql account without passing passwords in command line. Such password can be seen over ps command by other users.
    On mysql <=5.5 you should store your password in [client] section of your ~/.my.cnf. On 5.6 you can use for this mysql_config_editor to store your cryped credentials.
    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
    https://kloczek.wordpress.com/
    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
    My zabbix templates https://github.com/kloczek/zabbix-templates

    Comment

    • jrdnyquist
      Junior Member
      • Jun 2007
      • 6

      #3
      This is MariaDB 10.1 and it doesn't support mysql_config_editor. Also, I can't use /root/my.cnf because of Plesk. Is there any method (or hacked up way) of passing credentials for the check from Zabbix agentd?

      Comment

      • jrdnyquist
        Junior Member
        • Jun 2007
        • 6

        #4
        Was able to get this working:

        mysql> USE mysql
        mysql> GRANT USAGE ON *.* TO 'zabbixstats'@'localhost' IDENTIFIED BY 'PASSWORD';

        Modify userparameter_mysql.conf to add user/pass/hostname. Here's an example of one of the lines...

        UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin -h localhost -u zabbixstats -pPASSWORD ping | grep -c alive

        Restart Zabbix Agent

        Remove/Unlink and Re-Add MySQL Template

        Now I see the MySQL Down trigger working and all of the stats being collected and graphed.

        Thanks!

        Comment

        Working...