nixos-config/hosts/x86_64-linux/beleth/monitoring.nix

92 lines
2.1 KiB
Nix
Raw Normal View History

2024-04-01 02:29:05 +02:00
{
config,
pkgs,
...
}: {
2024-07-05 20:44:42 +02:00
sops.secrets.nextcloud_user_password = {
path = "/etc/nx_user_pass";
owner = "nextcloud";
group = "nextcloud";
};
2024-04-01 02:29:05 +02:00
networking.firewall.allowedTCPPorts = [80 443 9001];
services.grafana = {
enable = true;
2024-04-02 00:55:26 +02:00
port = 2342;
addr = "127.0.0.1";
2024-04-12 12:03:38 +02:00
domain = "grafana.heroin.trade";
2024-07-05 15:22:22 +02:00
analytics.reporting.enable = false;
2024-04-01 02:29:05 +02:00
};
2024-07-05 14:45:25 +02:00
systemd.services.promtail = {
description = "Promtail service for Loki";
wantedBy = ["multi-user.target"];
serviceConfig = {
ExecStart = ''
${pkgs.grafana-loki}/bin/promtail --config.file ${./config-files/promtail.yaml}
'';
};
};
services.loki = {
enable = true;
configFile = ./config-files/loki-config.yaml;
};
2024-04-01 02:29:05 +02:00
services.prometheus = {
enable = true;
port = 9001;
exporters = {
node = {
enable = true;
2024-07-09 15:22:02 +02:00
enabledCollectors = ["systemd" "sysctl" "powersupplyclass" "textfile" "netdev" "filesystem" "ethtool"];
2024-04-01 02:29:05 +02:00
port = 9002;
};
2024-06-16 11:52:36 +02:00
wireguard = {
2024-06-19 11:09:38 +02:00
enable = true;
2024-06-16 11:52:36 +02:00
};
2024-07-05 20:44:42 +02:00
nextcloud = {
2024-07-06 16:42:49 +02:00
enable = true;
user = "nextcloud";
username = "xqtc";
passwordFile = config.sops.secrets.nextcloud_user_password.path;
url = "https://${toString config.services.nextcloud.hostName}";
2024-07-05 20:44:42 +02:00
};
2024-04-01 02:29:05 +02:00
};
scrapeConfigs = [
{
job_name = "beleth";
static_configs = [
{
2024-06-16 12:09:34 +02:00
targets = [
2024-06-19 11:09:38 +02:00
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
2024-07-05 20:44:42 +02:00
"127.0.0.1:${toString config.services.prometheus.exporters.nextcloud.port}"
"127.0.0.1:${toString config.services.forgejo.settings.server.HTTP_PORT}"
2024-07-05 20:44:42 +02:00
];
}
];
}
{
job_name = "jellyfin";
static_configs = [
{
targets = [
"127.0.0.1:8096"
];
}
];
}
{
job_name = "caddy";
static_configs = [
{
targets = [
"127.0.0.1:2019"
2024-06-19 11:09:38 +02:00
];
2024-04-01 02:29:05 +02:00
}
];
}
];
};
}