Let's say I have a nagios client. It has a scheduled downtime from 8am Monday through 8am Tuesday, and the machine is turned off for the entire duration.

There is a service check it performs once per day

check_interval      1440

Let's say the check happens to be scheduled for 8pm. So at 8pm Monday, the check happens, and it fails, and nagios does nothing because scheduled downtime.

Tuesday at 8am. The machine comes back on. But that one service will remain in the CRITICAL state until 8pm when the next scheduled check happens.

Is there some way that I can tell nagios "Maintain the check interval 1440; but, if you see the machine go down and come back up, then force a re-check regardless of the interval" ?


I got the answer from another forum.

I attached an event handler (TIL) to my host object:

define host{
    use     linux-server    ; Inherit default values from a template
    host_name   volvo      ; The name we're giving to this host
    alias       volvo  ; A longer name associated with the host
    event_handler       host_state_change

Associated my new event_handler name to a shell script

define command{
        command_name    host_state_change
        command_line    $USER1$/eventhandlers/hostup.sh $HOSTNAME$ $HOSTSTATE$

And created a script that checks what the new state is (that is, it changed from DOWN to UP, so I'm looking for UP) and forces a service check through the command file

    printf "[%lu] SCHEDULE_FORCED_SVC_CHECK;$hostname;serial_number;$NOW\n" $NOW > $COMMANDFILE

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.