passive service checks with 1 second interval

Jim Avery jim at jimavery.me.uk
Fri Aug 10 16:13:12 CEST 2007


On 10/08/07, Risto Vaarandi <risto.vaarandi at seb.ee> wrote:
> Is there a way to speed up the processing of CRITICAL service checks?
> I'd like to get a notification within the same second.
>
> br,
> risto

I think I would script something only to write to the command file
only if the state changes or once a minute to reassure Nagios that the
script is still working.  The logic would go something like this:

while :
do
  sleep 1
  if testserviceisok
  then
    # all is ok
    # if state has just changed from critical, send the OK to Nagios
    if [ $state = 'CRITICAL' ]
    then
      (write an OK result command to the command file)
    fi
    state=OK
  else
    # something is wrong
    # if state has just changed from ok, send the CRITICAL to Nagios
    if [ $state = 'OK' ]
    then
      (write a CRITICAL result command to the command file)
    fi
    state='CRITICAL'
  fi
  count=`expr $count + 1`
  if [ $count = 60 ]
  then
    count = 0
    (write the appropriate result command to the command file based on $state)
  fi
done



hth,

Jim

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list