mirror of https://github.com/Icinga/icinga2.git
Fix HOSTSTATE macro.
This commit is contained in:
parent
6d89c5201a
commit
6aa1682878
|
@ -611,7 +611,22 @@ bool Host::ResolveMacro(const String& macro, const Dictionary::Ptr&, String *res
|
|||
bool reachable = IsReachable();
|
||||
|
||||
if (macro == "HOSTSTATE") {
|
||||
*result = Convert::ToString(CalculateState(state, reachable));
|
||||
HostState hstate = CalculateState(state, reachable);
|
||||
|
||||
switch (hstate) {
|
||||
case HostUnreachable:
|
||||
*result = "UNREACHABLE";
|
||||
break;
|
||||
case HostUp:
|
||||
*result = "UP";
|
||||
break;
|
||||
case HostDown:
|
||||
*result = "DOWN";
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (macro == "HOSTSTATEID") {
|
||||
*result = Convert::ToString(state);
|
||||
|
|
Loading…
Reference in New Issue