blob: 823f4f9e4172979b5924db3f99a59cca28ef69b0 (
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
|
inputs:
{ config, ... }:
{
imports = [
(import ./monitoring-target.nix inputs)
];
services.prometheus = {
enable = true;
listenAddress = "127.0.0.1";
# TODO: for NixOS 21.05
extraFlags = [ "--storage.tsdb.retention=15w" ];
#retentionTime = "15w";
scrapeConfigs = [
{
job_name = "prometheus";
static_configs = [
{ targets = [ "localhost:${toString config.services.prometheus.port}" ]; }
];
}
{
job_name = "node_exporter";
static_configs = [
{ targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ]; }
];
}
{
job_name = "grafana";
static_configs = [
{ targets = [ "localhost:${toString config.services.grafana.port}" ]; }
];
}
];
};
services.grafana = {
enable = true;
addr = config.topology.mainVpn.currentNodeIP;
port = 3001;
analytics.reporting.enable = false;
};
networking.firewall.interfaces.${config.topology.mainVpn.interfaceName}.allowedTCPPorts = [
config.services.grafana.port
];
}
|