]> granicus.if.org Git - icinga2/blobdiff - lib/icinga/service.ti
Correct current_concurrent_checks to actually running checks
[icinga2] / lib / icinga / service.ti
index c59528ac60f0f007d90541fed8012eb8e1487810..bab1ebc8f23eb6013c7e8c35aaaa06128777928c 100644 (file)
@@ -1,26 +1,36 @@
-#include "icinga/host.h"
-#include "icinga/icingaapplication.h"
-#include "base/dynamicobject.h"
+/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
+
+#include "icinga/checkable.hpp"
+#include "icinga/host.hpp"
+#include "icinga/icingaapplication.hpp"
+#include "icinga/customvarobject.hpp"
+#impl_include "icinga/servicegroup.hpp"
+
+library icinga;
 
 namespace icinga
 {
 
 code {{{
-/**
- * The acknowledgement type of a service.
- *
- * @ingroup icinga
- */
-enum AcknowledgementType
+class ServiceNameComposer : public NameComposer
 {
-       AcknowledgementNone = 0,
-       AcknowledgementNormal = 1,
-       AcknowledgementSticky = 2
+public:
+       virtual String MakeName(const String& shortName, const Object::Ptr& context) const;
+       virtual Dictionary::Ptr ParseName(const String& name) const;
 };
 }}}
 
-class Service : DynamicObject
+class Service : Checkable < ServiceNameComposer
 {
+       load_after ApiListener;
+       load_after Endpoint;
+       load_after Host;
+       load_after Zone;
+
+       [config, no_user_modify, required] array(name(ServiceGroup)) groups {
+               default {{{ return new Array(); }}}
+       };
+
        [config] String display_name {
                get {{{
                        if (m_DisplayName.IsEmpty())
@@ -29,115 +39,32 @@ class Service : DynamicObject
                                return m_DisplayName;
                }}}
        };
-       [config] Dictionary::Ptr macros;
-       [config] Array::Ptr host_dependencies;
-       [config] Array::Ptr service_dependencies;
-       [config] Array::Ptr groups;
-       [config, protected] String check_command (CheckCommandRaw);
-       [config] int max_check_attempts {
-               default {{{ return 3; }}}
-       };
-       [config, protected] String check_period (CheckPeriodRaw);
-       [config] double check_interval (CheckIntervalRaw) {
-               default {{{ return 5 * 60; }}}
-       };
-       [config] double retry_interval (RetryIntervalRaw) {
-               default {{{ return 60; }}}
+       [config, required] name(Host) host_name;
+       [no_storage, navigation] Host::Ptr host {
+               get;
+               navigate {{{
+                       return GetHost();
+               }}}
        };
-       [config] String event_command (EventCommandRaw);
-       [config] bool volatile;
-       [config] String short_name {
+       [enum, no_storage] ServiceState "state" {
                get {{{
-                       if (m_ShortName.IsEmpty())
-                               return GetName();
-                       else
-                               return m_ShortName;
+                       return GetStateRaw();
                }}}
        };
-       [config] String host (HostRaw);
-       [config] double flapping_threshold {
-               default {{{ return 30; }}}
-       };
-       [config] Dictionary::Ptr notifications (NotificationDescriptions);
-       [config] bool enable_active_checks (EnableActiveChecksRaw) {
-               default {{{ return true; }}}
-       };
-       [config] bool enable_passive_checks (EnablePassiveChecksRaw) {
-               default {{{ return true; }}}
-       };
-       [config] bool enable_event_handler (EnableEventHandlerRaw) {
-               default {{{ return true; }}}
-       };
-       [config] bool enable_notifications (EnableNotificationsRaw) {
-               default {{{ return true; }}}
-       };
-       [config] bool enable_flapping (EnableFlappingRaw) {
-               default {{{ return true; }}}
-       };
-       [config] bool enable_perfdata (EnablePerfdataRaw) {
-               default {{{ return true; }}}
-       };
-
-       [state] double next_check (NextCheckRaw);
-       [state] int check_attempt {
-               default {{{ return 1; }}}
-       };
-       [state, enum] ServiceState "state" {
-               default {{{ return StateUnknown; }}}
-       };
-       [state, enum] StateType state_type {
-               default {{{ return StateTypeSoft; }}}
-       };
-       [state, enum] ServiceState last_state {
-               default {{{ return StateUnknown; }}}
-       };
-       [state, enum] ServiceState last_hard_state {
-               default {{{ return StateUnknown; }}}
-       };
-       [state, enum] StateType last_state_type {
-               default {{{ return StateTypeSoft; }}}
-       };
-       [state] bool last_reachable {
-               default {{{ return true; }}}
-       };
-       [state] CheckResult::Ptr last_check_result;
-       [state] double last_state_change {
-               default {{{ return Application::GetStartTime(); }}}
-       };
-       [state] double last_hard_state_change {
-               default {{{ return Application::GetStartTime(); }}}
-       };
-       [state] double last_state_ok (LastStateOK);
-       [state] double last_state_warning;
-       [state] double last_state_critical;
-       [state] double last_state_unknown;
-       [state] double last_state_unreachable;
-       [state] bool last_in_downtime;
-       [state] bool force_next_check (ForceNextCheckRaw);
-       [state] int acknowledgement (AcknowledgementRaw) {
-               default {{{ return AcknowledgementNone; }}}
-       };
-       [state] double acknowledgement_expiry;
-       [state] Dictionary::Ptr comments {
-               default {{{ return make_shared<Dictionary>(); }}}
+       [enum, no_storage] ServiceState last_state {
+               get {{{
+                       return GetLastStateRaw();
+               }}}
        };
-       [state] Dictionary::Ptr downtimes {
-               default {{{ return make_shared<Dictionary>(); }}}
+       [enum, no_storage] ServiceState last_hard_state {
+               get {{{
+                       return GetLastHardStateRaw();
+               }}}
        };
-       [state] bool force_next_notification (ForceNextNotificationRaw);
-       [state] int flapping_positive;
-       [state] int flapping_negative;
-       [state] double flapping_last_change;
-       [state] Value override_enable_notifications;
-       [state] Value override_enable_active_checks;
-       [state] Value override_enable_passive_checks;
-       [state] Value override_enable_flapping;
-       [state] Value override_enable_perfdata;
-       [state] Value override_check_interval;
-       [state] Value override_retry_interval;
-       [state] Value override_enable_event_handler;
-       [state] Value override_event_command;
-       [state] Value override_check_command;
+       [state] Timestamp last_state_ok (LastStateOK);
+       [state] Timestamp last_state_warning;
+       [state] Timestamp last_state_critical;
+       [state] Timestamp last_state_unknown;
 };
 
 }