1 /******************************************************************************
3 * Copyright (C) 2012-2014 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 ******************************************************************************/
23 #include "icinga/i2-icinga.hpp"
24 #include "icinga/service.thpp"
25 #include "icinga/macroresolver.hpp"
26 #include "icinga/host.hpp"
36 class I2_ICINGA_API Service : public ObjectImpl<Service>, public MacroResolver
39 DECLARE_OBJECT(Service);
40 DECLARE_OBJECTNAME(Service);
42 static Service::Ptr GetByNamePair(const String& hostName, const String& serviceName);
44 Host::Ptr GetHost(void) const;
46 virtual bool ResolveMacro(const String& macro, const CheckResult::Ptr& cr, String *result) const;
48 static ServiceState StateFromString(const String& state);
49 static String StateToString(ServiceState state);
51 static StateType StateTypeFromString(const String& state);
52 static String StateTypeToString(StateType state);
54 static void RegisterApplyRuleHandler(void);
57 virtual void OnConfigLoaded(void);
62 static void EvaluateApplyRuleOneInstance(const Host::Ptr& host, const String& name, const Dictionary::Ptr& locals, const ApplyRule& rule);
63 static bool EvaluateApplyRuleOne(const Host::Ptr& host, const ApplyRule& rule);
64 static void EvaluateApplyRule(const ApplyRule& rule);
65 static void EvaluateApplyRules(const std::vector<ApplyRule>& rules);
68 I2_ICINGA_API boost::tuple<Host::Ptr, Service::Ptr> GetHostService(const Checkable::Ptr& checkable);
72 #endif /* SERVICE_H */