Add host/service runtime macro downtime_depth

fixes #8195
This commit is contained in:
Michael Friedrich 2015-02-08 00:15:38 +01:00
parent 34b5a4d9b4
commit b23d58dccc
4 changed files with 10 additions and 0 deletions

View File

@ -1040,6 +1040,7 @@ Changes to service runtime macros
LASTSERVICESTATEID | service.last_state_id
LASTSERVICESTATETYPE | service.last_state_type
LASTSERVICESTATECHANGE | service.last_state_change
SERVICEDOWNTIME | service.downtime_depth
SERVICEDURATIONSEC | service.duration_sec
SERVICELATENCY | service.latency
SERVICEEXECUTIONTIME | service.execution_time
@ -1070,6 +1071,7 @@ Changes to host runtime macros
LASTHOSTSTATEID | host.last_state_id
LASTHOSTSTATETYPE | host.last_state_type
LASTHOSTSTATECHANGE | host.last_state_change
HOSTDOWNTIME | host.downtime_depth
HOSTDURATIONSEC | host.duration_sec
HOSTLATENCY | host.latency
HOSTEXECUTIONTIME | host.execution_time

View File

@ -2034,6 +2034,7 @@ hosts or services:
host.last_state_id | The host's previous state. Can be one of `0` (up), `1` (down) and `2` (unreachable).
host.last_state_type | The host's previous state type. Can be one of `SOFT` and `HARD`.
host.last_state_change | The last state change's timestamp.
host.downtime_depth | The number of active downtimes.
host.duration_sec | The time since the last state change.
host.latency | The host's check latency.
host.execution_time | The host's check execution time.
@ -2066,6 +2067,7 @@ services:
service.last_state_id | The service's previous state. Can be one of `0` (ok), `1` (warning), `2` (critical) and `3` (unknown).
service.last_state_type | The service's previous state type. Can be one of `SOFT` and `HARD`.
service.last_state_change | The last state change's timestamp.
service.downtime_depth | The number of active downtimes.
service.duration_sec | The time since the last state change.
service.latency | The service's check latency.
service.execution_time | The service's check execution time.

View File

@ -234,6 +234,9 @@ bool Host::ResolveMacro(const String& macro, const CheckResult::Ptr&, Value *res
} else if (macro == "last_state_change") {
*result = Convert::ToString((long)GetLastStateChange());
return true;
} else if (macro == "downtime_depth") {
*result = Convert::ToString((long)GetDowntimeDepth());
return true;
} else if (macro == "duration_sec") {
*result = Convert::ToString((long)(Utility::GetTime() - GetLastStateChange()));
return true;

View File

@ -157,6 +157,9 @@ bool Service::ResolveMacro(const String& macro, const CheckResult::Ptr& cr, Valu
} else if (macro == "last_state_change") {
*result = Convert::ToString((long)GetLastStateChange());
return true;
} else if (macro == "downtime_depth") {
*result = Convert::ToString((long)GetDowntimeDepth());
return true;
} else if (macro == "duration_sec") {
*result = Convert::ToString((long)(Utility::GetTime() - GetLastStateChange()));
return true;