1
0

Compare commits

...

3 Commits

Author SHA1 Message Date
3ea21db30b Improve monitoring rules 2021-10-23 18:14:51 +02:00
00caae0ed3 Move rules to dedicated file 2021-10-22 23:53:42 +02:00
4392302eb4 Add alerting to monitoring 2021-10-22 23:21:26 +02:00
2 changed files with 55 additions and 0 deletions

View File

@ -63,6 +63,40 @@ in {
services.prometheus.exporters.node.enable = true; services.prometheus.exporters.node.enable = true;
services.prometheus.xmpp-alerts = {
enable = true;
settings = {
jid = "feuer@fem-net.de";
password_command = "cat /var/src/secrets/xmpp-alert/password";
listen_address = "::1";
listen_port = 9199;
to_jid = "clerie@fem-net.de";
format = "short";
};
};
services.prometheus.alertmanager = {
enable = true;
listenAddress = "[::1]";
port = 9093;
configuration = {
route = {
receiver = "xmpp-receiver";
group_by = [ "instance" ];
};
receivers = [
{
name = "xmpp-receiver";
webhook_configs = [
{
url = "http://[::1]:9199/alert";
}
];
}
];
};
};
services.prometheus = { services.prometheus = {
enable = true; enable = true;
listenAddress = "[::1]"; listenAddress = "[::1]";
@ -118,6 +152,16 @@ in {
]; ];
} }
]; ];
alertmanagers = [
{
static_configs = [ {
targets = [
"[::1]:9093"
];
} ];
}
];
rules = [ (readFile ./rules.yml) ];
}; };
services.grafana = { services.grafana = {

View File

@ -0,0 +1,11 @@
groups:
- name: alert.rules
rules:
- alert: InstanceDown
expr: up{job="node-exporter"} == 0
for: 1m
labels:
severity: critical
annotations:
summary: "Endpoint {{ $labels.instance }} down"
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 1 minutes."