2019-12-20 05:54:26 +01:00
|
|
|
{ config, pkgs, lib, ... }: {
|
2019-10-24 02:20:38 +02:00
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
statusPage = true;
|
|
|
|
virtualHosts = {
|
|
|
|
"prometheus.workhorse.private" = {
|
2019-12-20 05:54:26 +01:00
|
|
|
locations."/" = { proxyPass = "http://workhorse.private:9090"; };
|
2019-10-24 02:20:38 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-10-26 13:46:37 +02:00
|
|
|
services.prometheus = {
|
2019-10-24 02:20:38 +02:00
|
|
|
enable = true;
|
2019-12-24 00:30:47 +01:00
|
|
|
# keep data for 30 days
|
2019-12-25 11:19:38 +01:00
|
|
|
extraFlags = [ "--storage.tsdb.retention.time=30d" ];
|
2019-10-24 02:20:38 +02:00
|
|
|
scrapeConfigs = [
|
|
|
|
{
|
|
|
|
job_name = "nginx";
|
|
|
|
scrape_interval = "8s";
|
|
|
|
static_configs = [
|
|
|
|
{
|
2019-12-20 05:54:26 +01:00
|
|
|
targets = [ "sputnik.private:9113" ];
|
2019-10-24 02:20:38 +02:00
|
|
|
labels = {
|
|
|
|
service = "nginx";
|
|
|
|
server = "sputnik";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
2019-12-20 05:54:26 +01:00
|
|
|
targets = [ "sputnik.private:9113" ];
|
2019-10-24 02:20:38 +02:00
|
|
|
labels = {
|
|
|
|
service = "nginx";
|
|
|
|
server = "sputnik";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
2019-12-20 05:54:26 +01:00
|
|
|
targets = [ "workhorse.private:9113" ];
|
2019-10-24 02:20:38 +02:00
|
|
|
labels = {
|
|
|
|
service = "nginx";
|
|
|
|
server = "sputnik";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
job_name = "netdata";
|
|
|
|
metrics_path = "/api/v1/allmetrics";
|
|
|
|
params.format = [ "prometheus" ];
|
|
|
|
scrape_interval = "5s";
|
|
|
|
static_configs = [
|
|
|
|
{
|
2020-04-26 20:17:37 +02:00
|
|
|
targets = [ "pepe.private:19999" ];
|
2019-10-24 02:20:38 +02:00
|
|
|
labels = {
|
|
|
|
service = "netdata";
|
2020-04-26 20:17:37 +02:00
|
|
|
server = "pepe";
|
2019-10-24 02:20:38 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
2019-12-20 05:54:26 +01:00
|
|
|
targets = [ "sputnik.private:19999" ];
|
2019-10-24 02:20:38 +02:00
|
|
|
labels = {
|
|
|
|
service = "netdata";
|
|
|
|
server = "sputnik";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
2019-12-20 05:54:26 +01:00
|
|
|
targets = [ "workhorse.private:19999" ];
|
2019-10-24 02:20:38 +02:00
|
|
|
labels = {
|
|
|
|
service = "netdata";
|
|
|
|
server = "workhorse";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
job_name = "gogs";
|
|
|
|
metrics_path = "/-/metrics";
|
|
|
|
params.format = [ "prometheus" ];
|
|
|
|
scrape_interval = "10s";
|
2019-12-20 05:54:26 +01:00
|
|
|
static_configs = [{
|
|
|
|
targets = [ "workhorse.private:3000" ];
|
|
|
|
labels = {
|
|
|
|
service = "gogs";
|
|
|
|
server = "kruck";
|
|
|
|
};
|
|
|
|
}];
|
2019-10-24 02:20:38 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
job_name = "home-assistant";
|
|
|
|
scrape_interval = "60s";
|
|
|
|
metrics_path = "/api/prometheus";
|
2020-04-26 20:17:37 +02:00
|
|
|
# you can create this token on your user profile page
|
|
|
|
# http://pepe.private:8123/profile
|
2020-04-27 21:41:29 +02:00
|
|
|
bearer_token =
|
|
|
|
lib.fileContents <secrets/prometheus/home-assistant/api_token>;
|
2019-12-20 05:54:26 +01:00
|
|
|
static_configs = [{
|
2020-04-26 20:17:37 +02:00
|
|
|
targets = [ "pepe.private:8123" ];
|
2019-12-20 05:54:26 +01:00
|
|
|
labels = {
|
|
|
|
service = "hass";
|
2020-04-26 20:17:37 +02:00
|
|
|
server = "pepe";
|
2019-12-20 05:54:26 +01:00
|
|
|
city = "essen";
|
|
|
|
};
|
|
|
|
}];
|
2019-10-24 02:20:38 +02:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|