-
Notifications
You must be signed in to change notification settings - Fork 1
/
opnborg-prometheus-grafana.nix
87 lines (87 loc) · 2.2 KB
/
opnborg-prometheus-grafana.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{config, ...}: {
# example nixos config for opn01.lan & opn02.lan including prometheus & grafana
# WebUI http://localhost:6464
####################
#-=# NETWORKING #=-#
####################
networking = {
firewall = {
allowedTCPPorts = [6464]; # open tcp port 6464
};
};
########################
#-=# VIRTUALISATION #=-#
########################
virtualisation = {
oci-containers = {
backend = "podman";
containers = {
opnborg = {
image = "ghcr.io/paepckehh/opnborg";
extraOptions = ["--network=host"];
environment = {
"OPN_TARGETS" = "opn01.lan,opn02.lan";
"OPN_APIKEY" = "+RIb6YWNdcDWMMM7W5ZYDkUvP4qx6e1r7e/Lg/Uh3aBH+veuWfKc7UvEELH/lajWtNxkOaOPjWR8uMcD";
"OPN_APISECRET" = "8VbjM3HKKqQW2ozOe5PTicMXOBVi9jZTSPCGfGrHp8rW6m+TeTxHyZyAI1GjERbuzjmz6jK/usMCWR/p";
};
};
};
};
};
##################
#-=# SERVICES #=-#
##################
services = {
prometheus = {
enable = true;
alertmanager.port = 9292;
port = 9191;
retentionTime = "365d";
scrapeConfigs = [
{
job_name = "node";
static_configs = [
{
targets = [
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}" # self
"opn01.lan:9100" # example opnsense node IP
"opn02.lan:9100" # example opnsense node IP
];
}
];
}
{
job_name = "haproxy";
static_configs = [
{
targets = [
"opn01.lan:8404" # example opnsense node IP
"opn02.lan:8404" # example opnsense node IP
];
}
];
}
];
exporters.node = {
enable = true;
port = 9100;
enabledCollectors = [
"logind"
"systemd"
];
disabledCollectors = [];
openFirewall = true;
};
};
grafana = {
enable = true;
settings = {
server = {
http_addr = "127.0.0.1";
http_port = 9090;
domain = "localhost";
};
};
};
};
}