mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 23:24:09 +02:00
Implement HOSTDURATIONSEC and SERVICEDURATIONSEC macros.
This commit is contained in:
parent
c3bcc2a474
commit
cbf82e1cb8
@ -96,6 +96,8 @@ hosts or services:
|
|||||||
LASTHOSTSTATE | The host's previous state. Can be one of `UNREACHABLE`, `UP` and `DOWN`.
|
LASTHOSTSTATE | The host's previous state. Can be one of `UNREACHABLE`, `UP` and `DOWN`.
|
||||||
LASTHOSTSTATEID | The host's previous state. Can be one of `0` (up), `1` (down) and `2` (unreachable).
|
LASTHOSTSTATEID | The host's previous state. Can be one of `0` (up), `1` (down) and `2` (unreachable).
|
||||||
LASTHOSTSTATETYPE | The host's previous state type. Can be one of `SOFT` and `HARD`.
|
LASTHOSTSTATETYPE | The host's previous state type. Can be one of `SOFT` and `HARD`.
|
||||||
|
LASTHOSTSTATECHANGE | The last state change's timestamp.
|
||||||
|
HOSTDURATIONSEC | The time since the last state change.
|
||||||
HOSTLATENCY | The host's check latency.
|
HOSTLATENCY | The host's check latency.
|
||||||
HOSTEXECUTIONTIME | The host's check execution time.
|
HOSTEXECUTIONTIME | The host's check execution time.
|
||||||
HOSTOUTPUT | The last check's output.
|
HOSTOUTPUT | The last check's output.
|
||||||
@ -123,6 +125,7 @@ services:
|
|||||||
LASTSERVICESTATEID | The service's previous state. Can be one of `0` (ok), `1` (warning), `2` (critical) and `3` (unknown).
|
LASTSERVICESTATEID | The service's previous state. Can be one of `0` (ok), `1` (warning), `2` (critical) and `3` (unknown).
|
||||||
LASTSERVICESTATETYPE | The service's previous state type. Can be one of `SOFT` and `HARD`.
|
LASTSERVICESTATETYPE | The service's previous state type. Can be one of `SOFT` and `HARD`.
|
||||||
LASTSERVICESTATECHANGE | The last state change's timestamp.
|
LASTSERVICESTATECHANGE | The last state change's timestamp.
|
||||||
|
SERVICEDURATIONSEC | The time since the last state change.
|
||||||
SERVICELATENCY | The service's check latency.
|
SERVICELATENCY | The service's check latency.
|
||||||
SERVICEEXECUTIONTIME | The service's check execution time.
|
SERVICEEXECUTIONTIME | The service's check execution time.
|
||||||
SERVICEOUTPUT | The last check's output.
|
SERVICEOUTPUT | The last check's output.
|
||||||
|
@ -609,6 +609,9 @@ bool Host::ResolveMacro(const String& macro, const Dictionary::Ptr&, String *res
|
|||||||
} else if (macro == "LASTHOSTSTATECHANGE") {
|
} else if (macro == "LASTHOSTSTATECHANGE") {
|
||||||
*result = Convert::ToString((long)hc->GetLastStateChange());
|
*result = Convert::ToString((long)hc->GetLastStateChange());
|
||||||
return true;
|
return true;
|
||||||
|
} else if (macro == "HOSTDURATIONSEC") {
|
||||||
|
*result = Convert::ToString((long)(Utility::GetTime() - hc->GetLastStateChange()));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
hccr = hc->GetLastCheckResult();
|
hccr = hc->GetLastCheckResult();
|
||||||
|
@ -424,6 +424,9 @@ bool Service::ResolveMacro(const String& macro, const Dictionary::Ptr& cr, Strin
|
|||||||
} else if (macro == "LASTSERVICESTATECHANGE") {
|
} else if (macro == "LASTSERVICESTATECHANGE") {
|
||||||
*result = Convert::ToString((long)GetLastStateChange());
|
*result = Convert::ToString((long)GetLastStateChange());
|
||||||
return true;
|
return true;
|
||||||
|
} else if (macro == "SERVICEDURATIONSEC") {
|
||||||
|
*result = Convert::ToString((long)(Utility::GetTime() - GetLastStateChange()));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cr) {
|
if (cr) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user