1 /******************************************************************************
3 * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/) *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License *
7 * as published by the Free Software Foundation; either version 2 *
8 * of the License, or (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software Foundation *
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ******************************************************************************/
20 #ifndef COMPATUTILITY_H
21 #define COMPATUTILITY_H
23 #include "icinga/i2-icinga.hpp"
24 #include "icinga/host.hpp"
25 #include "icinga/command.hpp"
31 * Compatibility utility functions.
39 static String GetCommandLine(const Command::Ptr& command);
40 static String GetCommandName(const Command::Ptr& command);
43 static int GetHostCurrentState(const Host::Ptr& host);
44 static String GetHostStateString(const Host::Ptr& host);
45 static int GetHostNotifyOnDown(const Host::Ptr& host);
46 static int GetHostNotifyOnUnreachable(const Host::Ptr& host);
49 static String GetCheckableCommandArgs(const Checkable::Ptr& checkable);
51 static int GetCheckableNoMoreNotifications(const Checkable::Ptr& checkable);
52 static int GetCheckableInNotificationPeriod(const Checkable::Ptr& checkable);
55 static int GetCheckableNotificationsEnabled(const Checkable::Ptr& checkable);
56 static int GetCheckableNotificationLastNotification(const Checkable::Ptr& checkable);
57 static int GetCheckableNotificationNextNotification(const Checkable::Ptr& checkable);
58 static int GetCheckableNotificationNotificationNumber(const Checkable::Ptr& checkable);
59 static double GetCheckableNotificationNotificationInterval(const Checkable::Ptr& checkable);
60 static int GetCheckableNotificationTypeFilter(const Checkable::Ptr& checkable);
61 static int GetCheckableNotificationStateFilter(const Checkable::Ptr& checkable);
62 static int GetCheckableNotifyOnWarning(const Checkable::Ptr& checkable);
63 static int GetCheckableNotifyOnCritical(const Checkable::Ptr& checkable);
64 static int GetCheckableNotifyOnUnknown(const Checkable::Ptr& checkable);
65 static int GetCheckableNotifyOnRecovery(const Checkable::Ptr& checkable);
66 static int GetCheckableNotifyOnFlapping(const Checkable::Ptr& checkable);
67 static int GetCheckableNotifyOnDowntime(const Checkable::Ptr& checkable);
69 static std::set<User::Ptr> GetCheckableNotificationUsers(const Checkable::Ptr& checkable);
70 static std::set<UserGroup::Ptr> GetCheckableNotificationUserGroups(const Checkable::Ptr& checkable);
73 static String GetCheckResultOutput(const CheckResult::Ptr& cr);
74 static String GetCheckResultLongOutput(const CheckResult::Ptr& cr);
77 static String EscapeString(const String& str);
78 static String UnEscapeString(const String& str);
83 static String GetCommandNamePrefix(const Command::Ptr& command);
88 #endif /* COMPATUTILITY_H */