GET 24/7 LIVE HELP NOW

Announcement

Announcement Module
Collapse
No announcement yet.

Zabbix support added to Percona Monitoring Plugins 1.1

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Zabbix support added to Percona Monitoring Plugins 1.1

    Percona Monitoring Plugins version 1.1 was released December 18. The components are designed to integrate seamlessly with widely deployed solutions such as Nagios, Cacti and Zabbix, and are delivered in the form of templates, plugins, and scripts.
    In this release we have added MySQL template for Zabbix 2.0.x adopted from the existing Cacti one.
    Is this an emergency? Get immediate assistance from Percona Support 24/7. Click here.

  • #2
    Hi.
    Thanks for supporting Zabbix now! But...
    Your php script doesn't work with mysql sockets which are different from default. I've added support for mysql sockets in this way:

    Code:
    [root@db scripts]# diff ss_get_mysql_stats.php ss_get_mysql_stats.php.orig
    32d31
    < $mysql_socket = '/path/to/your/mysql.sock';
    237c236
    < global $debug, $mysql_user, $mysql_pass, $mysql_socket, $cache_dir, $poll_time, $chk_options,
    ---
    > global $debug, $mysql_user, $mysql_pass, $cache_dir, $poll_time, $chk_options,
    243d241
    < $socket = isset($options['socket']) ? $options['socket'] : $mysql_socket;
    311c309
    < $conn = mysqli_connect($host, $user, $pass, NULL, $port, $socket);
    ---
    > $conn = mysqli_connect($host, $user, $pass, NULL, $port);
    Also I would like to see more detailed system requirements, for example recomended PHP version and required modules (there's nothing about MySQLi e.g.).
    Thank you!

    Comment


    • #3
      alexfear, if you set mysqli.default_socket in php.ini globally to match your socket path and use localhost as a host you won't need to do any changes to the script. That's the proper way I think. Moreover, you would be able to use any PHP scripts with mysql socket when connecting to localhost on the server.

      http://www.percona.com/doc/percona-m...m-requirements says
      • Zabbix agent, php, php-mysql packages on monitored node.
      Theoretically, any PHP 5.x version should work.

      Comment


      • #4
        weber, yes you're right, I only proposed solution for the script separately.
        Thanks for the answer.

        Comment


        • #5
          Hello!
          Thanks about zabbix support!
          I try to use your plugin, but I have some problems with replication monitoring.
          On monitored node mysql slave is running:
          Code:
          root@dbs-myserver-v:/etc $ zabbix_agentd -p | grep slave
          MySQL.slave-stopped                           [t|0]
          MySQL.slave-running                           [t|0]
          MySQL.slave-lag                               [t|0]
          MySQL.running-slave                           [t|1]
          
          root@drs-myserver-v:/var/lib/zabbix/percona/scripts $ ./get_mysql_stats_wrapper.sh running-slave
          1
          But when I try to check this from zabbix server I got next message:
          Code:
          root@zabbix-db:/etc# zabbix_get -s dbs-myserver-v -k MySQL.running-slave
          0
          So I recive a lot of data, but don't have slave monitoring.

          Can you help me with this issue?

          Comment


          • #6
            Originally posted by Pavel_Z View Post
            Hello!
            Code:
            root@drs-myserver-v:/var/lib/zabbix/percona/scripts $ ./get_mysql_stats_wrapper.sh running-slave
            Hi,

            I'm facing the same problem. You are running above command as root, but zabbix operates as a different user, therefore uses different credentials (does not read /root/.my.cnf if you've followed percona template installation instructions on the website) and fails fetching slave status. Please check zabbix agent log to confirm:
            Code:
            ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: NO)
            Solution? I have not found a "clean" solution yet (not a systems guru), but you need to set correct mysql credentials to zabbix user.

            Comment


            • #7
              justast, good point.

              The solution is to copy /root/.my.cnf to zabbix user homedir, e.g. ~zabbix/
              Last edited by weber; 02-08-2014, 10:00 AM.

              Comment


              • #8
                Then to test, you can run:
                sudo -u zabbix -H /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh running-slave

                Comment


                • #9
                  Hi,

                  Strange, but it's not working for me. On debian, the zabbix homedir is not created if you only install the agent from de zabbix.com repository. I have created it manualy, I've created the .my.cnf there (and in the /root dir) but still access denied for the zabbix user:

                  #ls -la ~zabbix
                  total 12K
                  drwxr-xr-x 2 zabbix root 4.0K Mar 21 17:30 .
                  drwxr-xr-x 19 root root 4.0K Mar 22 06:25 ..
                  -rw------- 1 zabbix root 333 Mar 21 17:30 .my.cnf

                  #ls -la /root/.my.cnf
                  -rw------- 1 zabbix root 333 Mar 22 12:32 /root/.my.cnf

                  #cat ~zabbix/.my.cnf
                  # Automatically generated for Debian scripts. DO NOT TOUCH!
                  [client]
                  host = localhost
                  user = XXXXXX
                  password = XXXXXXXXXX
                  socket = /var/run/mysqld/mysqld.sock

                  but still:
                  ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: NO)

                  Comment


                  • #10
                    Thanks about zabbix support!

                    Comment


                    • #11
                      Hey folks,

                      I was having the same issue with the MySQL.running_slave under Ubuntu, where it worked locally on the agent server as the "zabbix" user but not when called from the Zabbix server. Looking at "userparameter_mysql.conf" included in the Zabbix install, I modified the "/etc/zabbix/zabbix_agentd.d/userparameter_percona_mysql.conf" file to include HOME from this item:

                      UserParameter=MySQL.running-slave,HOME=/var/lib/zabbix /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh running-slave

                      Now zabbix_get returns the correct slave status and the Zabbix server also picked up the correct value.

                      Comment


                      • #12
                        bronick, please feel free to post the bug report if you can figure out the exact reason why it may not work. May be Ubuntu has the different home dir for zabbix user and it somehow affects the script.

                        Comment


                        • #13
                          Dear, find in google Percona Monitoring Plugins for Zabbix and am going through the same problem connecting to the database. When running the command

                          sudo -u root -H /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh running-slave 0
                          I get the following return

                          ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO)
                          0

                          Can someone help me?

                          Comment


                          • #14
                            Ricardo, are you getting the same issue like described https://bugs.launchpad.net/percona-m...s/+bug/1310723 ?

                            Comment


                            • #15
                              On Debian/Ubuntu, zabbix home dir is /var/run/zabbix instead of /var/lib/zabbix like it is on Redhat/Centos.
                              The documentation http://www.percona.com/doc/percona-m...n-instructions was corrected at some point of time in the past, to create ~zabbix/.my.cnf instead of previous /var/lib/zabbix/.my.cnf.
                              So if you place your .my.cnf under ~zabbix/ no matter what's the actual dir is, it should work.


                              Comment

                              Working...
                              X