Ad Widget

Collapse

Monitoring zabbix server itself

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • woisch
    Member
    • May 2009
    • 46

    #1

    Monitoring zabbix server itself

    Hi,

    sometimes i have a problem that the zabbix server seems to be running but do no monitoring job. If i restart the zabbix server all monitoring is good and mails send out.

    How can i check if zabbix server is running well? I want a mail for example every 4 hours....

    But if i configure a action for zabbix server agent this certainly didn`t work because zabbix server is than not running and send no mails....

    Hope you understand what i mean.

    Is there a solution / script for that?

    thanks and regards
    woisch
  • jlorier
    Junior Member
    • Jul 2009
    • 4

    #2
    Hi,

    i solved it by scheduling a shell script that checks the timestamp of the zabbix_server log file. If it is not modified in the last 10 minutes, then I assume there is something wrong:

    #!/bin/sh
    # check timestamp zabbix logfile, it should be modified in the past 10 minutes

    RESULT='find /tmp/zabbix_server.log -mmin -10'
    RESULT=$?

    # if RESULT = 0 -> OK
    # RESULT = 1 -> file not found

    if [ $RESULT != 0 ]; then
    /usr/local/bin/gnokii --sendsms xxxxxxxxxx "Zabbix $HOSTNAME not responding for 10 minutes"
    fi

    exit 0


    Regards, Johan

    Comment

    • woisch
      Member
      • May 2009
      • 46

      #3
      I`m not the linux guru. I`ve tested the shell script with sending email. This works fine if i use the code on the console.

      How can i setup the script now for checking every 10 minutes? I`ve stopped the zabbix-server and waiting for 10 minutes but i got no mail.

      Comment

      • jlorier
        Junior Member
        • Jul 2009
        • 4

        #4
        For scheduled checking, you should add the script to the cron:

        edit the cron: crontab -e

        then add a line like this:

        */5 * * * * /path-to-the-scripts/check_zabbix.sh


        Now every 5 minutes the check will be executed.

        Is the file on the given location /tmp/zabbix_server.log? Or do you have another log file location defined in the zabbix_server.conf?

        Comment

        • woisch
          Member
          • May 2009
          • 46

          #5
          Thanks for the answer.
          No, the location is another but i`ve changed it in the script to /var/log/zabbix-server/zabbix_server.log .

          The Problem is now as result i always got "0" if i try the command on the console:

          zab-serv01:/bin# RESULT='find /var/log/zabbix-server/zabbix_server.log -mmin 5'
          zab-serv01:/bin# RESULT=$?
          zab-serv01:/bin# echo $RESULT
          0
          zab-serv01:#

          If i look in the log file folder i saw that the last modified time is over 5 minutes for zabbix_server.log ?

          Where is my problem?

          Comment

          • jlorier
            Junior Member
            • Jul 2009
            • 4

            #6
            What is the output when you just execute the find command? Maybe it is just an permission issue.

            Comment

            • woisch
              Member
              • May 2009
              • 46

              #7
              zab-server01:/bin# find /var/log/zabbix-server/zabbix_server.log -mmin -5
              zab-server01:/bin#

              that`s it... what is the normal output?

              Comment

              • woisch
                Member
                • May 2009
                • 46

                #8
                If i try "+5" i got the following:

                zab-serv01:/bin# find /var/log/zabbix-server/zabbix_server.log -mmin +5
                /var/log/zabbix-server/zabbix_server.log
                zab-serv01:/bin#

                But as result still "0" ! Grmpf

                Comment

                Working...