1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
6 #include "icinga/i2-icinga.hpp"
7 #include "icinga/service-ti.hpp"
8 #include "icinga/macroresolver.hpp"
9 #include "icinga/host.hpp"
22 class Service final : public ObjectImpl<Service>, public MacroResolver
25 DECLARE_OBJECT(Service);
26 DECLARE_OBJECTNAME(Service);
28 static Service::Ptr GetByNamePair(const String& hostName, const String& serviceName);
30 Host::Ptr GetHost() const override;
31 int GetSeverity() const override;
32 bool GetHandled() const override;
34 bool ResolveMacro(const String& macro, const CheckResult::Ptr& cr, Value *result) const override;
36 bool IsStateOK(ServiceState state) const override;
37 void SaveLastState(ServiceState state, double timestamp) override;
39 static ServiceState StateFromString(const String& state);
40 static String StateToString(ServiceState state);
42 static StateType StateTypeFromString(const String& state);
43 static String StateTypeToString(StateType state);
45 static void EvaluateApplyRules(const Host::Ptr& host);
48 void OnAllConfigLoaded() override;
49 void CreateChildObjects(const Type::Ptr& childType) override;
54 static bool EvaluateApplyRuleInstance(const Host::Ptr& host, const String& name, ScriptFrame& frame, const ApplyRule& rule);
55 static bool EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule);
58 std::pair<Host::Ptr, Service::Ptr> GetHostService(const Checkable::Ptr& checkable);
62 #endif /* SERVICE_H */