On Feb 3, 2010, at 4:51 PM, Chip Burke wrote:

> I have a request to “plain English”-ify my notifications. One item I have 
> been asked for is when the service state changes, to report the duration of 
> the previous service state.
>  
> Example: HTTP is now OK after 00:02:35 of down time.
>  
> Is there an easy way to do this? It seems Nagios doesn’t offer a Last State 
> Duration macro, so I am assuming this is going to be a matter of some sort of 
> custom scripting. Has anyone had experience with this sort of thing?

$LASTSERVICEOK$ has potential, depending on when it's updated. "This is a 
timestamp in time_t format (seconds since the UNIX epoch) indicating the time 
at which the service was last detected as being in an OK state."

so time_t(now) - $LASTSERVICEOK$ = number of seconds in non-OK state

I am _assuming_ that the macro is not updated until after the recovery 
notification is sent.

--
Marc
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Nagios-users mailing list
[email protected]
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

Reply via email to