diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:34:54 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:34:54 +0000 |
commit | 0915b3ef56dfac3113cce55a59a5765dc94976be (patch) | |
tree | a8fea11d50b4f083e1bf0f90025ece7f0824784a /lib/icinga/hostgroup.hpp | |
parent | Initial commit. (diff) | |
download | icinga2-0915b3ef56dfac3113cce55a59a5765dc94976be.tar.xz icinga2-0915b3ef56dfac3113cce55a59a5765dc94976be.zip |
Adding upstream version 2.13.6.upstream/2.13.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/icinga/hostgroup.hpp')
-rw-r--r-- | lib/icinga/hostgroup.hpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/icinga/hostgroup.hpp b/lib/icinga/hostgroup.hpp new file mode 100644 index 0000000..3ad5d26 --- /dev/null +++ b/lib/icinga/hostgroup.hpp @@ -0,0 +1,43 @@ +/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */ + +#ifndef HOSTGROUP_H +#define HOSTGROUP_H + +#include "icinga/i2-icinga.hpp" +#include "icinga/hostgroup-ti.hpp" +#include "icinga/host.hpp" + +namespace icinga +{ + +class ConfigItem; + +/** + * An Icinga host group. + * + * @ingroup icinga + */ +class HostGroup final : public ObjectImpl<HostGroup> +{ +public: + DECLARE_OBJECT(HostGroup); + DECLARE_OBJECTNAME(HostGroup); + + std::set<Host::Ptr> GetMembers() const; + void AddMember(const Host::Ptr& host); + void RemoveMember(const Host::Ptr& host); + + bool ResolveGroupMembership(const Host::Ptr& host, bool add = true, int rstack = 0); + + static void EvaluateObjectRules(const Host::Ptr& host); + +private: + mutable std::mutex m_HostGroupMutex; + std::set<Host::Ptr> m_Members; + + static bool EvaluateObjectRule(const Host::Ptr& host, const intrusive_ptr<ConfigItem>& item); +}; + +} + +#endif /* HOSTGROUP_H */ |