Ad Widget

Collapse

Zabbix pre 5 MySQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • propusgemini@gmail.com
    Senior Member
    • Mar 2018
    • 108

    #1

    Zabbix pre 5 MySQL

    Hi, i can't monitoring zabbix mysql database

    error:

    Zabbix server MySQL: Failed to get items (no data for 30m)

    Macros are configured correctly
    Attached Files
  • gofree
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2017
    • 400

    #2
    do you monitor via agent ? version of the zabbix and agent ? what template ? does the user exist in the db - what rights does it have ? whats the error in the logs? ...you need to provide bit more info on the topic

    Comment

    • propusgemini@gmail.com
      Senior Member
      • Mar 2018
      • 108

      #3
      OK sorry for minimal information
      here report:




      Zabbix Agent
      zabbix_agentd (daemon) (Zabbix) 5.0.0rc1
      Revision ffde654900 5 May 2020, compilation time: May 5 2020 07:00:00

      Template:Template DB MySQL by Zabbix agent on zabbix server 5.0.0rc1

      grant MySQL user:

      MariaDB [(none)]> SHOW GRANTS FOR 'zbx_monitor';
      +------------------------------------------------------------------------------- ------------------------------------------------------------------------------+
      | Grants for zbx_monitor@% |
      +------------------------------------------------------------------------------- ------------------------------------------------------------------------------+
      | GRANT PROCESS, SHOW DATABASES, REPLICATION CLIENT, SHOW VIEW ON *.* TO 'zbx_mo nitor'@'%' IDENTIFIED BY PASSWORD '*016DEE8FAE643B3B63C38EBD87D707EC037555AF' |
      +------------------------------------------------------------------------------- ------------------------------------------------------------------------------+
      1 row in set (0.000 sec)



      In /etc/zabbix/ i've added .my.cnf file:


      #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...ion-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 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"


      ERROR IN LOGS agent and Server nothing is attributable to this case


      Comment

      • gofree
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2017
        • 400

        #4
        just a quick guess - maybe you cnf file is not in the right directory - /etc/zabbix maybe should be /etc/zabbix/zabbix_agent.d/

        try to run some of the user parameters it might give you some output



        Comment

        • propusgemini@gmail.com
          Senior Member
          • Mar 2018
          • 108

          #5
          Ok create a folder zabbix under /var/lib create a .my.cnf file in that folder

          [client]
          user=zbx_monitor
          password=<password>

          Then download from git the template mysql by agent and copy to /etc/zabbix/zabbix_agentd.d$
          cat template

          Code:
          #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 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"
          No Macro configured on my host.
          All works fine

          only 1 error in template in attach

          Attached Files

          Comment

          Working...