def show(self): failed_notifications = notifications.number_of_failed_notifications( after=notifications.acknowledged_time()) if not failed_notifications: return html.open_div(class_="has_failed_notifications") html.open_div(class_="failed_notifications_inner") confirm_url = makeuri_contextless( request, [], filename="clear_failed_notifications.py") html.icon_button(confirm_url, _("Clear failed notifications"), "closetimewarp", target="main") view_url = makeuri_contextless( request, [("view_name", "failed_notifications")], filename="view.py", ) html.a(_("%d failed notifications") % failed_notifications, href=view_url) html.close_div() html.close_div()
def _show_failed_notifications(self): if not self.parameters()["show_failed_notifications"]: return failed_notifications = notifications.number_of_failed_notifications( after=notifications.acknowledged_time() ) if not failed_notifications: return html.open_div(class_="spacertop") html.open_div(class_="tacticalalert") confirm_url = makeuri_contextless(request, [], filename="clear_failed_notifications.py") html.icon_button(confirm_url, _("Confirm failed notifications"), "delete", target="main") view_url = makeuri_contextless( request, [("view_name", "failed_notifications")], filename="view.py", ) html.a(_("%d failed notifications") % failed_notifications, target="main", href=view_url) html.close_div() html.close_div()
def show(self): notdata = notifications.load_failed_notifications(after=notifications.acknowledged_time(), stat_only=True) if notdata is None: failed_notifications = 0 else: failed_notifications = notdata[0] if not failed_notifications: return html.open_div(class_="has_failed_notifications") html.open_div(class_="failed_notifications_inner") confirm_url = html.makeuri_contextless([], filename="clear_failed_notifications.py") html.icon_button(confirm_url, _("Clear failed notifications"), "closetimewarp", target="main") view_url = html.makeuri_contextless([("view_name", "failed_notifications")], filename="view.py") html.a(_("%d failed notifications") % failed_notifications, href=view_url) html.close_div() html.close_div()
def _get_failed_notification_stats(self): try: return notifications.load_failed_notifications( after=notifications.acknowledged_time(), stat_only=True, )[0] except livestatus.MKLivestatusNotFoundError: return None