Files
naxos-os/modules/monitoring/prometheus.nix
T
Lukas Holzner 5da58ae6d7
Test NaxOS Module Configurations / test-modules (push) Failing after 6m10s
feat(core): initialize NaxOS declarative NixOS distribution, modules, and ISO installer
2026-09-03 23:53:18 +02:00

73 lines
1.5 KiB
Nix

{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.naxos.monitoring;
in {
options.services.naxos.monitoring = {
enable = mkEnableOption "NaxOS Metrics and Telemetry Collection";
prometheusPort = mkOption {
type = types.port;
default = 9090;
description = "Prometheus server listen port.";
};
nodeExporterPort = mkOption {
type = types.port;
default = 9100;
description = "Node exporter listen port.";
};
retentionTime = mkOption {
type = types.str;
default = "15d";
description = "Metrics retention period.";
};
};
config = mkIf cfg.enable {
# Prometheus TSDB
services.prometheus = {
enable = true;
port = cfg.prometheusPort;
retentionTime = cfg.retentionTime;
extraFlags = [
"--web.enable-remote-write-receiver"
];
scrapeConfigs = [
{
job_name = "node";
static_configs = [{
targets = [ "127.0.0.1:${toString cfg.nodeExporterPort}" ];
}];
}
{
job_name = "naxos-api";
static_configs = [{
targets = [ "127.0.0.1:8088" ];
}];
}
];
};
# Node exporter for hardware & OS metrics
services.prometheus.exporters.node = {
enable = true;
port = cfg.nodeExporterPort;
enabledCollectors = [
"cpu"
"diskstats"
"filesystem"
"loadavg"
"meminfo"
"netdev"
"stat"
"systemd"
"thermal_zone"
];
};
};
}