Hi Guys,
today for the first time i tried to create MySQL monitoring agent for my Zabbix server. And unfortunately i have encouraged some issues.
I've created userparameter_mysql.conf
with this code:
# 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=/etc/zabbix mysql -N | awk '{print $$2}' # My line
#
# Flexible parameter to determine database or table size. On the frontend side, use keys like mysql.size[zabbix,history,data].
# Key syntax is mysql.size[<database>,<table>,<type>].
# Database may be a database name or "all". Default is "all".
# Table may be a table name or "all". Default is "all".
# Type may be "data", "index", "free" or "both". Both is a sum of data and index. Default is "both".
# Database is mandatory if a table is specified. Type may be specified always.
# Returns value in bytes.
# 'sum' on data_length or index_length alone needed when we are getting this information for whole database instead of a single table
UserParameter=mysql.size[*],echo "select sum($(case "$3" in both|"") echo "data_length+index_length";; data|index) echo "$3_length";; free) echo "data_free";; esac)) from information_schema.tables$([[$
UserParameter=mysql.ping,HOME=/etc/zabbix mysqladmin ping | grep -c alive
UserParameter=mysql.buffer_pool_efficiency,HOME=/etc/zabbix mysqladmin status | cut -f2 -d ":" | cut -f1 -d "T" | tr -d " "
UserParameter=mysql.buffer_pool_utilization,HOME=/etc/zabbix mysqladmin status | cut -f2 -d ":" | cut -f1 -d "T" | tr -d " "
UserParameter=mysql.get_status_variables,HOME=/etc/zabbix mysqladmin status | cut -f2 -d ":" | cut -f1 -d "T" | tr -d " "
UserParameter=mysql.uptime,HOME=/etc/zabbix mysqladmin status | cut -f2 -d ":" | cut -f1 -d "T" | tr -d " "
UserParameter=mysql.threads,HOME=/etc/zabbix mysqladmin status | cut -f3 -d ":" | cut -f1 -d "Q" | tr -d " "
UserParameter=mysql.questions,HOME=/etc/zabbix mysqladmin status | cut -f4 -d ":"|cut -f1 -d "S" | tr -d " "
UserParameter=mysql.slowqueries,HOME=/etc/zabbix mysqladmin status | cut -f5 -d ":" | cut -f1 -d "O" | tr -d " "
UserParameter=mysql.qps,HOME=/etc/zabbix mysqladmin status | cut -f9 -d ":" | tr -d " "
UserParameter=mysql.version,mysql -V
I've created file .my.cnf in /etc/zabbix with these values (not showing you my passwords)
[mysql]
user=root
password=******
[mysqladmin]
user=root
password=******
I've restarted zabbix agent and server
When I do zabbix get for
zabbix_get -s 127.0.0.1 -k mysql.ping
i get value 1
zabbix_get -s 127.0.0.1 -k mysql.uptime
i get value 253464
etc etc basically zabbix get gives me values
I've tried zabbix -t as well same results I do get informations
But in my web interface host latest data nothing is appearing. I've tried both templates Mysql and Mysql by agent. agent is on localhost with server and i do get data from agent for monitoring zabbix server.
I've tried to simply add template to existing zabbix server host - no info about mysql is coming, ive tried to create seperate host for mysql database still no joy.
Here are errors from server log:
31101:20200416:123156.399 item "Zabbix Server Mysql:mysql.buffer_pool_efficiency" became not supported: Cannot evaluate expression: "Cannot evaluate function "last()": not enough data.".
31101:20200416:123157.768 item "Zabbix Server Mysql:mysql.buffer_pool_utilization" became not supported: Cannot evaluate expression: "Cannot evaluate function "last()": not enough data.".
31101:20200416:123157.768 item "Zabbix Server Mysql:mysql.get_status_variables["{$MYSQL.HOST}","{$MYSQL.PORT}"]" became not supported: Item does not allow parameters.
31101:20200416:123158.235 item "Zabbix Server Mysql:mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"]" became not supported: Item does not allow parameters.
today for the first time i tried to create MySQL monitoring agent for my Zabbix server. And unfortunately i have encouraged some issues.
I've created userparameter_mysql.conf
with this code:
# 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=/etc/zabbix mysql -N | awk '{print $$2}' # My line
#
# Flexible parameter to determine database or table size. On the frontend side, use keys like mysql.size[zabbix,history,data].
# Key syntax is mysql.size[<database>,<table>,<type>].
# Database may be a database name or "all". Default is "all".
# Table may be a table name or "all". Default is "all".
# Type may be "data", "index", "free" or "both". Both is a sum of data and index. Default is "both".
# Database is mandatory if a table is specified. Type may be specified always.
# Returns value in bytes.
# 'sum' on data_length or index_length alone needed when we are getting this information for whole database instead of a single table
UserParameter=mysql.size[*],echo "select sum($(case "$3" in both|"") echo "data_length+index_length";; data|index) echo "$3_length";; free) echo "data_free";; esac)) from information_schema.tables$([[$
UserParameter=mysql.ping,HOME=/etc/zabbix mysqladmin ping | grep -c alive
UserParameter=mysql.buffer_pool_efficiency,HOME=/etc/zabbix mysqladmin status | cut -f2 -d ":" | cut -f1 -d "T" | tr -d " "
UserParameter=mysql.buffer_pool_utilization,HOME=/etc/zabbix mysqladmin status | cut -f2 -d ":" | cut -f1 -d "T" | tr -d " "
UserParameter=mysql.get_status_variables,HOME=/etc/zabbix mysqladmin status | cut -f2 -d ":" | cut -f1 -d "T" | tr -d " "
UserParameter=mysql.uptime,HOME=/etc/zabbix mysqladmin status | cut -f2 -d ":" | cut -f1 -d "T" | tr -d " "
UserParameter=mysql.threads,HOME=/etc/zabbix mysqladmin status | cut -f3 -d ":" | cut -f1 -d "Q" | tr -d " "
UserParameter=mysql.questions,HOME=/etc/zabbix mysqladmin status | cut -f4 -d ":"|cut -f1 -d "S" | tr -d " "
UserParameter=mysql.slowqueries,HOME=/etc/zabbix mysqladmin status | cut -f5 -d ":" | cut -f1 -d "O" | tr -d " "
UserParameter=mysql.qps,HOME=/etc/zabbix mysqladmin status | cut -f9 -d ":" | tr -d " "
UserParameter=mysql.version,mysql -V
I've created file .my.cnf in /etc/zabbix with these values (not showing you my passwords)
[mysql]
user=root
password=******
[mysqladmin]
user=root
password=******
I've restarted zabbix agent and server
When I do zabbix get for
zabbix_get -s 127.0.0.1 -k mysql.ping
i get value 1
zabbix_get -s 127.0.0.1 -k mysql.uptime
i get value 253464
etc etc basically zabbix get gives me values
I've tried zabbix -t as well same results I do get informations
But in my web interface host latest data nothing is appearing. I've tried both templates Mysql and Mysql by agent. agent is on localhost with server and i do get data from agent for monitoring zabbix server.
I've tried to simply add template to existing zabbix server host - no info about mysql is coming, ive tried to create seperate host for mysql database still no joy.
Here are errors from server log:
31101:20200416:123156.399 item "Zabbix Server Mysql:mysql.buffer_pool_efficiency" became not supported: Cannot evaluate expression: "Cannot evaluate function "last()": not enough data.".
31101:20200416:123157.768 item "Zabbix Server Mysql:mysql.buffer_pool_utilization" became not supported: Cannot evaluate expression: "Cannot evaluate function "last()": not enough data.".
31101:20200416:123157.768 item "Zabbix Server Mysql:mysql.get_status_variables["{$MYSQL.HOST}","{$MYSQL.PORT}"]" became not supported: Item does not allow parameters.
31101:20200416:123158.235 item "Zabbix Server Mysql:mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"]" became not supported: Item does not allow parameters.
Comment