Ad Widget

Collapse

Problem With MariaDB Monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • johnsmith
    Junior Member
    • Nov 2019
    • 12

    #1

    Problem With MariaDB Monitoring

    Hello guys,

    I`ve installed the last version of Zabbix Server and Agent also (zabbix_agentd (daemon) (Zabbix) 4.4.1)

    I`ve problem with MariaDB server monitoring , I`ve googl too much before post here but what I see there is just old configuration

    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$([[$
    #
    #Default below
    UserParameter=mysql.ping,HOME=/etc/zabbix mysqladmin ping | grep -c alive
    #
    #My line
    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

    but my userparameter_mysql.conf looks like this


    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:
    #[mysqld]
    #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 -h"$1" -P"$2" -sNX -e "show slave status"

    Problem is that I`ve created .my.cnf in mostly every root /etc/zabbix , /usr/share/zabbix , etc and it doesn`t work

    In that configurtaion there`s written

    Code:
    For OS Linux: You need create .my.cnf in zabbix-agent home directory (/var/lib/zabbix by default)
    there`s not /var/lib/zabbix directory on my CentOS (CentOS Linux release 7.7.1908 (Core)) system .

    could you please help me to understand what I do wrong and how may I solve that problem ?
  • Atsushi
    Senior Member
    • Aug 2013
    • 2028

    #2
    When running on CentOS 7, the .my.cnf file in the home directory is not read unless the environment variable HOME is explicitly specified as in the configuration file of the previous version of Zabbix.




    It may be supported by changing the daemon startup method, but it has not been corrected yet.

    Comment

    • johnsmith
      Junior Member
      • Nov 2019
      • 12

      #3
      Originally posted by Atsushi
      When running on CentOS 7, the .my.cnf file in the home directory is not read unless the environment variable HOME is explicitly specified as in the configuration file of the previous version of Zabbix.




      It may be supported by changing the daemon startup method, but it has not been corrected yet.
      Thanks for your reply.

      What does it mean ? I need to run zabbix-agent with special arguments ?


      or maybe there`s another better template for mysql and postgresql too .... after mysql I need to monitor postgresql also .. any suggestions ?

      Comment

      • Atsushi
        Senior Member
        • Aug 2013
        • 2028

        #4
        Please read the contents of the page of the introduced URL carefully.
        If you want to move it for the time being, place the .my.cnf file in the home directory of the user who is running the Zabbix agent and try changing it to specify the environment variable HOME as with userparameter_mysql.conf in Zabbix 4.0 Please give me.

        Comment

        • johnsmith
          Junior Member
          • Nov 2019
          • 12

          #5
          Originally posted by Atsushi
          Please read the contents of the page of the introduced URL carefully.
          If you want to move it for the time being, place the .my.cnf file in the home directory of the user who is running the Zabbix agent and try changing it to specify the environment variable HOME as with userparameter_mysql.conf in Zabbix 4.0 Please give me.
          I`ve made /var/lib/zabbix directory , it`s home dir for zabbix user but it still doesn`t work

          Comment


          • Atsushi
            Atsushi commented
            Editing a comment
            Have you changed to set the environment variable HOME?

            ex.
            UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin -h"$1" -P"$2" ping
        • johnsmith
          Junior Member
          • Nov 2019
          • 12

          #6
          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:
          #[mysqld]
          #user=zbx_monitor
          #password=<password>
          #
          UserParameter=mysql.ping[*],HOME=/var/lib/zabbix mysqladmin -h"$1" -P"$2" ping
          UserParameter=mysql.get_status_variables[*],HOME=/var/lib/zabbix mysql -h"$1" -P"$2" -sNX -e "show global status"
          UserParameter=mysql.version[*],HOME=/var/lib/zabbix mysqladmin -s -h"$1" -P"$2" version
          UserParameter=mysql.db.discovery[*],HOME=/var/lib/zabbix mysql -h"$1" -P"$2" -sN -e "show databases"
          UserParameter=mysql.dbsize[*],HOME=/var/lib/zabbix 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[*],HOME=/var/lib/zabbix mysql -h"$1" -P"$2" -sNX -e "show slave status"
          UserParameter=mysql.slave_status[*],HOME=/var/lib/zabbix mysql -h"$1" -P"$2" -sNX -e "show slave status"
          looks like this Is it Correct?


          my.cnf is store at /var/lib/zabbix/.my.cnf

          Code:
          mysql]
          user=zbx_monitor
          password=<password>
          [mysqladmin]
          user=zbx_monitor
          password=<password>

          Comment

          • johnsmith
            Junior Member
            • Nov 2019
            • 12

            #7
            Oops , sorry .. my credentials was incorrect ... updated .my.cnf file and it works !

            Thank you so much


            btw, I`m going to monitor postgresql,rabbitmq,nginx and httpd also ... do I need something like this or that template works ?

            I just don`t want to spam forum and open new topis for all my questions ...

            Comment

            • Tek Chand
              Member
              • Mar 2019
              • 57

              #8
              johnsmith, We are using zabbix version 4.0.7 and want to monitor postgresql over zabbix. Are you successfully did this at your end?

              If yes..can you please give me some documentation for reference for zabbix 4.0.7? I am looking for it from last 7 days but no success.

              Any help will be appreciated.

              Thanks.

              Comment

              • johnsmith
                Junior Member
                • Nov 2019
                • 12

                #9
                Originally posted by Tek Chand
                johnsmith, We are using zabbix version 4.0.7 and want to monitor postgresql over zabbix. Are you successfully did this at your end?

                If yes..can you please give me some documentation for reference for zabbix 4.0.7? I am looking for it from last 7 days but no success.

                Any help will be appreciated.

                Thanks.
                Hello,

                I`m working on it ... in previous 2-3 days I`ve tried too much configuration but no one is working for me .. try to configure according zabbix github instructions but it don`t work ...

                Comment

                • Tek Chand
                  Member
                  • Mar 2019
                  • 57

                  #10
                  johnsmith, Thank you for your response. I also tried but no success. I am facing issue because i am using zabbix version 4.0.7 and mostly configuration are tested over zabbix 3+ or zabbix 4.2. If you got success please help me also.

                  Thanks.

                  Comment

                  • johnsmith
                    Junior Member
                    • Nov 2019
                    • 12

                    #11
                    Originally posted by Tek Chand
                    johnsmith, Thank you for your response. I also tried but no success. I am facing issue because i am using zabbix version 4.0.7 and mostly configuration are tested over zabbix 3+ or zabbix 4.2. If you got success please help me also.

                    Thanks.
                    I`ll try today also to set it up .

                    Write you here instructions if it`ll work

                    Comment

                    • johnsmith
                      Junior Member
                      • Nov 2019
                      • 12

                      #12
                      Originally posted by Tek Chand
                      johnsmith, Thank you for your response. I also tried but no success. I am facing issue because i am using zabbix version 4.0.7 and mostly configuration are tested over zabbix 3+ or zabbix 4.2. If you got success please help me also.

                      Thanks.
                      It works for me .

                      Use this link : https://github.com/zabbix/zabbix/tre.../db/postgresql

                      also : https://www.postgresql.org/docs/11/libpq-pgpass.html

                      Comment

                      • Tek Chand
                        Member
                        • Mar 2019
                        • 57

                        #13
                        johnsmith, I have tried these docs before posting here...but i am using zabbix version 4.0.7 in production and its for 4.2 so getting compatibility issue. Even i have tried zabbix-template-converter tool but its also showing unsupported version. May be it downgrade from 4.x to 3.x but not over same version.

                        Can you please test it at your end in testing lab and can help me if possible. Its last requirement in my project.

                        Any help will be appriciated.

                        Thanks.

                        Comment

                        • Tek Chand
                          Member
                          • Mar 2019
                          • 57

                          #14
                          johnsmith, Can you please test it over zabbix version 4.0.7 and help me if possible? I have tried but no success.

                          Its become road block in my project. Any help will be appreciated.

                          Thanks.

                          Comment

                          • tech.rss
                            Junior Member
                            • Oct 2019
                            • 10

                            #15
                            Tek Chand You can try alter way for any service check.

                            1. Using trapper
                            2. Get status from linux command
                            3. Send status using item key script trapper command
                            4. Run this script every minutes from cronjob
                            5. Create trigger using str exception
                            6. So when status fail then get mail.

                            Use this guide. https://www.zabbix.com/documentation...mtypes/trapper

                            Thanks.

                            Comment

                            Working...