nitzien / zabbix-misc

zabbix-misc
25 stars 49 forks source link

Unsupported item key. #6

Closed dominicpratt closed 2 years ago

dominicpratt commented 4 years ago

Good morning,

unfortunately the template does not work for me. I get the error message:

root@www3 /etc/zabbix/zabbix_agentd.d # zabbix_agentd -t MySQL.Server-Status
MySQL.Server-Status                           [m|ZBX_NOTSUPPORTED] [Unsupported item key.]

/etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf:

#template_db_mysql.conf created by Zabbix for "Template DB MySQL" and Zabbix 4.2
#For OS Linux: You need create .my.cnf in zabbix-agent home directory (/var/lib/zabbix by default)
#For OS Windows: You need add PATH to mysql and mysqladmin and create my.cnf in %WINDIR%\my.cnf,C:\my.cnf,BASEDIR\my.cnf https://dev.mysql.com/doc/refman/5.7/en/option-files.html
#The file must have three strings:
#[client]
#user=zbx_monitor
#password=<password>
#
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 SUM(DATA_LENGTH + INDEX_LENGTH) 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 --defaults-file=/var/lib/zabbix/.my.cnf --defaults-group-suffix=_monitoring -e  "show slave status \G" | sed -e "s/^\s*//g" | sed -e "s/:\s*/:/g" |  jq -c  '.  | split("\n")[1:-1]  | map (split(":") | {(.[0]) : .[1]}  ) | add  ' -R -s

Zabbix Version 4.4.4 on Debian Buster.

Can somebody point me to the right direction?

Thanks, Dominic

nitzien commented 4 years ago

Hi Dominic,

You seems to have added user parameter for Mysql.Slave-status instead of Mysql.Server-Status.

Please add following in your zabbix agent config file. Also, please make sure /etc/zabbix/.my.cnf is configured well. Your --defaults-group-suffix should be passed correctly as per configuration

UserParameter=Mysql.Server-Status, mysql --defaults-file=/etc/zabbix/.my.cnf --defaults-group-suffix=_monitoring -N -e "show global status" | jq -c '. | split("\n")[:-1] | map (split("\t") | {(.[0]) : .[1]} ) | add ' -R -s

And then test following- zabbix_agentd -t Mysql.Server-Status

manu-p commented 4 years ago

Hi @nitzien

zabbix-agent2 1:5.0.2-1+bionic amd64 Zabbix network monitoring solution - agent

I created a userparameter_mysql.conf file in /etc/zabbix/zabbix_agent2.d with: UserParameter=Mysql.Server-Status, mysql --defaults-file=/etc/zabbix/.my.cnf --defaults-group-suffix=_monitoring -N -e "show global status" | jq -c '. | split("\n")[:-1] | map (split("\t") | {(.[0]) : .[1]} ) | add ' -R -s

/etc/zabbix/.my.cnf exists and contains credentials for the zabbix MySQL user and mysql --defaults-file=/etc/zabbix/.my.cnf --defaults-group-suffix=_monitoring -N -e "show global status" | jq -c '. | split("\n")[:-1] | map (split("\t") | {(.[0]) : .[1]} ) | add ' -R -s returns a bunch of data.

But...

# zabbix_agent2 -t Mysql.Server-Status
Mysql.Server-Status                           [m|ZBX_NOTSUPPORTED] [Unknown metric Mysql.Server-Status]

What would be missing?

manu-p commented 4 years ago

More information:

zabbix_get -s 127.0.0.1 -k Mysql.Server-Status returns a bunch of data.

Now I need to understand why nothing's being displayed in the widget for the monitored host...

nitzien commented 4 years ago

Is your agent configured for active or passive mode?

Regards, Nitin

On Thu, Aug 20, 2020, 7:18 PM manu-p notifications@github.com wrote:

More information:

zabbix_get -s 127.0.0.1 -k Mysql.Server-Status returns a bunch of data.

Now I need to understand why nothing's being displayed in the widget for the monitored host...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nitzien/zabbix-misc/issues/6#issuecomment-677675255, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEBZMD6YTNLEHC2ROXWTX3SBUSTBANCNFSM4KKBVVDQ .

manu-p commented 4 years ago

Active @nitzien , but I found the reason: Iwas not using the correct MySQL Template... Apologies!

Thanks for the work!