]> granicus.if.org Git - icinga2/blob - lib/icinga/service.ti
Merge pull request #6974 from Icinga/feature/copyright-generic
[icinga2] / lib / icinga / service.ti
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #include "icinga/checkable.hpp"
4 #include "icinga/host.hpp"
5 #include "icinga/icingaapplication.hpp"
6 #include "icinga/customvarobject.hpp"
7 #impl_include "icinga/servicegroup.hpp"
8
9 library icinga;
10
11 namespace icinga
12 {
13
14 code {{{
15 class ServiceNameComposer : public NameComposer
16 {
17 public:
18         virtual String MakeName(const String& shortName, const Object::Ptr& context) const;
19         virtual Dictionary::Ptr ParseName(const String& name) const;
20 };
21 }}}
22
23 class Service : Checkable < ServiceNameComposer
24 {
25         load_after ApiListener;
26         load_after Endpoint;
27         load_after Host;
28         load_after Zone;
29
30         [config, no_user_modify, required] array(name(ServiceGroup)) groups {
31                 default {{{ return new Array(); }}}
32         };
33
34         [config] String display_name {
35                 get {{{
36                         if (m_DisplayName.IsEmpty())
37                                 return GetShortName();
38                         else
39                                 return m_DisplayName;
40                 }}}
41         };
42         [config, required] name(Host) host_name;
43         [no_storage, navigation] Host::Ptr host {
44                 get;
45                 navigate {{{
46                         return GetHost();
47                 }}}
48         };
49         [enum, no_storage] ServiceState "state" {
50                 get {{{
51                         return GetStateRaw();
52                 }}}
53         };
54         [enum, no_storage] ServiceState last_state {
55                 get {{{
56                         return GetLastStateRaw();
57                 }}}
58         };
59         [enum, no_storage] ServiceState last_hard_state {
60                 get {{{
61                         return GetLastHardStateRaw();
62                 }}}
63         };
64         [state] Timestamp last_state_ok (LastStateOK);
65         [state] Timestamp last_state_warning;
66         [state] Timestamp last_state_critical;
67         [state] Timestamp last_state_unknown;
68 };
69
70 }