nix-da/hosts/shan/prometheus.nix

59 lines
1.4 KiB
Nix

{ config, ... }:
{
services.prometheus = {
enable = true;
webExternalUrl = "https://prometheus.ccnlc.eu";
scrapeConfigs = [
{
job_name = "node";
static_configs = [
{
targets = [
"nihilus:9000"
"shan:9000"
];
}
];
}
];
};
services.prometheus.exporters.node = {
enable = true;
port = 9000;
# 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"
];
};
services.grafana = {
enable = true;
provision = {
enable = true;
datasources.settings.datasources = [
{
name = "Prometheus";
type = "prometheus";
url = "http://${config.services.prometheus.listenAddress}:${toString config.services.prometheus.port}";
}
];
};
settings = {
users = {
allow_sign_up = true;
};
server = {
protocol = "http";
http_addr = "127.0.0.1";
domain = "grafana.ccnlc.eu";
http_port = 9032;
};
};
};
}