]> granicus.if.org Git - icinga2/blob - lib/icinga/checkable.ti
Merge pull request #5964 from fedepires/fix/opentsdbwriter-host-tag-5963
[icinga2] / lib / icinga / checkable.ti
1 /******************************************************************************
2  * Icinga 2                                                                   *
3  * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/)  *
4  *                                                                            *
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.                     *
9  *                                                                            *
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.                               *
14  *                                                                            *
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  ******************************************************************************/
19
20 #include "icinga/icingaapplication.hpp"
21 #include "icinga/customvarobject.hpp"
22 #include "base/array.hpp"
23 #impl_include "icinga/checkcommand.hpp"
24 #impl_include "icinga/eventcommand.hpp"
25
26 library icinga;
27
28 namespace icinga
29 {
30
31 code {{{
32 /**
33  * The acknowledgement type of a service.
34  *
35  * @ingroup icinga
36  */
37 enum AcknowledgementType
38 {
39         AcknowledgementNone = 0,
40         AcknowledgementNormal = 1,
41         AcknowledgementSticky = 2
42 };
43 }}}
44
45 abstract class Checkable : CustomVarObject
46 {
47         [config, required, navigation] name(CheckCommand) check_command (CheckCommandRaw) {
48                 navigate {{{
49                         return CheckCommand::GetByName(GetCheckCommandRaw());
50                 }}}
51         };
52         [config] int max_check_attempts {
53                 default {{{ return 3; }}}
54         };
55         [config, navigation] name(TimePeriod) check_period (CheckPeriodRaw) {
56                 navigate {{{
57                         return TimePeriod::GetByName(GetCheckPeriodRaw());
58                 }}}
59         };
60         [config] Value check_timeout;
61         [config] double check_interval {
62                 default {{{ return 5 * 60; }}}
63         };
64         [config] double retry_interval {
65                 default {{{ return 60; }}}
66         };
67         [config, navigation] name(EventCommand) event_command (EventCommandRaw) {
68                 navigate {{{
69                         return EventCommand::GetByName(GetEventCommandRaw());
70                 }}}
71         };
72         [config] bool volatile;
73
74         [config] bool enable_active_checks {
75                 default {{{ return true; }}}
76         };
77         [config] bool enable_passive_checks {
78                 default {{{ return true; }}}
79         };
80         [config] bool enable_event_handler {
81                 default {{{ return true; }}}
82         };
83         [config] bool enable_notifications {
84                 default {{{ return true; }}}
85         };
86         [config] bool enable_flapping {
87                 default {{{ return false; }}}
88         };
89         [config] bool enable_perfdata {
90                 default {{{ return true; }}}
91         };
92
93         [config, deprecated] double flapping_threshold;
94
95         [config] double flapping_threshold_low {
96                 default {{{ return 25; }}}
97         };
98
99         [config] double flapping_threshold_high{
100                 default {{{ return 30; }}}
101         };
102
103         [config] String notes;
104         [config] String notes_url;
105         [config] String action_url;
106         [config] String icon_image;
107         [config] String icon_image_alt;
108
109         [state] Timestamp next_check;
110         [state] int check_attempt {
111                 default {{{ return 1; }}}
112         };
113         [state, enum, no_user_view, no_user_modify] ServiceState state_raw {
114                 default {{{ return ServiceUnknown; }}}
115         };
116         [state, enum] StateType state_type {
117                 default {{{ return StateTypeSoft; }}}
118         };
119         [state, enum, no_user_view, no_user_modify] ServiceState last_state_raw {
120                 default {{{ return ServiceUnknown; }}}
121         };
122         [state, enum, no_user_view, no_user_modify] ServiceState last_hard_state_raw {
123                 default {{{ return ServiceUnknown; }}}
124         };
125         [state, enum] StateType last_state_type {
126                 default {{{ return StateTypeSoft; }}}
127         };
128         [state] bool last_reachable {
129                 default {{{ return true; }}}
130         };
131         [state] CheckResult::Ptr last_check_result;
132         [state] Timestamp last_state_change {
133                 default {{{ return Application::GetStartTime(); }}}
134         };
135         [state] Timestamp last_hard_state_change {
136                 default {{{ return Application::GetStartTime(); }}}
137         };
138         [state] Timestamp last_state_unreachable;
139
140         [no_storage] int severity {
141                 get;
142         };
143
144         [state] bool force_next_check;
145         [state] int acknowledgement (AcknowledgementRaw) {
146                 default {{{ return AcknowledgementNone; }}}
147         };
148         [state] Timestamp acknowledgement_expiry;
149         [state] bool force_next_notification;
150         [no_storage] Timestamp last_check {
151                 get;
152         };
153         [no_storage] int downtime_depth {
154                 get;
155         };
156
157         [state] double flapping_current {
158                 default {{{ return 0; }}}
159         };
160         [state] Timestamp flapping_last_change;
161
162         [state, no_user_view, no_user_modify] int flapping_buffer;
163         [state, no_user_view, no_user_modify] int flapping_index;
164         [state, protected] bool flapping;
165
166         [config, navigation] name(Endpoint) command_endpoint (CommandEndpointRaw) {
167                 navigate {{{
168                         return Endpoint::GetByName(GetCommandEndpointRaw());
169                 }}}
170         };
171 };
172
173 }