diff --git a/hbd/server/templates/alerts.html b/hbd/server/templates/alerts.html index 5fd941d..c73ca0d 100644 --- a/hbd/server/templates/alerts.html +++ b/hbd/server/templates/alerts.html @@ -184,9 +184,9 @@ } .alert-metric { - color: #666; - font-family: 'Courier New', monospace; - font-size: 0.9em; + color: #0066cc; + font-size: 0.85em; + font-weight: normal; } .alert-details { @@ -438,8 +438,8 @@
${alert.level} ${alert.hostname} + ${alert.metric_path.includes('.') ? alert.metric_path.slice(alert.metric_path.indexOf('.') + 1) : alert.metric_path}
-
${alert.metric_path.includes('.') ? alert.metric_path.slice(alert.metric_path.indexOf('.') + 1) : alert.metric_path}
${valueText} Active for ${duration} diff --git a/hbd/server/threshold.py b/hbd/server/threshold.py index 1a2511d..2be4588 100644 --- a/hbd/server/threshold.py +++ b/hbd/server/threshold.py @@ -1109,11 +1109,16 @@ class ThresholdChecker: if host is not None and not host.watched: eventlog(host_name, lvl, message, service="threshold") return + short_path = metric_path.partition(".")[2] or metric_path + title = f"[{lvl}] {host_name} {short_path}" + # Strip the "metric = " prefix from message so body is just the value/detail + prefix = short_path + " = " + body = message[len(prefix):] if message.startswith(prefix) else message asyncio.get_event_loop().create_task(notify_mod.send_notification( host_name, notify_mod.Notification( - title=f"[{lvl}] {host_name}", - body=message, + title=title, + body=body, level=lvl, ), )) @@ -1358,18 +1363,19 @@ class ThresholdChecker: check_name=check_name, metric_name=metric_name, ) - message = f"REMINDER ({alert_state.level.name}): {host_name} - {short_path} = {value} {threshold_info}, ongoing for {int(now - alert_state.since)}s" + body = f"{value} {threshold_info}, ongoing for {int(now - alert_state.since)}s" else: - message = f"REMINDER ({alert_state.level.name}): {host_name} - {short_path} = {value} (ongoing for {int(now - alert_state.since)}s)" - + body = f"{value} (ongoing for {int(now - alert_state.since)}s)" + message = f"REMINDER ({alert_state.level.name}): {host_name} - {short_path} = {body}" + from . import hbdclass host = hbdclass.Host.hosts.get(host_name) if host is None or host.watched: asyncio.get_event_loop().create_task(notify_mod.send_notification( host_name, notify_mod.Notification( - title=f"[REMINDER/{alert_state.level.name}] {host_name}", - body=message, + title=f"[REMINDER/{alert_state.level.name}] {host_name} {short_path}", + body=body, level=alert_state.level.name, ), ))