How I can add "incident duration" into recovery notification

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
vitalyk
Posts: 3
Joined: Mon Aug 31, 2015 3:01 am

How I can add "incident duration" into recovery notification

Post by vitalyk »

How I can add "incident duration" into recovery notification?
Like "Incident duration was 22 minutes"; I mean - how to calculate incident duration using available macros?

TIA,
Vitaly
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: How I can add "incident duration" into recovery notifica

Post by jdalrymple »

There is nothing built in.

Without NDO this will be tricky. It is straightforward as long as your event doesn't span midnight when your log rotates. Just parse the log for the last OK state for your host/service, take the time now, subract/invert and there is your time. If that event happens overnight it would be a bugger though. I don't think anything in status.dat will help as "last_time_ok" should indicate the time now after a recovery.

It might be easier to throw an event handler out there that puts a tmp file in place with a timestamp if the service/host goes out of OK state.

Long story short, you will have to do some scripting. There is simply nothing built in to help you with this. To see a list of what is available for notifications look here:

https://assets.nagios.com/downloads/nag ... olist.html
Locked