1 /******************************************************************************
3 * Copyright (C) 2012-2018 Icinga Development Team (https://www.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/icingaapplication.hpp"
21 #include "icinga/customvarobject.hpp"
22 #include "base/array.hpp"
23 #impl_include "icinga/checkcommand.hpp"
24 #impl_include "icinga/eventcommand.hpp"
33 * The acknowledgement type of a service.
37 enum AcknowledgementType
39 AcknowledgementNone = 0,
40 AcknowledgementNormal = 1,
41 AcknowledgementSticky = 2
45 abstract class Checkable : CustomVarObject
47 [config, required, navigation] name(CheckCommand) check_command (CheckCommandRaw) {
49 return CheckCommand::GetByName(GetCheckCommandRaw());
52 [config] int max_check_attempts {
53 default {{{ return 3; }}}
55 [config, navigation] name(TimePeriod) check_period (CheckPeriodRaw) {
57 return TimePeriod::GetByName(GetCheckPeriodRaw());
60 [config] Value check_timeout;
61 [config] double check_interval {
62 default {{{ return 5 * 60; }}}
64 [config] double retry_interval {
65 default {{{ return 60; }}}
67 [config, navigation] name(EventCommand) event_command (EventCommandRaw) {
69 return EventCommand::GetByName(GetEventCommandRaw());
72 [config] bool volatile;
74 [config] bool enable_active_checks {
75 default {{{ return true; }}}
77 [config] bool enable_passive_checks {
78 default {{{ return true; }}}
80 [config] bool enable_event_handler {
81 default {{{ return true; }}}
83 [config] bool enable_notifications {
84 default {{{ return true; }}}
86 [config] bool enable_flapping {
87 default {{{ return false; }}}
89 [config] bool enable_perfdata {
90 default {{{ return true; }}}
93 [config, deprecated] double flapping_threshold;
95 [config] double flapping_threshold_low {
96 default {{{ return 25; }}}
99 [config] double flapping_threshold_high{
100 default {{{ return 30; }}}
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;
109 [state] Timestamp next_check;
110 [state] int check_attempt {
111 default {{{ return 1; }}}
113 [state, enum, no_user_view, no_user_modify] ServiceState state_raw {
114 default {{{ return ServiceUnknown; }}}
116 [state, enum] StateType state_type {
117 default {{{ return StateTypeSoft; }}}
119 [state, enum, no_user_view, no_user_modify] ServiceState last_state_raw {
120 default {{{ return ServiceUnknown; }}}
122 [state, enum, no_user_view, no_user_modify] ServiceState last_hard_state_raw {
123 default {{{ return ServiceUnknown; }}}
125 [state, enum] StateType last_state_type {
126 default {{{ return StateTypeSoft; }}}
128 [state] bool last_reachable {
129 default {{{ return true; }}}
131 [state] CheckResult::Ptr last_check_result;
132 [state] Timestamp last_state_change {
133 default {{{ return Application::GetStartTime(); }}}
135 [state] Timestamp last_hard_state_change {
136 default {{{ return Application::GetStartTime(); }}}
138 [state] Timestamp last_state_unreachable;
140 [no_storage] int severity {
144 [state] bool force_next_check;
145 [state] int acknowledgement (AcknowledgementRaw) {
146 default {{{ return AcknowledgementNone; }}}
148 [state] Timestamp acknowledgement_expiry;
149 [state] bool force_next_notification;
150 [no_storage] Timestamp last_check {
153 [no_storage] int downtime_depth {
157 [state] double flapping_current {
158 default {{{ return 0; }}}
160 [state] Timestamp flapping_last_change;
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;
166 [config, navigation] name(Endpoint) command_endpoint (CommandEndpointRaw) {
168 return Endpoint::GetByName(GetCommandEndpointRaw());