summaryrefslogtreecommitdiffstats
path: root/usecases/server
diff options
context:
space:
mode:
Diffstat (limited to 'usecases/server')
-rw-r--r--usecases/server/monitoring-server.nix55
1 files changed, 55 insertions, 0 deletions
diff --git a/usecases/server/monitoring-server.nix b/usecases/server/monitoring-server.nix
new file mode 100644
index 0000000..823f4f9
--- /dev/null
+++ b/usecases/server/monitoring-server.nix
@@ -0,0 +1,55 @@
1inputs:
2
3{ config, ... }:
4
5{
6 imports = [
7 (import ./monitoring-target.nix inputs)
8 ];
9
10 services.prometheus = {
11 enable = true;
12
13 listenAddress = "127.0.0.1";
14
15 # TODO: for NixOS 21.05
16 extraFlags = [ "--storage.tsdb.retention=15w" ];
17 #retentionTime = "15w";
18
19 scrapeConfigs = [
20 {
21 job_name = "prometheus";
22 static_configs = [
23 { targets = [ "localhost:${toString config.services.prometheus.port}" ]; }
24 ];
25 }
26
27 {
28 job_name = "node_exporter";
29 static_configs = [
30 { targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ]; }
31 ];
32 }
33
34 {
35 job_name = "grafana";
36 static_configs = [
37 { targets = [ "localhost:${toString config.services.grafana.port}" ]; }
38 ];
39 }
40 ];
41 };
42
43 services.grafana = {
44 enable = true;
45
46 addr = config.topology.mainVpn.currentNodeIP;
47 port = 3001;
48
49 analytics.reporting.enable = false;
50 };
51
52 networking.firewall.interfaces.${config.topology.mainVpn.interfaceName}.allowedTCPPorts = [
53 config.services.grafana.port
54 ];
55}