39 lines
1.2 KiB
Nix
39 lines
1.2 KiB
Nix
{ config, hostsPath, ... }:
|
|
|
|
let
|
|
istalData = import (hostsPath + "/istal/data.secret.nix");
|
|
nodeExporterPort = 40000;
|
|
in
|
|
{
|
|
services.prometheus.exporters.node = {
|
|
enable = true;
|
|
port = nodeExporterPort;
|
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/prometheus/exporters.nix
|
|
enabledCollectors = [ "systemd" ];
|
|
# /nix/store/zgsw0yx18v10xa58psanfabmg95nl2bb-node_exporter-1.8.1/bin/node_exporter --help
|
|
extraFlags = [ "--collector.ethtool" "--collector.softirqs" "--collector.tcpstat" "--collector.wifi" ];
|
|
};
|
|
|
|
# https://wiki.nixos.org/wiki/Prometheus
|
|
# https://nixos.org/manual/nixos/stable/#module-services-prometheus-exporters-configuration
|
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/prometheus/default.nix
|
|
services.prometheus = {
|
|
enable = true;
|
|
listenAddress = "127.0.0.1";
|
|
port = 33010;
|
|
globalConfig.scrape_interval = "15s"; # "1m"
|
|
scrapeConfigs = [
|
|
{
|
|
job_name = "node_dev";
|
|
static_configs = [
|
|
{
|
|
targets = [
|
|
"localhost:${toString nodeExporterPort}"
|
|
"${istalData.addr}:${toString nodeExporterPort}"
|
|
];
|
|
}
|
|
];
|
|
}
|
|
];
|
|
};
|
|
}
|