blob: 4c922b9aa61225eb33777653946303eda7aeb20c (
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
|
{
hosts,
victoriaAddress,
victoriaDefaultPort,
nodeExporterPort,
dockerExporterPort,
cadvisorExporterPort,
nginxExporterPort,
...
}:
{
foundation.internal.monitoringService = true;
services.vmagent = {
enable = true;
remoteWrite.url = "http://${victoriaAddress}:${toString victoriaDefaultPort}/api/v1/write";
prometheusConfig = {
global = {
scrape_interval = "15s";
};
scrape_configs =
let
exporter = job: port: {
job_name = job;
static_configs = map (
{ name, ip }:
{
targets = [ "${ip}:${toString port}" ];
labels = {
instance = name;
};
}
) hosts;
};
in
[
(exporter "node" nodeExporterPort)
(exporter "docker" dockerExporterPort)
(exporter "cadvisor" cadvisorExporterPort)
(exporter "nginx" nginxExporterPort)
];
};
};
}
|