Zabbix: user parameter mysql.status[*] - setting HOME

5,810

You need to create a .my.cnf file in Zabbix's home directory which has Zabbix's MySQL credentials.

[client]
user=zabbix
password=Whatever

You should have previously created a user for Zabbix.

GRANT USAGE ON *.* TO 'zabbix'@'localhost' IDENTIFIED BY 'Whatever';
Share:
5,810

Related videos on Youtube

SPRBRN
Author by

SPRBRN

Updated on September 18, 2022

Comments

  • SPRBRN
    SPRBRN almost 2 years

    When I add the MySQL template to a host in Zabbix, it always reports an issue that the MySQL Service is down, while it is not.

    I've created a new item for one host (the Zabbix server itself which runs its own MySQL server) to test an ODBC connection to MySQL. That works. The next step is to solve the issue "MySQL is down".

    • Open the host configuration (in this case the Zabbix server / localhost)
    • Open items
    • Click one of the MySQL items, like: MySQL slow queries
    • The description field says: It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf. This is the same for all MySQL items.

    I open /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf, and there it says:

    # For all the following commands HOME should be set to the directory that has .my.cnf file with password information.
    
    # Flexible parameter to grab global variables. On the frontend side, use keys like mysql.status[Com_insert].
    # Key syntax is mysql.status[variable].
    UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}'
    

    There is no .my.cnf file anywhere on this Amazon Linux system, but there is /etc/my.cnf. Then what is the HOME path? Or is it /var/lib/mysql instead of /var/lib/zabbix (which does not exist)? I've tried that but that doesn't work.

  • SPRBRN
    SPRBRN over 8 years
    See serverfault.com/q/737265/147006 for an another issue.