-
Problem report
-
Resolution: Fixed
-
Trivial
-
6.0.1
-
None
-
KVM Ubuntu 20.04 Linux 5.4.0-80-generic #90-Ubuntu SMP Fri Jul 9 22:49:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
abbix_agentd (daemon) (Zabbix) 6.0.1
Revision a80cb13868 1 March 2022, compilation time: Feb 27 2022 18:51:30
-
1
The MySQL template "MySQL by Zabbix agent" does not work
In /var/lib/zabbix created .my.cnf
[client]
user='zabbix_monitor'
password='password'{}
Also tried
[client]
user='zabbix_monitor'
password='password'{}
host = localhost
{{And }}
[mysql]
user='zabbix_monitor'
password='password'{}{}
In mysql create user with grant
GRANT USAGE,REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON . TO 'zabbix_monitor'@'localhost';
auth method correct too
zabbix_monitor | localhost | mysql_native_password | *72A13047AB1160DB1323E12A0862763A907DF629
template_db_mysql.conf have
UserParameter=mysql.ping[*], mysqladmin -h"$1" -P"$2" ping
UserParameter=mysql.get_status_variables[*], mysql -h"$1" -P"$2" -sNX -e "show global status"
UserParameter=mysql.version[*], mysqladmin -s -h"$1" -P"$2" version
UserParameter=mysql.db.discovery[*], mysql -h"$1" -P"$2" -sN -e "show databases"
UserParameter=mysql.dbsize[*], mysql -h"$1" -P"$2" -sN -e "SELECT COALESCE(SUM(DATA_LENGTH + INDEX_LENGTH),0) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='$3'"
UserParameter=mysql.replication.discovery[*], mysql -h"$1" -P"$2" -sNX -e "show slave status"
UserParameter=mysql.slave_status[*], mysql -h"$1" -P"$2" -sNX -e "show slave status"
Also tried this from https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/380651-zabbix-4-2-3-template-db-mysql-access-denied-for-user-zabbix-error
UserParameter=mysql.ping, mysqladmin --defaults-extra-file='/var/lib/zabbix/.my.cnf' ping | grep -c alive
UserParameter=mysql.get_status_variables, mysql --defaults-extra-file='/var/lib/zabbix/.my.cnf' -sNX -e "show global status"
UserParameter=mysql.version, mysql -V
UserParameter=mysql.db.discovery, mysql --defaults-extra-file='/var/lib/zabbix/.my.cnf' -sN -e "show databases"
UserParameter=mysql.dbsize[*], mysql --defaults-extra-file='/var/lib/zabbix/.my.cnf' -sN -e "SELECT SUM(DATA_LENGTH + INDEX_LENGTH) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='$1'"
UserParameter=mysql.replication.discovery[*], mysql --defaults-extra-file='/var/lib/zabbix/.my.cnf' -sNX -e "show slave status"
UserParameter=mysql.slave_status[*], mysql --defaults-extra-file='/var/lib/zabbix/.my.cnf' -sN -e "show slave status"
But in server logs see
Preprocessing failed for: ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: NO)
1. Failed: cannot extract XML value with xpath "/resultset/row[field/text()='Aborted_clients']/field[@name='Value']/text()": cannot parse xml value: Start tag expected, '<' not found
In Similar server and settings works fine in other KVM server. Please help