-
-
Notifications
You must be signed in to change notification settings - Fork 118
/
monitoring.nix
32 lines (30 loc) · 991 Bytes
/
monitoring.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
networking.firewall.allowedTCPPorts = [ 9100 ];
services.prometheus.exporters.node = {
enable = true;
enabledCollectors = [
# "netclass" "exec" "edec" "boottime"
"arp" "bonding" "conntrack" "cpu" "diskstats"
"entropy" # "exec"
"filefd" "filesystem" "hwmon"
"loadavg" "mdadm" "meminfo"
"netdev" "netstat"
"sockstat" "systemd" "textfile" "time" "vmstat" "wifi"
];
extraFlags = [
"--collector.textfile.directory=/var/lib/prometheus-node-exporter-text-files"
""
];
};
system.activationScripts.node-exporter-system-version = ''
mkdir -pm 0775 /var/lib/prometheus-node-exporter-text-files
(
cd /var/lib/prometheus-node-exporter-text-files
(
echo -n "system_version ";
readlink /nix/var/nix/profiles/system | cut -d- -f2
) > system-version.prom.next
mv system-version.prom.next system-version.prom
)
'';
}