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/compatutility.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/compatutility.hpp')
-rw-r--r-- | lib/icinga/compatutility.hpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/lib/icinga/compatutility.hpp b/lib/icinga/compatutility.hpp new file mode 100644 index 0000000..7b96fb3 --- /dev/null +++ b/lib/icinga/compatutility.hpp @@ -0,0 +1,56 @@ +/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */ + +#ifndef COMPATUTILITY_H +#define COMPATUTILITY_H + +#include "icinga/i2-icinga.hpp" +#include "icinga/host.hpp" +#include "icinga/command.hpp" + +namespace icinga +{ + +/** + * Compatibility utility functions. + * + * @ingroup icinga + */ +class CompatUtility +{ +public: + /* command */ + static String GetCommandLine(const Command::Ptr& command); + static String GetCommandName(const Command::Ptr& command); + + /* service */ + static String GetCheckableCommandArgs(const Checkable::Ptr& checkable); + + /* notification */ + static int GetCheckableNotificationsEnabled(const Checkable::Ptr& checkable); + static int GetCheckableNotificationLastNotification(const Checkable::Ptr& checkable); + static int GetCheckableNotificationNextNotification(const Checkable::Ptr& checkable); + static int GetCheckableNotificationNotificationNumber(const Checkable::Ptr& checkable); + static double GetCheckableNotificationNotificationInterval(const Checkable::Ptr& checkable); + static int GetCheckableNotificationTypeFilter(const Checkable::Ptr& checkable); + static int GetCheckableNotificationStateFilter(const Checkable::Ptr& checkable); + + static std::set<User::Ptr> GetCheckableNotificationUsers(const Checkable::Ptr& checkable); + static std::set<UserGroup::Ptr> GetCheckableNotificationUserGroups(const Checkable::Ptr& checkable); + + /* check result */ + static String GetCheckResultOutput(const CheckResult::Ptr& cr); + static String GetCheckResultLongOutput(const CheckResult::Ptr& cr); + + /* misc */ + static String EscapeString(const String& str); + static String UnEscapeString(const String& str); + +private: + CompatUtility(); + + static String GetCommandNamePrefix(const Command::Ptr& command); +}; + +} + +#endif /* COMPATUTILITY_H */ |