1 /******************************************************************************
3 * Copyright (C) 2012-2018 Icinga Development Team (https://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 #include "icinga/checkable.hpp"
21 #include "icinga/host.hpp"
22 #include "icinga/icingaapplication.hpp"
23 #include "icinga/customvarobject.hpp"
24 #impl_include "icinga/servicegroup.hpp"
32 class ServiceNameComposer : public NameComposer
35 virtual String MakeName(const String& shortName, const Object::Ptr& context) const;
36 virtual Dictionary::Ptr ParseName(const String& name) const;
40 class Service : Checkable < ServiceNameComposer
42 load_after ApiListener;
47 [config, no_user_modify, required] array(name(ServiceGroup)) groups {
48 default {{{ return new Array(); }}}
51 [config] String display_name {
53 if (m_DisplayName.IsEmpty())
54 return GetShortName();
59 [config, required] name(Host) host_name;
60 [no_storage, navigation] Host::Ptr host {
66 [enum, no_storage] ServiceState "state" {
71 [enum, no_storage] ServiceState last_state {
73 return GetLastStateRaw();
76 [enum, no_storage] ServiceState last_hard_state {
78 return GetLastHardStateRaw();
81 [state] Timestamp last_state_ok (LastStateOK);
82 [state] Timestamp last_state_warning;
83 [state] Timestamp last_state_critical;
84 [state] Timestamp last_state_unknown;