58 lines
1.3 KiB
Nix
58 lines
1.3 KiB
Nix
{ config, pkgs, lib, ... }: {
|
|
|
|
services.nginx = {
|
|
enable = true;
|
|
statusPage = true;
|
|
virtualHosts = {
|
|
"prometheus.robi.private" = {
|
|
extraConfig = ''
|
|
allow ${config.tinc.private.subnet};
|
|
deny all;
|
|
'';
|
|
locations."/" = { proxyPass = "http://localhost:${toString config.services.prometheus.port}"; };
|
|
};
|
|
};
|
|
};
|
|
|
|
services.prometheus = {
|
|
enable = true;
|
|
# keep data for 30 days
|
|
extraFlags = [ "--storage.tsdb.retention.time=30d" ];
|
|
|
|
exporters = {
|
|
node = {
|
|
enable = true;
|
|
enabledCollectors = [ "systemd" ];
|
|
port = 9002;
|
|
};
|
|
};
|
|
|
|
scrapeConfigs = [
|
|
{
|
|
job_name = "netdata";
|
|
metrics_path = "/api/v1/allmetrics";
|
|
params.format = [ "prometheus" ];
|
|
scrape_interval = "5s";
|
|
static_configs = [
|
|
{
|
|
targets = [ "localhost:19999" ];
|
|
labels = {
|
|
service = "netdata";
|
|
server = "robi";
|
|
};
|
|
}
|
|
];
|
|
}
|
|
{
|
|
job_name = "systemd";
|
|
static_configs = [{
|
|
targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ];
|
|
labels = {
|
|
service = "node-exporter";
|
|
server = "pepe";
|
|
};
|
|
}];
|
|
}
|
|
];
|
|
};
|
|
}
|