Ad Widget

Collapse

Easy Installation But Complete MySQL Monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cheezus
    Member
    • Nov 2011
    • 35

    #16
    Originally posted by AndreyHammer
    Line 33 must be: $ZABBIX_HOSTNAME=$config{'Hostname'};
    In case anyone else, like myself missed this, line 33 is missing the semicolon at the end of the line

    Comment

    • cheezus
      Member
      • Nov 2011
      • 35

      #17
      Some notes on getting this up and running:

      - Install zabbix_sender
      yum install zabbix-sender -y
      (note I'm using Eric Gearhart's repo)

      - On my centos install I have both zabbix_agentd.conf and zabbix_agent.conf and the latter is the one in use in /etc/zabbix

      - Make sure Hostname=your.hostname.com line is in your zabbix_agent(d).conf (whichever is in use on your system). Zabbix needs to know which hostname to apply the data it receives.

      - In the mysql.pl file add the missing semi colon as noted in the posts above.

      - Add a user to mysql:
      CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'asdfasdfasdfasdfasfd';
      GRANT SELECT, SUPER, PROCESS ON *.* TO 'zabbix'@'localhost' WITH GRANT OPTION;

      - Put that user/pass into the top of your mysql.pl file

      - After uploading your mysql.pl file chmod 755 for permissions to execute

      - On centos we have the following paths:
      /usr/sbin/mysql.pl
      /usr/bin/zabbix_sender

      So the call is::
      /usr/sbin/mysql.pl | /usr/bin/zabbix_sender -z 10.10.1.35 -c /etc/zabbix/zabbix_agent.conf -i -

      - Add the line to your zabbix_agent.conf (or zabbix_agentd.conf) at the end like this:
      UserParameter=custom.mysql.activate,/usr/sbin/mysql.pl | /usr/bin/zabbix_sender -z 10.10.1.35 -c /etc/zabbix/zabbix_agent.conf -i -

      - And then of course import the template and assign it to your host

      - in the call replace zabbixserver from the example, or 10.10.1.35 in my example, to your zabbix server location
      Last edited by cheezus; 08-01-2012, 08:32.

      Comment

      • cheezus
        Member
        • Nov 2011
        • 35

        #18
        Hmm.... looks like some of the items are failing when sending to the server:

        Info from server: "Processed 52 Failed 59 Total 111 Seconds spent 0.001731"
        sent: 111; skipped: 1; total: 112

        EDIT: re-reading the first post of the author he does say he cut out a lot of unnecessary items so this would seem to be correct behavior.
        Last edited by cheezus; 08-01-2012, 04:02.

        Comment

        • cheezus
          Member
          • Nov 2011
          • 35

          #19
          Update: The UserParameter in zabbix conf file method DOES NOT WORK. You can only send 1 parameter back for each UserParameter. We're using this with a cron instead.

          Comment

          • LukeRobertsNL
            Junior Member
            • Aug 2012
            • 3

            #20
            Guys... THANKS!

            I got this running from a cron job (every minute) on a dedicated MySQL server.

            Comment

            • globe
              Member
              • Apr 2006
              • 40

              #21
              i've added a new item to the template in order to process the mysql.pl as UserParameter from your zabbix_agent.conf - now it works

              Comment

              • Poul
                Junior Member
                • Apr 2014
                • 1

                #22
                Originally posted by globe
                i've added a new item to the template in order to process the mysql.pl as UserParameter from your zabbix_agent.conf - now it works
                This a old but still interesting post, would you remember what you've added?

                [edit]

                I figured it out with a little help from the IRC Chat.

                You create a new Item in your template to trigger the script every time you want to refresh the data.

                Type: Zabbix agent
                Key: "custom.mysql.activate"
                Type of information: Text
                Update interval (in sec): 1


                Then it's up to you how often you want to receive new fresh data.
                As I was debugging a system I set mine to pool every second.

                Important to set the Type of information to text. As you'll also receive the output result once the script finishes sending the data with zabbix_sender.

                A reminder that you will receive about 58 errors as the template was cleaned up before. Still the script "scrapes" for 110 items. While you only look at about 52. To get see everything you'd need to use the old template or setup all new items that are missing.
                Last edited by Poul; 05-05-2014, 17:36. Reason: Adding the answer.

                Comment

                • madrose
                  Junior Member
                  • Apr 2014
                  • 2

                  #23
                  Trying to use the template but sending fail with error:
                  Code:
                  sed: 1: "zabbix_variables.tmp": invalid command code z
                  sed: 1: "zabbix_status.tmp": invalid command code z
                  zabbix_sender [4060]: Warning: Key value required
                  Anyone can help on this please?

                  Comment

                  • sepa
                    Junior Member
                    • Nov 2014
                    • 1

                    #24
                    Great solution, thank you.
                    But why do you use: (x=0/y=0)>z in triggers? This is not working anymore. Also, this will cause division by zero. Valid way is:


                    Have to fix triggers and chosen some other counters, redone graphs. If somebody interested, results can be downloaded here:
                    There are a lot of examples how to monitor MySQL internal by zabbix-agent, like: http://wiki.enchtex.info/howto/zabbix/advanced_mysql_monitoring https://www.zabbix.com/wiki/doku.php?id=howto/monitor/db/mysql/extensive_mysql_monitoring_including_replication https://www.zabbix.com/forum/showthread.php?t=20488 but you know - the main issue is NIH ;) Those solutions are too heavy and use dependencies like php. Also, mysql SHOW GLOBAL STATUS provides with hundreds of values, and its hard to select ~50 of most valuable ones. Last link is the best solution found, I’ve updated it a little: Fast and light - only one bash file Zabbix traps are used to send data in one chunk, lowering system load and bandwidth 45 items, 13 triggers, 11 graphs Installation:

                    Comment

                    Working...