69 lines
1.7 KiB
Nix
69 lines
1.7 KiB
Nix
{ config, sharedPath, ... }:
|
|
|
|
let
|
|
nodeExporterPort = 40000;
|
|
nginxExporterPort = 40001;
|
|
|
|
basic_auth = {
|
|
username = "jan";
|
|
password_file = config.age.secrets.prometheus-basicauth-password.path;
|
|
};
|
|
in
|
|
{
|
|
imports = [ (sharedPath + "/prometheus/node.nix") ];
|
|
|
|
age.secrets.prometheus-basicauth-password = {
|
|
file = ./prometheus-basicauth-password.age;
|
|
owner = "prometheus";
|
|
group = "prometheus";
|
|
};
|
|
|
|
# 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";
|
|
inherit basic_auth;
|
|
static_configs = [
|
|
{
|
|
targets = [
|
|
"tatos:${toString nodeExporterPort}"
|
|
"istal:${toString nodeExporterPort}"
|
|
];
|
|
}
|
|
];
|
|
}
|
|
{
|
|
job_name = "node_production";
|
|
inherit basic_auth;
|
|
static_configs = [
|
|
{
|
|
targets = [
|
|
"canigou:${toString nodeExporterPort}"
|
|
"magenta:${toString nodeExporterPort}"
|
|
"sm-sd1:${toString nodeExporterPort}"
|
|
];
|
|
}
|
|
];
|
|
}
|
|
{
|
|
job_name = "nginx_production";
|
|
inherit basic_auth;
|
|
static_configs = [
|
|
{
|
|
targets = [
|
|
"canigou:${toString nginxExporterPort}"
|
|
"magenta:${toString nginxExporterPort}"
|
|
];
|
|
}
|
|
];
|
|
}
|
|
];
|
|
};
|
|
}
|