mirror of https://github.com/Icinga/icinga2.git
Merge pull request #5980 from Icinga/fix/db-ido-notification-filter
Explicitly pass 1 or 0 for notification filters in DB IDO
This commit is contained in:
commit
2c7d738e36
|
@ -81,11 +81,11 @@ Dictionary::Ptr HostDbObject::GetConfigFields() const
|
|||
{ "icon_image", host->GetIconImage() },
|
||||
{ "icon_image_alt", host->GetIconImageAlt() },
|
||||
{ "notification_interval", CompatUtility::GetCheckableNotificationNotificationInterval(host) },
|
||||
{ "notify_on_down", (notificationStateFilter & ServiceWarning) || (notificationStateFilter && ServiceCritical) },
|
||||
{ "notify_on_down", (notificationStateFilter & (ServiceWarning | ServiceCritical)) ? 1 : 0 },
|
||||
{ "notify_on_unreachable", 1 }, /* We don't have this filter and state, and as such we don't filter such notifications. */
|
||||
{ "notify_on_recovery", notificationTypeFilter & NotificationRecovery },
|
||||
{ "notify_on_flapping", (notificationTypeFilter & NotificationFlappingStart) || (notificationTypeFilter & NotificationFlappingEnd) },
|
||||
{ "notify_on_downtime", (notificationTypeFilter & NotificationDowntimeStart) || (notificationTypeFilter & NotificationDowntimeEnd) || (notificationTypeFilter & NotificationDowntimeRemoved) }
|
||||
{ "notify_on_recovery", (notificationTypeFilter & NotificationRecovery) ? 1 : 0 },
|
||||
{ "notify_on_flapping", (notificationTypeFilter & (NotificationFlappingStart | NotificationFlappingEnd)) ? 1 : 0 },
|
||||
{ "notify_on_downtime", (notificationTypeFilter & (NotificationDowntimeStart | NotificationDowntimeEnd | NotificationDowntimeRemoved)) ? 1 : 0 }
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -275,8 +275,8 @@ void HostDbObject::OnConfigUpdateHeavy()
|
|||
{ "dependent_host_object_id", host },
|
||||
{ "inherits_parent", 1 },
|
||||
{ "timeperiod_object_id", dep->GetPeriod() },
|
||||
{ "fail_on_up", stateFilter & StateFilterUp },
|
||||
{ "fail_on_down", stateFilter & StateFilterDown },
|
||||
{ "fail_on_up", (stateFilter & StateFilterUp) ? 1 : 0 },
|
||||
{ "fail_on_down", (stateFilter & StateFilterDown) ? 1 : 0 },
|
||||
{ "instance_id", 0 } /* DbConnection class fills in real ID */
|
||||
});
|
||||
queries.emplace_back(std::move(query2));
|
||||
|
|
|
@ -82,12 +82,12 @@ Dictionary::Ptr ServiceDbObject::GetConfigFields() const
|
|||
{ "icon_image", service->GetIconImage() },
|
||||
{ "icon_image_alt", service->GetIconImageAlt() },
|
||||
{ "notification_interval", CompatUtility::GetCheckableNotificationNotificationInterval(service) },
|
||||
{ "notify_on_warning", notificationStateFilter & ServiceWarning },
|
||||
{ "notify_on_unknown", notificationStateFilter & ServiceUnknown },
|
||||
{ "notify_on_critical", notificationStateFilter & ServiceCritical },
|
||||
{ "notify_on_recovery", notificationTypeFilter & NotificationRecovery },
|
||||
{ "notify_on_flapping", (notificationTypeFilter & NotificationFlappingStart) || (notificationTypeFilter & NotificationFlappingEnd) },
|
||||
{ "notify_on_downtime", (notificationTypeFilter & NotificationDowntimeStart) || (notificationTypeFilter & NotificationDowntimeEnd) || (notificationTypeFilter & NotificationDowntimeRemoved) }
|
||||
{ "notify_on_warning", (notificationStateFilter & ServiceWarning) ? 1 : 0 },
|
||||
{ "notify_on_unknown", (notificationStateFilter & ServiceUnknown) ? 1 : 0 },
|
||||
{ "notify_on_critical", (notificationStateFilter & ServiceCritical) ? 1 : 0 },
|
||||
{ "notify_on_recovery", (notificationTypeFilter & NotificationRecovery) ? 1 : 0 },
|
||||
{ "notify_on_flapping", (notificationTypeFilter & (NotificationFlappingStart | NotificationFlappingEnd)) ? 1 : 0 },
|
||||
{ "notify_on_downtime", (notificationTypeFilter & (NotificationDowntimeStart | NotificationDowntimeEnd | NotificationDowntimeRemoved)) ? 1 : 0 }
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -238,10 +238,10 @@ void ServiceDbObject::OnConfigUpdateHeavy()
|
|||
{ "dependent_service_object_id", service },
|
||||
{ "inherits_parent", 1 },
|
||||
{ "timeperiod_object_id", dep->GetPeriod() },
|
||||
{ "fail_on_ok", stateFilter & StateFilterOK },
|
||||
{ "fail_on_warning", stateFilter & StateFilterWarning },
|
||||
{ "fail_on_critical", stateFilter & StateFilterCritical },
|
||||
{ "fail_on_unknown", stateFilter & StateFilterUnknown },
|
||||
{ "fail_on_ok", (stateFilter & StateFilterOK) ? 1 : 0 },
|
||||
{ "fail_on_warning", (stateFilter & StateFilterWarning) ? 1 : 0 },
|
||||
{ "fail_on_critical", (stateFilter & StateFilterCritical) ? 1 : 0 },
|
||||
{ "fail_on_unknown", (stateFilter & StateFilterUnknown) ? 1 : 0 },
|
||||
{ "instance_id", 0 } /* DbConnection class fills in real ID */
|
||||
});
|
||||
queries.emplace_back(std::move(query1));
|
||||
|
|
|
@ -51,16 +51,16 @@ Dictionary::Ptr UserDbObject::GetConfigFields() const
|
|||
{ "host_notifications_enabled", user->GetEnableNotifications() },
|
||||
{ "service_notifications_enabled", user->GetEnableNotifications() },
|
||||
{ "can_submit_commands", 1 },
|
||||
{ "notify_service_recovery", (typeFilter & NotificationRecovery) != 0 },
|
||||
{ "notify_service_warning", (stateFilter & StateFilterWarning) != 0 },
|
||||
{ "notify_service_unknown", (stateFilter & StateFilterUnknown) != 0 },
|
||||
{ "notify_service_critical", (stateFilter & StateFilterCritical) != 0 },
|
||||
{ "notify_service_flapping", (typeFilter & (NotificationFlappingStart | NotificationFlappingEnd)) != 0 },
|
||||
{ "notify_service_downtime", (typeFilter & (NotificationDowntimeStart | NotificationDowntimeEnd | NotificationDowntimeRemoved)) != 0 },
|
||||
{ "notify_host_recovery", (typeFilter & NotificationRecovery) != 0 },
|
||||
{ "notify_host_down", (stateFilter & StateFilterDown) != 0 },
|
||||
{ "notify_host_flapping", (typeFilter & (NotificationFlappingStart | NotificationFlappingEnd)) != 0 },
|
||||
{ "notify_host_downtime", (typeFilter & (NotificationDowntimeStart | NotificationDowntimeEnd | NotificationDowntimeRemoved)) != 0 }
|
||||
{ "notify_service_recovery", (typeFilter & NotificationRecovery) ? 1 : 0 },
|
||||
{ "notify_service_warning", (stateFilter & StateFilterWarning) ? 1 : 0 },
|
||||
{ "notify_service_unknown", (stateFilter & StateFilterUnknown) ? 1 : 0 },
|
||||
{ "notify_service_critical", (stateFilter & StateFilterCritical) ? 1 : 0 },
|
||||
{ "notify_service_flapping", (typeFilter & (NotificationFlappingStart | NotificationFlappingEnd)) ? 1 : 0 },
|
||||
{ "notify_service_downtime", (typeFilter & (NotificationDowntimeStart | NotificationDowntimeEnd | NotificationDowntimeRemoved)) ? 1 : 0 },
|
||||
{ "notify_host_recovery", (typeFilter & NotificationRecovery) ? 1 : 0 },
|
||||
{ "notify_host_down", (stateFilter & StateFilterDown) ? 1 : 0 },
|
||||
{ "notify_host_flapping", (typeFilter & (NotificationFlappingStart | NotificationFlappingEnd)) ? 1 : 0 },
|
||||
{ "notify_host_downtime", (typeFilter & (NotificationDowntimeStart | NotificationDowntimeEnd | NotificationDowntimeRemoved)) ? 1 : 0 }
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue