F #2356: Added more states to host hooks

(cherry picked from commit 7b4fd7442d)
This commit is contained in:
Ruben S. Montero committed 2018-08-29 11:38:29 +02:00
1 parent 3d36aca09b
commit b8ca4b3bfd
2 files changed
+39 -6

No files matched your search

+19 -6
View File
@@ -79,13 +79,26 @@ void HostStateMapHook::remove_host (int id)
void merge_state(Host::HostState &state)
{
if (state == Host::MONITORING_ERROR)
switch(state)
{
state = Host::ERROR;
}
else if (state == Host::MONITORING_DISABLED)
{
state = Host::DISABLED;
case Host::INIT:
case Host::MONITORED:
case Host::ERROR:
case Host::DISABLED:
case Host::OFFLINE:
break;
case Host::MONITORING_ERROR:
state = Host::ERROR;
break;
case Host::MONITORING_DISABLED:
state = Host::DISABLED;
break;
case Host::MONITORING_MONITORED:
state = Host::MONITORED;
break;
case Host::MONITORING_INIT:
state = Host::INIT;
break;
}
}
+20
View File
@@ -128,6 +128,26 @@ HostPool::HostPool(SqlDB* db,
add_hook(hook);
state_hook = true;
}
else if ( on == "OFFLINE" )
{
HostStateHook * hook;
hook = new HostStateHook(name, cmd, arg, remote, Host::OFFLINE);
add_hook(hook);
state_hook = true;
}
else if ( on == "ENABLE" )
{
HostStateHook * hook;
hook = new HostStateHook(name, cmd, arg, remote, Host::INIT);
add_hook(hook);
state_hook = true;
}
}