- Deleted individual alert files for host down, inode usage, and RAM usage. - Merged service down alerts into a new structure with separate files for each service (Gitea, Postfix, Dovecot, OpenLDAP, WireGuard). - Introduced a new system alert structure consolidating CPU, disk, host down, inode, and RAM usage alerts. - Updated alert conditions to use 'D' for thresholds and adjusted expressions accordingly. - Improved annotations and labels for clarity and consistency across alerts.
57 lines
1.4 KiB
Nix
57 lines
1.4 KiB
Nix
{ lib, pkgs, config, ... }:
|
|
{
|
|
grafanaAlertRuleDefinitions = [
|
|
{
|
|
uid = "wireguard-service-down-alert-uid";
|
|
title = "WireGuard Service Down";
|
|
condition = "C";
|
|
data = [
|
|
{
|
|
refId = "A";
|
|
relativeTimeRange = {
|
|
from = 300;
|
|
to = 0;
|
|
};
|
|
datasourceUid = "vm-datasource-uid";
|
|
model = {
|
|
editorMode = "code";
|
|
expr = "node_systemd_unit_state{state=\"active\", name=\"wireguard-wg_cloonar.service\"} OR on() vector(0)";
|
|
hide = false;
|
|
intervalMs = 1000;
|
|
legendFormat = "__auto";
|
|
maxDataPoints = 43200;
|
|
range = true;
|
|
refId = "A";
|
|
};
|
|
}
|
|
{
|
|
refId = "B";
|
|
datasourceUid = "__expr__";
|
|
model = {
|
|
type = "reduce";
|
|
expression = "A";
|
|
reducer = "last";
|
|
};
|
|
}
|
|
{
|
|
refId = "C";
|
|
datasourceUid = "__expr__";
|
|
model = {
|
|
type = "math";
|
|
expression = "$B < 1";
|
|
};
|
|
}
|
|
];
|
|
noDataState = "Alerting";
|
|
execErrState = "Alerting";
|
|
for = "5m";
|
|
annotations = {
|
|
description = "WireGuard service is down on {{ $labels.instance }}";
|
|
summary = "WireGuard Service Down";
|
|
};
|
|
labels = {
|
|
severity = "critical";
|
|
};
|
|
}
|
|
];
|
|
} |