mirror of
https://git.sr.ht/~rouven/nixos-config
synced 2025-04-25 16:08:30 +02:00
grafana: init
This commit is contained in:
parent
af73e70082
commit
5fd94d8540
8 changed files with 154 additions and 83 deletions
|
@ -10,6 +10,7 @@
|
|||
./modules/dns
|
||||
./modules/fail2ban
|
||||
./modules/mail
|
||||
./modules/monitoring
|
||||
./modules/networks
|
||||
./modules/pfersel
|
||||
./modules/purge
|
||||
|
|
18
hosts/falkenstein/modules/monitoring/default.nix
Normal file
18
hosts/falkenstein/modules/monitoring/default.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
services.prometheus = {
|
||||
exporters = {
|
||||
node = {
|
||||
enable = true;
|
||||
enabledCollectors = [ "systemd" ];
|
||||
};
|
||||
postfix = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
config.services.prometheus.exporters.node.port
|
||||
config.services.prometheus.exporters.postfix.port
|
||||
];
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
imports = [
|
||||
./hardware-configuration.nix
|
||||
./modules/networks
|
||||
./modules/monitoring
|
||||
];
|
||||
|
||||
boot.loader.grub.enable = true;
|
||||
|
|
14
hosts/fujitsu/modules/monitoring/default.nix
Normal file
14
hosts/fujitsu/modules/monitoring/default.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
services.prometheus = {
|
||||
exporters = {
|
||||
node = {
|
||||
enable = true;
|
||||
enabledCollectors = [ "systemd" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
config.services.prometheus.exporters.node.port
|
||||
];
|
||||
}
|
|
@ -3,7 +3,7 @@ let
|
|||
domain = "monitoring.${config.networking.domain}";
|
||||
in
|
||||
{
|
||||
sops.secrets."grafana/oidc_secret" = {
|
||||
age.secrets."grafana/oidc_secret" = {
|
||||
file = ../../../../secrets/nuc/grafana/oidc.age;
|
||||
owner = "grafana";
|
||||
};
|
||||
|
@ -37,13 +37,11 @@ in
|
|||
auth_url = "https://auth.rfive.de/application/o/authorize/";
|
||||
token_url = "https://auth.rfive.de/application/o/token/";
|
||||
api_url = "https://auth.rfive.de/application/o/userinfo/";
|
||||
role_attribute_path = "contains(roles[*], 'admin') && 'Admin' || contains(roles[*], 'editor') && 'Editor' || 'Viewer'";
|
||||
role_attribute_path = "contains(groups, 'Grafana Admins') && 'Admin' || contains(groups, 'Grafana Editors') && 'Editor' || 'Viewer'";
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
services.postgresql = {
|
||||
|
@ -64,7 +62,6 @@ in
|
|||
node = {
|
||||
enable = true;
|
||||
enabledCollectors = [ "systemd" ];
|
||||
port = 9002;
|
||||
};
|
||||
# postfix = {
|
||||
# enable = true;
|
||||
|
@ -75,17 +72,21 @@ in
|
|||
{
|
||||
job_name = "node";
|
||||
static_configs = [{
|
||||
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ];
|
||||
targets = [
|
||||
"nuc.vpn.rfive.de:${toString config.services.prometheus.exporters.node.port}"
|
||||
"falkenstein.vpn.rfive.de:${toString config.services.prometheus.exporters.node.port}"
|
||||
"cudy.vpn.rfive.de:${toString config.services.prometheus.exporters.node.port}"
|
||||
"fujitsu.vpn.rfive.de:${toString config.services.prometheus.exporters.node.port}"
|
||||
];
|
||||
}];
|
||||
scrape_interval = "15s";
|
||||
}
|
||||
# {
|
||||
# job_name = "postfix";
|
||||
# static_configs = [{
|
||||
# targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.postfix.port}" ];
|
||||
# }];
|
||||
# # scrape_interval = "60s";
|
||||
# }
|
||||
{
|
||||
job_name = "postfix";
|
||||
static_configs = [{
|
||||
targets = [ "falkenstein.vpn.rfive.de:${toString config.services.prometheus.exporters.postfix.port}" ];
|
||||
}];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@
|
|||
}];
|
||||
networkConfig = {
|
||||
DNS = [
|
||||
"9.9.9.9"
|
||||
"149.112.112.112"
|
||||
"192.168.42.1"
|
||||
];
|
||||
LLDP = true;
|
||||
EmitLLDP = "nearest-bridge";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue