tyo0/prometheus: simplify annotations

Two sentences describing the same thing is not very useful.
This commit is contained in:
Guanran Wang 2024-12-07 23:02:32 +08:00
parent b8a31154c3
commit efc3f4ea55
Signed by: nyancat
GPG key ID: 91F97D9ED12639CF
2 changed files with 4 additions and 18 deletions

View file

@ -58,7 +58,6 @@
tmpl = lib.escapeURL '' tmpl = lib.escapeURL ''
{{ range .alerts }}- Status: {{ .status }} {{ range .alerts }}- Status: {{ .status }}
Summary: {{ .annotations.summary }} Summary: {{ .annotations.summary }}
Description: {{ .annotations.description }}
Source: {{ .generatorURL }} Source: {{ .generatorURL }}
{{ end }} {{ end }}
''; '';

View file

@ -121,44 +121,31 @@ in
alert = "NodeDown"; alert = "NodeDown";
expr = ''up{job="node_exporter"} == 0''; expr = ''up{job="node_exporter"} == 0'';
for = "5m"; for = "5m";
annotations = { annotations.summary = "Node exporter down on {{ $labels.instance }}";
summary = "Node exporter down on {{ $labels.instance }}";
description = "Node exporter on {{ $labels.instance }} has been down for more than 5 minutes.";
};
} }
{ {
alert = "HTTPDown"; alert = "HTTPDown";
expr = ''up{job="blackbox_probe"} == 0 or probe_success{job="blackbox_probe"} == 0''; expr = ''up{job="blackbox_probe"} == 0 or probe_success{job="blackbox_probe"} == 0'';
for = "5m"; for = "5m";
annotations = { annotations.summary = "HTTP probe failure on {{ $labels.instance }}";
summary = "HTTP probe failure on {{ $labels.instance }}";
description = "The HTTP blackbox probe on {{ $labels.instance }} has failed for more than 5 minutes.";
};
} }
{ {
alert = "MemoryFull"; alert = "MemoryFull";
expr = ''node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes < 0.1''; expr = ''node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes < 0.1'';
for = "5m"; for = "5m";
annotations = { annotations.summary = "Low available memory on {{ $labels.instance }}";
summary = "Low available memory on {{ $labels.instance }}";
description = "{{ $labels.instance }} has less than 10% available memory for more than 5 minutes.";
};
} }
{ {
alert = "DiskFull"; alert = "DiskFull";
expr = ''node_filesystem_avail_bytes{mountpoint=~"/|/persist|/mnt"} / node_filesystem_size_bytes < 0.1''; expr = ''node_filesystem_avail_bytes{mountpoint=~"/|/persist|/mnt"} / node_filesystem_size_bytes < 0.1'';
annotations = { annotations = {
summary = "Low disk space on {{ $labels.instance }}"; summary = "Low disk space on {{ $labels.instance }}";
description = "The disk {{ $labels.device }} mounted at {{ $labels.mountpoint }} on {{ $labels.instance }} has less than 10% of empty space available.";
}; };
} }
{ {
alert = "UnitFailed"; alert = "UnitFailed";
expr = ''node_systemd_unit_state{state="failed"} == 1''; expr = ''node_systemd_unit_state{state="failed"} == 1'';
annotations = { annotations.summary = "Systemd unit {{ $labels.name }} failure on {{ $labels.instance }}";
summary = "Systemd unit {{ $labels.name }} failure on {{ $labels.instance }}";
description = "The systemd unit {{ $labels.name }} on {{ $labels.instance }} has entered a {{ $labels.state }} state.";
};
} }
]; ];
}; };