Ad Widget

Collapse

Zabbix xtraDB Cluster

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • slence
    Member
    • Nov 2014
    • 41

    #1

    Zabbix xtraDB Cluster

    Hi ,

    I need to monitor the size of the cluster and the wsrep_local_state_comment in 3 servers, like if synced or not (and the corresponding triggers).

    So In that server, i've add in /etc/zabbix/zabbix_agentd.conf.d/userparameter_mysql.conf:

    UserParameter=mysql.query,echo "show status like 'wsrep_cluster_size';"| mysql -N -uuser -ppassword

    from the zabbix_server i try:

    zabbix_get -s IP -k mysql.query , and returns right, like:

    wsrep_cluster_size 3

    everything seems ok from here.

    The problem is that in "latest data" i can't get nothing from this query.. so i don't get any data from the server?

    My idea is, when wsrep_cluster_size is not 3 , it returns me a trigger.

    More info:

    in "latest data" show me this in GRAY:

    MySQL Query
    mysql.query 3600 90 365 Zabbix agent (active)

    (no data returned)

    What i'm missing here?

    thanks.
    Last edited by slence; 14-10-2016, 15:55.
  • Colttt
    Senior Member
    Zabbix Certified Specialist
    • Mar 2009
    • 878

    #2
    hi, please look under Configuration->host-> YOUHOST -> Items
    and search for this special item, you will see a red cross on the right side for this item, hover the mouse over it and you get an answer why it fails
    Debian-User

    Sorry for my bad english

    Comment

    • slence
      Member
      • Nov 2014
      • 41

      #3
      That is the problem , the item is enabled without errors.

      zabbix_get -s IP -k mysql.query
      wsrep_cluster_size 3


      So no problems here....

      Comment

      • Colttt
        Senior Member
        Zabbix Certified Specialist
        • Mar 2009
        • 878

        #4
        ok which zabbix-version are you running?

        which "type of information" are you use? Numeric, Text etc..
        if the output is "wsrep_cluster_size 3" it must be text, if the output is only "3" it must be numeric
        Debian-User

        Sorry for my bad english

        Comment

        • slence
          Member
          • Nov 2014
          • 41

          #5
          I'm running Zabbix 3.0.5. version.


          the type of information is Text. Because the Output is "wsrep_cluster_size 3" , but when one node us not synced the output is ""wsrep_cluster_size 2" or 1. How can I put a trigger when that happen?
          Last edited by slence; 20-10-2016, 14:39.

          Comment

          • kloczek
            Senior Member
            • Jun 2006
            • 1771

            #6
            Originally posted by slence
            So In that server, i've add in /etc/zabbix/zabbix_agentd.conf.d/userparameter_mysql.conf:

            UserParameter=mysql.query,echo "show status like 'wsrep_cluster_size';"| mysql -N -uuser -ppassword

            from the zabbix_server i try:

            zabbix_get -s IP -k mysql.query , and returns right, like:

            wsrep_cluster_size 3
            Problem is that this string as it is above will be treated as numeric value and of course it is not numeric value but string + number.

            You can this change to something like this:

            UserParameter=mysql.status,mysql -sNe "select VARIABLE_VALUE from information_schema.GLOBAL_STATUS where VARIABLE_NAME=\'$1\';"

            Above is more generic and will allow you to read any status variables
            Try with this:

            zabbix_get -s IP -k mysql.status[wsrep_cluster_size]
            or on the host:

            zabbix_agentd -t mysql.status[wsrep_cluster_size]

            Because you are using zabbix_get it may mean that you are still using passive monitoring.
            If it is true you should switch to active one

            In attachment you can find my old MySQL 5.1 template which has macroed passing user and password and uses only such queries so after EnableRemoteComand=1 on agent you can controll mysql monitoring without touching anything on monitored host.
            Attached Files
            Last edited by kloczek; 20-10-2016, 18:17.
            http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
            https://kloczek.wordpress.com/
            zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
            My zabbix templates https://github.com/kloczek/zabbix-templates

            Comment

            • slence
              Member
              • Nov 2014
              • 41

              #7
              So I need to change the item type and add a user / password to mysql work with zabbix, right?

              I've done this and when I try it:

              mysql.status[wsrep_cluster_size] [m|ZBX_NOTSUPPORTED]


              Algo, I'm trying to export your template, but says: "Invalid tag "/zabbix_export/version": unsupported version number."

              Thanks.

              Comment

              • burn1024
                Member
                • Jun 2012
                • 52

                #8
                Code:
                mysql -sN -e "show status like 'wsrep_cluster_size'" | awk '{print $2}'
                username/password can be put in .my.cnf for zabbix user

                Comment

                • slence
                  Member
                  • Nov 2014
                  • 41

                  #9
                  Thanks burn1024

                  It's seems ok now!

                  Comment

                  • kloczek
                    Senior Member
                    • Jun 2006
                    • 1771

                    #10
                    Originally posted by burn1024
                    Code:
                    mysql -sN -e "show status like 'wsrep_cluster_size'" | awk '{print $2}'
                    username/password can be put in .my.cnf for zabbix user
                    With my a bit longer query you don't need to use awk which means that obtaining those data will be faster, with less context switches and lower memory overhead.
                    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
                    https://kloczek.wordpress.com/
                    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
                    My zabbix templates https://github.com/kloczek/zabbix-templates

                    Comment

                    Working...