Implement override_enable_flapping.

Refs #4746
This commit is contained in:
Gunnar Beutner 2013-11-26 11:34:33 +01:00
parent 04061adc01
commit d8c9d6a88a
4 changed files with 16 additions and 6 deletions

View File

@ -42,12 +42,15 @@ double Service::GetFlappingCurrent(void) const
bool Service::GetEnableFlapping(void) const
{
return GetEnableFlappingRaw();
if (!GetOverrideEnableFlapping().IsEmpty())
return GetOverrideEnableFlapping();
else
return GetEnableFlappingRaw();
}
void Service::SetEnableFlapping(bool enabled, const String& authority)
{
SetEnableFlappingRaw(enabled);
SetOverrideEnableFlapping(enabled);
OnFlappingChanged(GetSelf(), enabled ? FlappingEnabled : FlappingDisabled);
OnEnableFlappingChanged(GetSelf(), enabled, authority);

View File

@ -166,7 +166,7 @@ bool Service::GetEnableNotifications(void) const
if (!GetOverrideEnableNotifications().IsEmpty())
return GetOverrideEnableNotifications();
else
return GetEnableNotifications();
return GetEnableNotificationsRaw();
}
void Service::SetEnableNotifications(bool enabled, const String& authority)

View File

@ -273,6 +273,9 @@ int Service::GetModifiedAttributes(void) const
if (!GetOverrideEnablePassiveChecks().IsEmpty())
attrs |= ModAttrPassiveChecksEnabled;
if (!GetOverrideEnableFlapping().IsEmpty())
attrs |= ModAttrFlapDetectionEnabled;
if (!GetOverrideEnableEventHandler().IsEmpty())
attrs |= ModAttrEventHandlerEnabled;
@ -298,6 +301,9 @@ void Service::SetModifiedAttributes(int flags)
if ((flags & ModAttrPassiveChecksEnabled) == 0)
SetOverrideEnablePassiveChecks(Empty);
if ((flags & ModAttrFlapDetectionEnabled) == 0)
SetOverrideEnableFlapping(Empty);
if ((flags & ModAttrEventHandlerEnabled) == 0)
SetOverrideEnableEventHandler(Empty);

View File

@ -71,6 +71,9 @@ class Service : DynamicObject
[config] bool enable_notifications (EnableNotificationsRaw) {
default {{{ return true; }}}
};
[config] bool enable_flapping (EnableFlappingRaw) {
default {{{ return true; }}}
};
[state] double next_check (NextCheckRaw);
[state] int check_attempt {
@ -122,15 +125,13 @@ class Service : DynamicObject
[state] int flapping_positive;
[state] int flapping_negative;
[state] double flapping_last_change;
[state] bool enable_flapping (EnableFlappingRaw) {
default {{{ return true; }}}
};
[state] bool enable_perfdata {
default {{{ return true; }}}
};
[state] Value override_enable_notifications;
[state] Value override_enable_active_checks;
[state] Value override_enable_passive_checks;
[state] Value override_enable_flapping;
[state] Value override_check_interval;
[state] Value override_retry_interval;
[state] Value override_enable_event_handler;