mirror of https://github.com/Icinga/icinga2.git
parent
3c2dae1804
commit
01a0496988
|
@ -88,6 +88,18 @@ void Checkable::OnStateLoaded(void)
|
|||
}
|
||||
}
|
||||
|
||||
void Checkable::AddGroup(const String& name)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_CheckableMutex);
|
||||
|
||||
Array::Ptr groups = GetGroups();
|
||||
|
||||
if (!groups)
|
||||
groups = make_shared<Array>();
|
||||
|
||||
groups->Add(name);
|
||||
}
|
||||
|
||||
AcknowledgementType Checkable::GetAcknowledgement(void)
|
||||
{
|
||||
ASSERT(OwnsLock());
|
||||
|
|
|
@ -89,6 +89,8 @@ public:
|
|||
std::set<Checkable::Ptr> GetParents(void) const;
|
||||
std::set<Checkable::Ptr> GetChildren(void) const;
|
||||
|
||||
void AddGroup(const String& name);
|
||||
|
||||
//bool IsHostCheck(void) const;
|
||||
|
||||
bool IsReachable(DependencyType dt = DependencyState, shared_ptr<Dependency> *failedDependency = NULL, int rstack = 0) const;
|
||||
|
@ -270,6 +272,7 @@ protected:
|
|||
virtual void OnStateLoaded(void);
|
||||
|
||||
private:
|
||||
mutable boost::mutex m_CheckableMutex;
|
||||
bool m_CheckRunning;
|
||||
long m_SchedulingOffset;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "icinga/icingaapplication.h"
|
||||
#include "base/dynamicobject.h"
|
||||
#include "base/array.h"
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
@ -20,7 +21,9 @@ enum AcknowledgementType
|
|||
|
||||
abstract class Checkable : DynamicObject
|
||||
{
|
||||
[config] Array::Ptr groups;
|
||||
[config] Array::Ptr groups {
|
||||
default {{{ return make_shared<Array>(); }}}
|
||||
};
|
||||
[config, protected] String check_command (CheckCommandRaw);
|
||||
[config] int max_check_attempts (MaxCheckAttemptsRaw) {
|
||||
default {{{ return 3; }}}
|
||||
|
|
|
@ -14,7 +14,6 @@ class Host : Checkable
|
|||
return m_DisplayName;
|
||||
}}}
|
||||
};
|
||||
[config] Array::Ptr groups;
|
||||
|
||||
[config] String address;
|
||||
[config] String address6;
|
||||
|
|
|
@ -69,6 +69,18 @@ void User::Stop(void)
|
|||
}
|
||||
}
|
||||
|
||||
void User::AddGroup(const String& name)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_UserMutex);
|
||||
|
||||
Array::Ptr groups = GetGroups();
|
||||
|
||||
if (!groups)
|
||||
groups = make_shared<Array>();
|
||||
|
||||
groups->Add(name);
|
||||
}
|
||||
|
||||
TimePeriod::Ptr User::GetPeriod(void) const
|
||||
{
|
||||
return TimePeriod::GetByName(GetPeriodRaw());
|
||||
|
|
|
@ -40,6 +40,8 @@ public:
|
|||
DECLARE_PTR_TYPEDEFS(User);
|
||||
DECLARE_TYPENAME(User);
|
||||
|
||||
void AddGroup(const String& name);
|
||||
|
||||
/* Notifications */
|
||||
TimePeriod::Ptr GetPeriod(void) const;
|
||||
|
||||
|
@ -52,6 +54,8 @@ protected:
|
|||
virtual void Stop(void);
|
||||
|
||||
virtual void OnConfigLoaded(void);
|
||||
private:
|
||||
mutable boost::mutex m_UserMutex;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "base/dynamicobject.h"
|
||||
#include "base/array.h"
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
@ -13,7 +14,9 @@ class User : DynamicObject
|
|||
return m_DisplayName;
|
||||
}}}
|
||||
};
|
||||
[config] Array::Ptr groups;
|
||||
[config] Array::Ptr groups {
|
||||
default {{{ return make_shared<Array>(); }}}
|
||||
};
|
||||
[config] String period (PeriodRaw);
|
||||
[config] Array::Ptr types;
|
||||
int type_filter_real (TypeFilter);
|
||||
|
|
Loading…
Reference in New Issue