nagios -- re-check service after "down" machine comes "up"

0

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" ?

hymie

Posted 2016-07-21T12:13:49.387

Reputation: 1 011

Answers

0

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

hymie

Posted 2016-07-21T12:13:49.387

Reputation: 1 011