Ad Widget

Collapse

Template DB MySQL by Zabbix agent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mgr@winet.ch
    Junior Member
    • Oct 2022
    • 5

    #1

    Template DB MySQL by Zabbix agent

    Hi everybody

    I am trying to Monitor the mariadb of the zabbix server. The only item that is working is the MySQL: Status.

    In the logfile i get this failure:
    noname.xml:1: parser error : Start tag expected, '<' not found
    Warning: World-writable config file '/var/lib/zabbix/.my.cnf' is ignored​

    In the frontend i get this failure:
    Preprocessing failed for: Warning: World-writable config file '/var/lib/zabbix/.my.cnf' is ignored.mysql: unknown variable ...
    1. Failed: cannot extract XML value with xpath "/resultset/row[field/text()='Aborted_connects']/field[@name='Value']/text()": cannot parse xml value: Start tag expected, '<' not found



    I followed the instructions in the template

    Requirements for template operation:
    1.Install Zabbix agent and MySQL client.
    -> Zabbix agent and mariadb are up and runnning

    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.
    -> Done, content of the file:
    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"

    3.Create MySQL user for monitoring. For example:
    CREATE USER 'zbx_monitor'@'%' IDENTIFIED BY '<password>';
    GRANT REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON *.* TO 'zbx_monitor'@'%';
    For more information read the MySQL documentation https://dev.mysql.com/doc/refman/8.0/en/grant.html , please.
    -> Done, login with password works fine

    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>'
    -> Done, file is located in var/lib/zabbix/



    Any idea what's missing? Please help me :-)



  • mgr@winet.ch
    Junior Member
    • Oct 2022
    • 5

    #2
    I am using:

    Debian 11
    Zabbix Server Version 6.2.3
    MariaDB 10.5.15​

    And sorry the MySQL: Status does not work properly too. It says service down.

    Comment

    • Markku
      Senior Member
      Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
      • Sep 2018
      • 1781

      #3
      Fix this as a starter:

      Preprocessing failed for: Warning: World-writable config file '/var/lib/zabbix/.my.cnf' is ignored.
      Markku

      Comment

      Working...