Macro
Aaron Devey
adevey at omniture.com
Sun Oct 28 20:54:33 CET 2007
I don't see $LASTSERVICESTATE$ either, but it would be a handy addition. :)
You should be able to pin this down (in most cases) by checking
$LASTSERVICEOK$, $LASTSERVICEWARNING$, $LASTSERVICEUNKNOWN$, and
$LASTSERVICECRITICAL$. Whichever one is greatest should be the last
service state. You could also try comparing them to
$LASTSERVICESTATECHANGE$.
Note that in some rare cases (and probably less-rare for volatile
services) the service state can change twice or more within a second.
In those cases, deciphering the last service state using this method may
not work. However, events like this should not happen very often.
-Aaron
Haydn Solomon wrote:
>
>
> On 10/28/07, *Andreas Ericsson* <ae at op5.se <mailto:ae at op5.se>> wrote:
>
> Haydn Solomon wrote:
> > Hello list,
> >
> > I was thinking of running different event handler scripts based
> on the state
> > transition in nagios ie. for example run a different script when
> state
> > changes from critical to OK as opposed to WARNING to OK. I was
> therefore
> > looking for any macro that would give me the laststate of a service>
>
> $LASTSERVICESTATE$
>
>
>
> Thanks for your reply Andreas but I ran a test and that macro doesn't
> exist. I double checked the documentation and there are only macros
> for timestamps of last service states. What I would really like to use
> is the last service state either as string or integer id is fine.
>
> > but
> > could not find any in the list. I checked in both the 2.x and
> > 3.xdocumentation but didn't see anything. Did I miss it?
>
> Yup.
>
> --
> Andreas Ericsson andreas.ericsson at op5.se
> <mailto:andreas.ericsson at op5.se>
> OP5 AB www.op5.se <http://www.op5.se>
> Tel: +46 8-230225 Fax: +46 8-230231
>
> -------------------------------------------------------------------------
> 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/
> <http://get.splunk.com/>
> _______________________________________________
> Nagios-devel mailing list
> Nagios-devel at lists.sourceforge.net
> <mailto:Nagios-devel at lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/nagios-devel
>
>
-------------------------------------------------------------------------
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/
More information about the Developers
mailing list