Ad Widget

Collapse

Monitor a host with two IP possible

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jocelyn
    Junior Member
    • Feb 2009
    • 15

    #1

    Monitor a host with two IP possible

    Hi,
    I have hosts with two possible IPs with a particular rules between them.
    I've created a script.sh that exits 0 if OK and 1 if NOK.
    The script takes in parameter the IP of the host.
    I want to create an item that uses this script. I think it is with UserParameter but I can't make it work correctly...
    I defined it in zabbix_agentd.conf this way:
    UserParameter=test.ping,/path/ping-test.sh $1 //here, I don't know what I should put as a key in order that $1 is the IP of the host.

    ping-test.sh has 777 permissions.
    In Item configuration, I choose zabbix agent as type and {IPADDRESS} as Key.

    Could you help me please?
    Last edited by Jocelyn; 30-04-2009, 12:06.
  • Jocelyn
    Junior Member
    • Feb 2009
    • 15

    #2
    I have tried putting my script in /etc/zabbix/externalscripts and uncomment the line in zabbix_server.cfg.
    I build an item this way:
    Type : External Check
    Key : test.sh[]

    Doing this way, if I understand manual, it should execute for host name 'toto' :
    test.sh toto
    and return the value of exit of the script.

    Is it ok? I really need your help guys. Is it possible to get the IP of the host (without doing a sql request in the script)?
    Last edited by Jocelyn; 30-04-2009, 15:44.

    Comment

    • Calimero
      Senior Member
      • Nov 2006
      • 481

      #3
      Originally posted by Jocelyn
      Doing this way, if I understand manual, it should execute for host name 'toto' :
      test.sh toto
      and return the value of exit of the script.
      zabbix_server expects the value as:
      <value>\n
      on stdout.

      So the script should do something like:
      echo "value"

      First parameter is the DNS name or the IP address depending on how host is configured ("Connect to DNS name" or "Connect to IP address").

      Comment

      • Jocelyn
        Junior Member
        • Feb 2009
        • 15

        #4
        Ok, the script do this, the problem now is that it seems that zabbix server gives up if the script is too long to return the value. Is there something to change in config files?

        Comment

        • MarkusL
          Member
          • Nov 2008
          • 41

          #5
          as you allready posted, zabbix-timeout is a little bit tricky. We also dealed with these problems. Skript takes too long to return a value, timeout, nothing happens,...

          Our way is to run the script directly over a planned task or something and let it write a small log in errorcase. With zabbix we watch that tiny logfile. No problems with timeout any more!


          Kind regards,

          Markus.

          Comment

          • Jocelyn
            Junior Member
            • Feb 2009
            • 15

            #6
            Originally posted by MarkusL
            as you allready posted, zabbix-timeout is a little bit tricky. We also dealed with these problems. Skript takes too long to return a value, timeout, nothing happens,...

            Our way is to run the script directly over a planned task or something and let it write a small log in errorcase. With zabbix we watch that tiny logfile. No problems with timeout any more!


            Kind regards,

            Markus.
            Thanks, I'll check it out later

            Comment

            • Calimero
              Senior Member
              • Nov 2006
              • 481

              #7
              Originally posted by Jocelyn
              Ok, the script do this, the problem now is that it seems that zabbix server gives up if the script is too long to return the value. Is there something to change in config files?
              Mhhh I don't know whether the "Timeout" or "TrapperTimeout" parameters in zabbix_server.conf apply to external checks. On the other hand, the manual recommands only limited use of external checks.

              As Markus said you could run your script through cron and push values to zabbix_server with zabbix_sender.

              Comment

              • MarkusL
                Member
                • Nov 2008
                • 41

                #8
                well, both possibilities are in my eyes good one.

                1.) write a script that produces an errorlog, check this log with Agent-query
                2.) write a script that pushes the result (errorcode / exitcode) per zabbix_sender to Zabbix.

                We do a lot of these jobs in our own zabbix-environment:
                Monitoring Backup (Backup Exec, Acronis, robocopy, etc.), Monitoring of planned tasks, Virusscan-Definition-Updates, etc.

                ALL of these jobs are performed either with errorlog and query or with direct push via zabbix_sender.

                We had many problems, doing batchjobs directly with Zabbix Agent because of the timeout. In fact it is NOT the job of the AGENT to perform a script, the AGENT should only get values in the shortest possible time. So it is your job to give zabbix as fast results as possible :-)

                Comment

                Working...