Ad Widget

Collapse

How add an external check to zabbix?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SebD
    Junior Member
    • Jul 2007
    • 24

    #1

    How add an external check to zabbix?

    Hello,

    I work with Zabbix 1.4.1 and I wrote an external check (I know Zabbix have his own apache check, but I d'like to do this by myself) :

    #!/bin/sh
    ################################################## ################
    # ce script retourne l'état du process apache
    ################################################## ################

    STATE_OK=0
    STATE_WARNING=1
    STATE_CRITICAL=2
    STATE_UNKNOWN=3
    STATE_DEPENDENT=4

    # récupération de l'état du process httpd apache
    # STATE = état de sortie du process en sortie du grep
    ps auxw | grep httpd | grep -v nagios >> /dev/null
    STATE=$?

    # Vérification de l'état du process
    if [ "$STATE" = "$STATE_OK" ]
    then
    date >> toto_apache
    echo "PROCESS APACHE EST OK" >> toto_apache
    echo "" >> toto_apache
    echo "PROCESS APACHE EST OK"
    exit 0
    else
    date >> toto_apache
    echo "PROCESS APACHE NE FONCTIONNE PAS" >> toto_apache
    echo "PROCESS APACHE NE FONCTIONNE PAS"
    exit $STATE_CRITICAL
    fi

    Someone could tell me where I must save my script and how I have to install in Zabbix please? I couldn't understand how make the link between Zabbix and my script!

    Thanks!

    Sébastien
  • diegocito
    Junior Member
    • Jun 2007
    • 22

    #2
    I'm in the same case as you, I would like to write a check_service_dns plugin, but I don't know where to put it????

    Thanks

    Diegocito

    Comment

    • cordeiro
      Junior Member
      • Jul 2007
      • 10

      #3
      Hi Sebastien,

      1. create an /etc/zabbix/externalscripts directory with correct rights
      2. copy your script to this directory, suppose your script name is testhttpd.sh
      3. on zabbix web interface, create an item with type "External Check" and key is testhttpd.sh

      Note that if you have an agent on the server, an alternative solution is to create an userParameter

      Jean Pierre

      Comment

      • SebD
        Junior Member
        • Jul 2007
        • 24

        #4
        Hello Jean Pierre,

        I tried what you explained to me, but I've got "External check [check_apache.sh] is not supported "

        I've put the following rights : chmod 755 and chown zabbix to the externalscripts directory and the scripts inside.

        I've create an item with "external check" and "check_apache" in the key.

        Have you any idea where comes this problem from?

        I've also try my script with UserParameter as you said and it works!

        Thanks

        Sébastien

        Comment

        • cordeiro
          Junior Member
          • Jul 2007
          • 10

          #5
          What version of Zabbix ?

          Hi Sebastien,

          What version of Zabbix do you use ? I use 1.4 (from rBuilder iso).

          Note that the script must be on the Zabbix server, not on the agent !

          Jean Pierre

          Comment

          • SebD
            Junior Member
            • Jul 2007
            • 24

            #6
            I'm using 1.4.1 version from source.
            I've put the script on the Zabbix server.

            The externalscripts directory doesn't be declared anywhere in the config of zabbix_server?

            Sébastien

            Comment

            • cordeiro
              Junior Member
              • Jul 2007
              • 10

              #7
              ExternalScripts

              Hi,

              Use the parameter ExternalScripts=yourpath on your zabbix_server.conf
              Make sure your file has read and execute access for all users ...
              See zabbix_server.log to view the error message.

              Jean Pierre

              Comment

              • SebD
                Junior Member
                • Jul 2007
                • 24

                #8
                Jean Pierre,

                In first, thanks for your help!

                So I've the following rights to /etc/zabbix (where I put /etc/zabbix/externalscripts) :

                chown -R zabbix.zabbix /etc/zabbix/
                chmod -R 777 /etc/zabbix/

                I've added in zabbix_server.conf :
                ExternalScripts=/etc/zabbix/externalscripts/

                I've restarted zabbix_server and put active my external check, but I always have "External check [checkApache.sh] is not supported ".

                In the zabbix_server.log, I can only find for this problem :
                "29439:20070725:114214 Parameter [checkApache.sh] is not supported by agent on host [ServerName] Old status [0]"

                Sébastien

                Comment

                • SebD
                  Junior Member
                  • Jul 2007
                  • 24

                  #9
                  Hello!

                  Is there anybody who have an idea where's could come from my problem?

                  There's nobody else who have tried the external check?

                  Sébastien

                  Comment

                  • cadbury
                    Member
                    • Apr 2005
                    • 77

                    #10
                    same problem here,

                    i did what is on the manual, and what is here, but same error than you.

                    going to use the good old agent with userparameter on my zabbix server ...

                    Comment

                    • lance242
                      Junior Member
                      • Jul 2007
                      • 1

                      #11
                      I'm also seeing this problem ...

                      Nothing more to add to the thread other than another person seeing this issue (be it doc or a real issue).

                      Comment

                      • Alexei
                        Founder, CEO
                        Zabbix Certified Trainer
                        Zabbix Certified SpecialistZabbix Certified Professional
                        • Sep 2004
                        • 5654

                        #12
                        External scripts MUST have [] ( or (), see my note below). For example:

                        check_apache.sh[] - no parameters (apart of hostname) are passed to the script

                        check_apache.sh[params] or check_apache.sh["params"] - hostname and parameters "params" are passed to the script

                        This syntax is for pre 1.4.2 and later releases only! Earlier releases accept () instead of []. Sorry for the change of syntax within one major release...
                        Alexei Vladishev
                        Creator of Zabbix, Product manager
                        New York | Tokyo | Riga
                        My Twitter

                        Comment

                        • mcarbonneaux
                          Member
                          • Jul 2007
                          • 31

                          #13
                          it's a bug in 1.4.2... the ui check for "()" and the zabbix server check for "[]"...

                          see on this thread...
                          Last edited by mcarbonneaux; 28-07-2007, 15:38.

                          Comment

                          • Alexei
                            Founder, CEO
                            Zabbix Certified Trainer
                            Zabbix Certified SpecialistZabbix Certified Professional
                            • Sep 2004
                            • 5654

                            #14
                            Originally posted by mcarbonneaux
                            it's a bug in 1.4.2... the ui check for "()" and the zabbix server check for "[]"...

                            see on this thread...
                            http://www.zabbix.com/forum/showthre...4266#post24266
                            This is not quote true. ZABBIX 1.4.1 processes () just fine, the only problem is that () are not accepted by the front-end.
                            Alexei Vladishev
                            Creator of Zabbix, Product manager
                            New York | Tokyo | Riga
                            My Twitter

                            Comment

                            • SebD
                              Junior Member
                              • Jul 2007
                              • 24

                              #15
                              Hello!

                              Ok thanks Alexei for your soluce!
                              I've put [] and it's running except for a distant host :
                              The externals checks are on the computer where is Zabbix Server.
                              When the Zabbix call an externel check for a distant host, it ran it on the same computer as Zabbix and not on the host.
                              I've tried to add to my external check "rsh -l" before the command, but it doesn't want to run too!

                              Sébastien

                              Comment

                              Working...