Ad Widget

Collapse

No data from mysql by zabbix-agent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lukaszte
    Junior Member
    • Oct 2021
    • 2

    #1

    No data from mysql by zabbix-agent

    Hi all.
    I have a problem with mysql (MariaDB-10.3.31) monitoring by zabbix-agent, system parameters like CPU, memory and other works fine.
    Agent configuration (Ubuntu 20.04): zabbix-agent-4.0.17+dfsg-1
    Code:
    PidFile=/run/zabbix/zabbix_agentd.pid
    LogFile=/var/log/zabbix-agent/zabbix_agentd.log
    LogFileSize=100
    Server=10.10.10.254
    ServerActive=10.10.10.254
    Hostname=db.mydomain.tld
    Include=/etc/zabbix/zabbix_agentd.conf.d/*.conf
    Userparameter:
    Code:
    UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/etc/zabbix mysql -N | awk '{print $$2}'
    UserParameter=mysql.size[*],bash -c '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$([[ "$1" = "all" || ! "$1" ]] || echo " where table_schema=\"$1\"")$([[ "$2" = "all" || ! "$2" ]] || echo "and table_name=\"$2\"");" | HOME=/etc/zabbix mysql -N'
    UserParameter=mysql.ping,HOME=/etc/zabbix mysqladmin ping | grep -c alive
    UserParameter=mysql.version,mysql -V
    /etc/zabbix mysql/.my.cnf:
    Code:
    [client]
    user = zabbix_user
    password = password
    On server in logs i see:
    Code:
    2346141:20211005:165120.440 item "db.mydomain.tld:mysql.get_status_variables["{$MYSQL.HOST}","{$MYSQL.PORT}"]" became not supported: Unsupported item key.
    2346141:20211005:165120.440 item "db.mydomain.tld:mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"]" became not supported: Unsupported item key.
    2346141:20211005:165120.551 item "db.mydomain.tld:mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"]" became not supported: Unsupported item key.
    2346133:20211005:171151.192 discovery rule "db.mydomain.tld:mysql.db.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"]" became not supported: Unsupported item key.
    2346134:20211005:171152.483 discovery rule "db.mydomain.tld:mysql.replication.discovery["{$MYSQL.HOST}","{$MYSQL.PORT}"]" became not supported: Unsupported item key.
    2346142:20211005:205101.938 error reason for "db.mydomain.tld:mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"]" changed: Item does not allow parameters.
    2346142:20211005:205103.237 error reason for "db.mydomain.tld:mysql.version["{$MYSQL.HOST}","{$MYSQL.PORT}"]" changed: Item does not allow parameters.
    And in web dashboard i see: No data for Template DB MySQL by Zabbix agent.
    Could you help me?
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    If you read the error messages, there are clues in there for several different problems.

    2346141:20211005:165120.440 item "db.mydomain.tld:mysql.get_status_variables["{$MYSQL.HOST}","{$MYSQL.PORT}"]" became not supported: Unsupported item key.
    Your earlier list of UserParameter's that you have configured doesn't include an item key named "mysql.get_status_variables", so the error "Unsupported item key" makes sense.

    2346142:20211005:205101.938 error reason for "db.mydomain.tld:mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"]" changed: Item does not allow parameters.
    Your earlier list of UserParameters shows "mysql.ping", not "mysql.ping[*]", so you've defined a user parameter that doesn't take any parameters. Therefore, you're getting the error "Item does not allow parameters".

    The same problem is true for mysql.version, your definition doesn't allow item parameters.

    Overall it appears that you're using a newer version of some template(s) but you are using an older version of the necessary UserParameter configuration. They don't appear to match. Perhaps the template(s) you're using have updated documentation on what mysql-related UserParameters you need to configure?

    Comment

    • lukaszte
      Junior Member
      • Oct 2021
      • 2

      #3
      Thank you for explaination! Maby could you explain me one more thing:
      New version of my mysql.ping:
      Code:
      UserParameter=mysql.ping[*],mysqladmin -u zabbix_monitor --password='password' ping|grep alive|wc -l
      return 1.
      In server logs i have:
      Code:
      2346139:20211007:184101.984 item "db.mydomain.tld:mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"]" became supported
      Why the trigger from mysql template:
      Code:
      {db.mydomain.tld:mysql.ping["{$MYSQL.HOST}","{$MYSQL.PORT}"].last(#1)}=0
      return the problem with mysql service? Trigger get value 0.
      There is no more logs for this host.
      //edited:
      OK, I have it!
      this is the correct way with host and port like in trigger:
      Code:
      UserParameter=mysql.ping[*], mysqladmin -h"$1" -P"$2" ping
      Last edited by lukaszte; 07-10-2021, 19:05.

      Comment

      Working...