| 28 | { } |
| 29 | |
| 30 | Dictionary::Ptr HostDbObject::GetConfigFields() const |
| 31 | { |
| 32 | Dictionary::Ptr fields = new Dictionary(); |
| 33 | Host::Ptr host = static_pointer_cast<Host>(GetObject()); |
| 34 | |
| 35 | /* Compatibility fallback. */ |
| 36 | String displayName = host->GetDisplayName(); |
| 37 | |
| 38 | unsigned long notificationStateFilter = CompatUtility::GetCheckableNotificationTypeFilter(host); |
| 39 | unsigned long notificationTypeFilter = CompatUtility::GetCheckableNotificationTypeFilter(host); |
| 40 | |
| 41 | return new Dictionary({ |
| 42 | { "alias", !displayName.IsEmpty() ? displayName : host->GetName() }, |
| 43 | { "display_name", displayName }, |
| 44 | { "address", host->GetAddress() }, |
| 45 | { "address6", host->GetAddress6() }, |
| 46 | { "check_command_object_id", host->GetCheckCommand() }, |
| 47 | { "eventhandler_command_object_id", host->GetEventCommand() }, |
| 48 | { "check_timeperiod_object_id", host->GetCheckPeriod() }, |
| 49 | { "check_interval", host->GetCheckInterval() / 60.0 }, |
| 50 | { "retry_interval", host->GetRetryInterval() / 60.0 }, |
| 51 | { "max_check_attempts", host->GetMaxCheckAttempts() }, |
| 52 | { "flap_detection_enabled", host->GetEnableFlapping() }, |
| 53 | { "low_flap_threshold", host->GetFlappingThresholdLow() }, |
| 54 | { "high_flap_threshold", host->GetFlappingThresholdLow() }, |
| 55 | { "process_performance_data", host->GetEnablePerfdata() }, |
| 56 | { "freshness_checks_enabled", 1 }, |
| 57 | { "freshness_threshold", Convert::ToLong(host->GetCheckInterval()) }, |
| 58 | { "event_handler_enabled", host->GetEnableEventHandler() }, |
| 59 | { "passive_checks_enabled", host->GetEnablePassiveChecks() }, |
| 60 | { "active_checks_enabled", host->GetEnableActiveChecks() }, |
| 61 | { "notifications_enabled", host->GetEnableNotifications() }, |
| 62 | { "notes", host->GetNotes() }, |
| 63 | { "notes_url", host->GetNotesUrl() }, |
| 64 | { "action_url", host->GetActionUrl() }, |
| 65 | { "icon_image", host->GetIconImage() }, |
| 66 | { "icon_image_alt", host->GetIconImageAlt() }, |
| 67 | { "notification_interval", CompatUtility::GetCheckableNotificationNotificationInterval(host) }, |
| 68 | { "notify_on_down", (notificationStateFilter & (ServiceWarning | ServiceCritical)) ? 1 : 0 }, |
| 69 | { "notify_on_unreachable", 1 }, /* We don't have this filter and state, and as such we don't filter such notifications. */ |
| 70 | { "notify_on_recovery", (notificationTypeFilter & NotificationRecovery) ? 1 : 0 }, |
| 71 | { "notify_on_flapping", (notificationTypeFilter & (NotificationFlappingStart | NotificationFlappingEnd)) ? 1 : 0 }, |
| 72 | { "notify_on_downtime", (notificationTypeFilter & (NotificationDowntimeStart | NotificationDowntimeEnd | NotificationDowntimeRemoved)) ? 1 : 0 } |
| 73 | }); |
| 74 | } |
| 75 | |
| 76 | Dictionary::Ptr HostDbObject::GetStatusFields() const |
| 77 | { |
no test coverage detected