mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 09:28:27 +02:00
refactor: p8s scrape configs
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
lib,
|
||||||
config,
|
config,
|
||||||
myvars,
|
myvars,
|
||||||
...
|
...
|
||||||
@@ -45,64 +46,75 @@
|
|||||||
|
|
||||||
# specifies a set of targets and parameters describing how to scrape metrics from them.
|
# specifies a set of targets and parameters describing how to scrape metrics from them.
|
||||||
# https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config
|
# https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config
|
||||||
scrapeConfigs = [
|
scrapeConfigs =
|
||||||
|
[
|
||||||
|
# --- Homelab Applications --- #
|
||||||
|
|
||||||
|
{
|
||||||
|
job_name = "dnsmasq-exporter";
|
||||||
|
scrape_interval = "30s";
|
||||||
|
metrics_path = "/metrics";
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = ["${myvars.networking.hostsAddr.suzi.ipv4}:9153"];
|
||||||
|
labels.type = "app";
|
||||||
|
labels.app = "dnsmasq";
|
||||||
|
labels.host = "suzi";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
job_name = "v2ray-exporter";
|
||||||
|
scrape_interval = "30s";
|
||||||
|
metrics_path = "/metrics";
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = ["${myvars.networking.hostsAddr.aquamarine.ipv4}:9153"];
|
||||||
|
labels.type = "app";
|
||||||
|
labels.app = "v2ray";
|
||||||
|
labels.host = "aquamarine";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
job_name = "sftpgo-embedded-exporter";
|
||||||
|
scrape_interval = "30s";
|
||||||
|
metrics_path = "/metrics";
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = ["${myvars.networking.hostsAddr.aquamarine.ipv4}:10000"];
|
||||||
|
labels.type = "app";
|
||||||
|
labels.app = "sftpgo";
|
||||||
|
labels.host = "aquamarine";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
]
|
||||||
# --- Hosts --- #
|
# --- Hosts --- #
|
||||||
{
|
++ (
|
||||||
job_name = "node-exporter";
|
lib.attrsets.foldlAttrs
|
||||||
scrape_interval = "30s";
|
(acc: hostname: addr:
|
||||||
metrics_path = "/metrics";
|
acc
|
||||||
static_configs = [
|
++ [
|
||||||
{
|
{
|
||||||
# All my NixOS hosts.
|
job_name = "node-exporter-${hostname}";
|
||||||
targets =
|
scrape_interval = "30s";
|
||||||
map (addr: "${addr.ipv4}:9100")
|
metrics_path = "/metrics";
|
||||||
(builtins.attrValues myvars.networking.hostsAddr);
|
static_configs = [
|
||||||
labels.type = "node";
|
{
|
||||||
}
|
# All my NixOS hosts.
|
||||||
];
|
targets = ["${addr.ipv4}:9100"];
|
||||||
}
|
labels.type = "node";
|
||||||
|
labels.host = hostname;
|
||||||
# --- Homelab Applications --- #
|
}
|
||||||
|
];
|
||||||
{
|
}
|
||||||
job_name = "dnsmasq-exporter";
|
])
|
||||||
scrape_interval = "30s";
|
[]
|
||||||
metrics_path = "/metrics";
|
myvars.networking.hostsAddr
|
||||||
static_configs = [
|
);
|
||||||
{
|
|
||||||
targets = ["${myvars.networking.hostsAddr.suzi.ipv4}:9153"];
|
|
||||||
labels.type = "app";
|
|
||||||
labels.app = "dnsmasq";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
job_name = "v2ray-exporter";
|
|
||||||
scrape_interval = "30s";
|
|
||||||
metrics_path = "/metrics";
|
|
||||||
static_configs = [
|
|
||||||
{
|
|
||||||
targets = ["${myvars.networking.hostsAddr.aquamarine.ipv4}:9153"];
|
|
||||||
labels.type = "app";
|
|
||||||
labels.app = "v2ray";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
job_name = "sftpgo-embedded-exporter";
|
|
||||||
scrape_interval = "30s";
|
|
||||||
metrics_path = "/metrics";
|
|
||||||
static_configs = [
|
|
||||||
{
|
|
||||||
targets = ["${myvars.networking.hostsAddr.aquamarine.ipv4}:10000"];
|
|
||||||
labels.type = "app";
|
|
||||||
labels.app = "v2ray";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
# specifies Alertmanager instances the Prometheus server sends alerts to
|
# specifies Alertmanager instances the Prometheus server sends alerts to
|
||||||
# https://prometheus.io/docs/prometheus/latest/configuration/configuration/#alertmanager_config
|
# https://prometheus.io/docs/prometheus/latest/configuration/configuration/#alertmanager_config
|
||||||
|
|||||||
Reference in New Issue
Block a user