mysqlzabbixzabbix-apizabbix-custom-reports

MySQL template with Zabbix Agent cannot fetch data


Zabbix server is version 6.2

My pc is running Windows 11 and I install Zabbix agent onto it. I use the template MySQL by Zabbix agent to monitor mySQL

I did what the setup procedure says:

Requirements for template operation:

1.Install Zabbix agent and MySQL client.

2.Copy template_db_mysql.conf into folder with Zabbix agent configuration (/etc/zabbix/zabbix_agentd.d/ by default). Don't forget to restart zabbix-agent.

3.Create MySQL user for monitoring. For example: CREATE USER 'zbx_monitor'@'%' IDENTIFIED BY ''; GRANT REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON . TO 'zbx_monitor'@'%';

4.Create .my.cnf in home directory of Zabbix agent for Linux (/var/lib/zabbix by default) or my.cnf in c:\ for Windows. For example:

[client]
user='zbx_monitor'
password='<password>'

But I still cant get any data.

I can see the error Cannot fetch data: Error 1045: Access denied for user '3306'@'localhost' (using password: NO).

Has anybody encounter this kind of issue?

Any help is appreciated.


Solution

  • '3306'@'localhost' here it should try 'zbx_monitor'@'localhost'

    I think the issue is in your hosts macro on web interface to understand you have to know how the item work ->

    For example, the item key :

    mysql.get_status_variables["{$MYSQL.HOST}","{$MYSQL.PORT}"] 
    

    use the 'function' below with the macros value that you asigned in web interface

    UserParameter=mysql.get_status_variables[*], mysql -h"$1" -P"$2" -sNX -e "show global status"
    

    $1 is the first variable in the item key
    $2 is the port

    checks your macro here : screen macro

    Sorry i'm trying to help it may not be what you wanted