Looking for the equivalent of $LASTSERVICESTATETYPE$
Looking for the equivalent of $LASTSERVICESTATETYPE$
I am in need of determining the $LASTSERVICESTATETYPE$ (Hard or Soft) and found that this Macro is not available. I was trying to find a way to determine this using the Macros that are available. So if current service state is OK, would like to find out if lastservicestate was not OK, and if not, was that lastservicestate a Hard or Soft state type?
Re: Looking for the equivalent of $LASTSERVICESTATETYPE$
There are actually a bunch of macros with last* information. The one in particular you are looking for is:
Some others of interest:
Check them out yourself at: http://nagios.sourceforge.net/docs/3_0/ ... icestateid
Code: Select all
$LASTSERVICESTATEID$ A number that corresponds to the last state of the service: 0=OK, 1=WARNING, 2=CRITICAL, 3=UNKNOWN.Code: Select all
$LASTSERVICECHECK$
This is a timestamp in time_t format (seconds since the UNIX epoch) indicating the time at which a check of the service was last performed.
$LASTSERVICESTATECHANGE$
This is a timestamp in time_t format (seconds since the UNIX epoch) indicating the time the service last changed state.
$LASTSERVICEOK$
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.
$LASTSERVICEWARNING$
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 a WARNING state.
$LASTSERVICEUNKNOWN$
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 UNKNOWN state.
$LASTSERVICECRITICAL$
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 a CRITICAL state.Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Looking for the equivalent of $LASTSERVICESTATETYPE$
Correct, but none of those tell me what the $LASTSERVICESTATE$ "TYPE" is. I need to know if it was a Hard or Soft "TYPE". I apologise if I am missing something obvious here.
Re: Looking for the equivalent of $LASTSERVICESTATETYPE$
Dang, I missed that. I have yet to test these macros, but I would suspect that they are agnostic in relation to the type of the previous state. I will test tomorrow if I have time.
Worse case scenario, you could track the type yourself with a custom event handler, but I feel that this may be worthy of a feature request on http://tracker.nagios.org
Worse case scenario, you could track the type yourself with a custom event handler, but I feel that this may be worthy of a feature request on http://tracker.nagios.org
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.