1 /******************************************************************************
3 * Copyright (C) 2012-2013 Icinga Development Team (http://www.icinga.org/) *
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.h"
24 #include "icinga/service.h"
25 #include "icinga/checkcommand.h"
26 #include "base/dictionary.h"
27 #include "base/dynamicobject.h"
43 * Compatibility utility functions.
47 class I2_ICINGA_API CompatUtility
50 static Dictionary::Ptr GetHostConfigAttributes(const Host::Ptr& host);
52 static Dictionary::Ptr GetServiceStatusAttributes(const Service::Ptr& service, CompatObjectType type);
53 static Dictionary::Ptr GetServiceConfigAttributes(const Service::Ptr& service);
55 static Dictionary::Ptr GetCommandConfigAttributes(const Command::Ptr& command);
57 static Dictionary::Ptr GetCustomVariableConfig(const DynamicObject::Ptr& object);
59 static std::set<User::Ptr> GetServiceNotificationUsers(const Service::Ptr& service);
60 static std::set<UserGroup::Ptr> GetServiceNotificationUserGroups(const Service::Ptr& service);
62 static Dictionary::Ptr GetCheckResultOutput(const Dictionary::Ptr& cr);
63 static String GetCheckResultPerfdata(const Dictionary::Ptr& cr);
65 static Dictionary::Ptr ConvertTimestamp(double time);
67 static int MapNotificationReasonType(NotificationType type);
68 static int MapExternalCommandType(const String& name);
70 static String EscapeString(const String& str);
78 #endif /* COMPATUTILITY_H */