Skip to content

Commit

Permalink
Implement volatile services
Browse files Browse the repository at this point in the history
Fixes #3593
  • Loading branch information
gunnarbeutner committed Jun 13, 2013
1 parent e30d3c5 commit 4ab9d26
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/icinga/service-check.cpp
Expand Up @@ -402,6 +402,9 @@ void Service::ProcessCheckResult(const Dictionary::Ptr& cr)
if (old_state != GetState() && old_stateType == StateTypeHard && GetStateType() == StateTypeHard)
hardChange = true;

if (IsVolatile())
hardChange = true;

if (hardChange)
SetLastHardStateChange(now);

Expand Down
9 changes: 9 additions & 0 deletions lib/icinga/service.cpp
Expand Up @@ -52,6 +52,7 @@ Service::Service(const Dictionary::Ptr& serializedObject)
RegisterAttribute("checkers", Attribute_Config, &m_Checkers);

RegisterAttribute("event_command", Attribute_Config, &m_EventCommand);
RegisterAttribute("volatile", Attribute_Config, &m_Volatile);

RegisterAttribute("next_check", Attribute_Replicated, &m_NextCheck);
RegisterAttribute("current_checker", Attribute_Replicated, &m_CurrentChecker);
Expand Down Expand Up @@ -223,6 +224,14 @@ bool Service::IsReachable(void) const
return true;
}

bool Service::IsVolatile(void) const
{
if (m_Volatile.IsEmpty())
return false;

return m_Volatile;
}

AcknowledgementType Service::GetAcknowledgement(void)
{
ASSERT(OwnsLock());
Expand Down
3 changes: 3 additions & 0 deletions lib/icinga/service.h
Expand Up @@ -94,6 +94,8 @@ class I2_ICINGA_API Service : public DynamicObject, public MacroResolver
std::set<Host::Ptr> GetParentHosts(void) const;
std::set<Service::Ptr> GetParentServices(void) const;

bool IsVolatile(void) const;

bool IsReachable(void) const;

AcknowledgementType GetAcknowledgement(void);
Expand Down Expand Up @@ -261,6 +263,7 @@ class I2_ICINGA_API Service : public DynamicObject, public MacroResolver
Attribute<long> m_Acknowledgement;
Attribute<double> m_AcknowledgementExpiry;
Attribute<String> m_HostName;
Attribute<bool> m_Volatile;

/* Checks */
Attribute<String> m_CheckCommand;
Expand Down

0 comments on commit 4ab9d26

Please sign in to comment.