blob: c4ce4c25a767e146782fce5cb396787d16ea5106 (
plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
{
hosts,
victoriaAddress,
nodeExporterPort,
dockerExporterPort,
cadvisorExporterPort,
nginxExporterPort,
nginxLogExporterPort,
dnsmasqExporterPort,
...
}:
{
foundation.internal.monitoringService = true;
services.vmagent = {
enable = true;
remoteWrite.url = "http://${victoriaAddress}/api/v1/write";
prometheusConfig = {
global = {
scrape_interval = "15s";
};
scrape_configs =
let
exporter = job: ports: filter: {
job_name = job;
static_configs = map (
{ name, ip }:
{
targets = map (p: "${ip}:${toString p}") ports;
labels = {
instance = name;
};
}
) (builtins.filter filter hosts);
};
all = x: true;
is = name: host: host.name == name;
in
[
(exporter "node" [ nodeExporterPort ] all)
(exporter "docker" [ dockerExporterPort ] all)
(exporter "cadvisor" [ cadvisorExporterPort ] all)
(exporter "nginx" [
nginxExporterPort
nginxLogExporterPort
] all)
(exporter "dnsmasq" [ dnsmasqExporterPort ] (is "corsac"))
];
};
};
}
|