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).
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.
HOSTEXECUTIONTIME | The host's check execution time.
HOSTOUTPUT | The last check's output.
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`.
LASTSERVICESTATECHANGE | The last state change's timestamp.
+ SERVICEDURATIONSEC | The time since the last state change.
SERVICELATENCY | The service's check latency.
SERVICEEXECUTIONTIME | The service's check execution time.
SERVICEOUTPUT | The last check's output.
} else if (macro == "LASTHOSTSTATECHANGE") {
*result = Convert::ToString((long)hc->GetLastStateChange());
return true;
+ } else if (macro == "HOSTDURATIONSEC") {
+ *result = Convert::ToString((long)(Utility::GetTime() - hc->GetLastStateChange()));
+ return true;
}
hccr = hc->GetLastCheckResult();
} else if (macro == "LASTSERVICESTATECHANGE") {
*result = Convert::ToString((long)GetLastStateChange());
return true;
+ } else if (macro == "SERVICEDURATIONSEC") {
+ *result = Convert::ToString((long)(Utility::GetTime() - GetLastStateChange()));
+ return true;
}
if (cr) {