Implement override_enable_perfdata.

Refs #4746
This commit is contained in:
Gunnar Beutner 2013-11-26 11:51:06 +01:00
parent d8c9d6a88a
commit ae3eaee1f4
3 changed files with 27 additions and 3 deletions

View File

@ -260,6 +260,19 @@ std::set<Service::Ptr> Service::GetParentServices(void) const
return parents;
}
bool Service::GetEnablePerfdata(void) const
{
if (!GetOverrideEnablePerfdata().IsEmpty())
return GetOverrideEnablePerfdata();
else
return GetEnablePerfdataRaw();
}
void Service::SetEnablePerfdata(bool enabled, const String& authority)
{
SetOverrideEnablePerfdata(enabled);
}
int Service::GetModifiedAttributes(void) const
{
int attrs = 0;
@ -279,6 +292,9 @@ int Service::GetModifiedAttributes(void) const
if (!GetOverrideEnableEventHandler().IsEmpty())
attrs |= ModAttrEventHandlerEnabled;
if (!GetOverrideEnablePerfdata().IsEmpty())
attrs |= ModAttrPerformanceDataEnabled;
if (!GetOverrideCheckInterval().IsEmpty())
attrs |= ModAttrNormalCheckInterval;
@ -307,6 +323,9 @@ void Service::SetModifiedAttributes(int flags)
if ((flags & ModAttrEventHandlerEnabled) == 0)
SetOverrideEnableEventHandler(Empty);
if ((flags & ModAttrPerformanceDataEnabled) == 0)
SetOverrideEnablePerfdata(Empty);
if ((flags & ModAttrNormalCheckInterval) == 0)
SetOverrideCheckInterval(Empty);

View File

@ -249,6 +249,10 @@ public:
bool IsFlapping(void) const;
void UpdateFlappingStatus(bool stateChange);
/* Performance data */
bool GetEnablePerfdata(void) const;
void SetEnablePerfdata(bool enabled, const String& authority = String());
protected:
virtual void Start(void);

View File

@ -74,6 +74,9 @@ class Service : DynamicObject
[config] bool enable_flapping (EnableFlappingRaw) {
default {{{ return true; }}}
};
[config] bool enable_perfdata (EnablePerfdataRaw) {
default {{{ return true; }}}
};
[state] double next_check (NextCheckRaw);
[state] int check_attempt {
@ -125,13 +128,11 @@ class Service : DynamicObject
[state] int flapping_positive;
[state] int flapping_negative;
[state] double flapping_last_change;
[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_enable_perfdata;
[state] Value override_check_interval;
[state] Value override_retry_interval;
[state] Value override_enable_event_handler;