nixos-config/hosts/x86_64-linux/beleth/monitoring.nix
2024-11-08 00:53:37 +01:00

93 lines
2.1 KiB
Nix

{
config,
pkgs,
...
}: {
sops.secrets.nextcloud_user_password = {
path = "/etc/nx_user_pass";
owner = "nextcloud";
group = "nextcloud";
};
networking.firewall.allowedTCPPorts = [80 443 9001];
services.grafana = {
enable = true;
port = 2342;
addr = "127.0.0.1";
domain = "grafana.heroin.trade";
analytics.reporting.enable = false;
};
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;
};
services.prometheus = {
enable = true;
port = 9001;
exporters = {
node = {
enable = true;
enabledCollectors = ["systemd" "sysctl" "powersupplyclass" "textfile" "netdev" "filesystem" "ethtool"];
port = 9002;
};
wireguard = {
enable = true;
};
nextcloud = {
enable = true;
user = "nextcloud";
username = "xqtc";
passwordFile = config.sops.secrets.nextcloud_user_password.path;
url = "https://${toString config.services.nextcloud.hostName}";
};
};
scrapeConfigs = [
{
job_name = "beleth";
static_configs = [
{
targets = [
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
"127.0.0.1:${toString config.services.prometheus.exporters.nextcloud.port}"
"127.0.0.1:${toString config.services.forgejo.settings.server.HTTP_PORT}"
"127.0.0.1:${toString config.services.comin.exporter.port}"
];
}
];
}
{
job_name = "jellyfin";
static_configs = [
{
targets = [
"127.0.0.1:8096"
];
}
];
}
{
job_name = "caddy";
static_configs = [
{
targets = [
"127.0.0.1:2019"
];
}
];
}
];
};
}