Bug #3378: Do not trigger host hooks for each monitorization

This commit is contained in:
Carlos Martín committed 2014-12-12 12:53:14 +01:00
1 parent 0b0d58c50d
commit f1f22bc3c0
1 file changed
+17
+17
View File
@@ -77,6 +77,20 @@ void HostStateMapHook::remove_host (int id)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void merge_state(Host::HostState &state)
{
if (state == Host::MONITORING_ERROR)
{
state = Host::ERROR;
}
else if (state == Host::MONITORING_DISABLED)
{
state = Host::DISABLED;
}
}
// -----------------------------------------------------------------------------
void HostStateHook::do_hook(void *arg)
{
Host * host;
@@ -100,6 +114,9 @@ void HostStateHook::do_hook(void *arg)
cur_state = host->get_state();
merge_state(prev_state);
merge_state(cur_state);
if ( prev_state == cur_state ) //Still in the same state
{
return;