This repository has been archived on 2024-07-08. You can view files and clone it, but cannot push or open issues or pull requests.
nix-config-tn/nixos/modules/nixos/services/monitoring.nix
truxnell 1a4d6ecd2a hax
2024-03-25 23:37:21 +11:00

46 lines
800 B
Nix

{ lib
, config
, self
, ...
}:
with lib;
let
cfg = config.mySystem.services.promMonitoring;
in
{
options.mySystem.services.promMonitoring.enable = mkEnableOption "Prometheus Monitoring";
config = mkIf cfg.enable {
services.prometheus.exporters = {
node = {
enable = true;
enabledCollectors = [
"diskstats"
"filesystem"
"loadavg"
"meminfo"
"netdev"
"stat"
"time"
"uname"
"systemd"
];
};
smartctl = {
enable = true;
};
};
# ensure ports are open
networking.firewall.allowedTCPPorts = mkIf cfg.enable [
config.services.prometheus.exporters.node.port
config.services.prometheus.exporters.smartctl.port
];
};
}