MCPcopy Create free account
hub / github.com/Icinga/icinga2 / GetConfigFields

Method GetConfigFields

lib/db_ido/servicedbobject.cpp:35–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33{ }
34
35Dictionary::Ptr ServiceDbObject::GetConfigFields() const
36{
37 Service::Ptr service = static_pointer_cast<Service>(GetObject());
38 Host::Ptr host = service->GetHost();
39
40 unsigned long notificationStateFilter = CompatUtility::GetCheckableNotificationTypeFilter(service);
41 unsigned long notificationTypeFilter = CompatUtility::GetCheckableNotificationTypeFilter(service);
42
43 return new Dictionary({
44 { "host_object_id", host },
45 { "display_name", service->GetDisplayName() },
46 { "check_command_object_id", service->GetCheckCommand() },
47 { "eventhandler_command_object_id", service->GetEventCommand() },
48 { "check_timeperiod_object_id", service->GetCheckPeriod() },
49 { "check_interval", service->GetCheckInterval() / 60.0 },
50 { "retry_interval", service->GetRetryInterval() / 60.0 },
51 { "max_check_attempts", service->GetMaxCheckAttempts() },
52 { "is_volatile", service->GetVolatile() },
53 { "flap_detection_enabled", service->GetEnableFlapping() },
54 { "low_flap_threshold", service->GetFlappingThresholdLow() },
55 { "high_flap_threshold", service->GetFlappingThresholdLow() },
56 { "process_performance_data", service->GetEnablePerfdata() },
57 { "freshness_checks_enabled", 1 },
58 { "freshness_threshold", Convert::ToLong(service->GetCheckInterval()) },
59 { "event_handler_enabled", service->GetEnableEventHandler() },
60 { "passive_checks_enabled", service->GetEnablePassiveChecks() },
61 { "active_checks_enabled", service->GetEnableActiveChecks() },
62 { "notifications_enabled", service->GetEnableNotifications() },
63 { "notes", service->GetNotes() },
64 { "notes_url", service->GetNotesUrl() },
65 { "action_url", service->GetActionUrl() },
66 { "icon_image", service->GetIconImage() },
67 { "icon_image_alt", service->GetIconImageAlt() },
68 { "notification_interval", CompatUtility::GetCheckableNotificationNotificationInterval(service) },
69 { "notify_on_warning", (notificationStateFilter & ServiceWarning) ? 1 : 0 },
70 { "notify_on_unknown", (notificationStateFilter & ServiceUnknown) ? 1 : 0 },
71 { "notify_on_critical", (notificationStateFilter & ServiceCritical) ? 1 : 0 },
72 { "notify_on_recovery", (notificationTypeFilter & NotificationRecovery) ? 1 : 0 },
73 { "notify_on_flapping", (notificationTypeFilter & (NotificationFlappingStart | NotificationFlappingEnd)) ? 1 : 0 },
74 { "notify_on_downtime", (notificationTypeFilter & (NotificationDowntimeStart | NotificationDowntimeEnd | NotificationDowntimeRemoved)) ? 1 : 0 }
75 });
76}
77
78Dictionary::Ptr ServiceDbObject::GetStatusFields() const
79{

Callers

nothing calls this directly

Calls 4

GetCheckCommandMethod · 0.80
GetEventCommandMethod · 0.80
GetCheckPeriodMethod · 0.80
GetHostMethod · 0.45

Tested by

no test coverage detected