feat: prometheus + grafana
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
# Phase 2 — not active until imported in services/default.nix.
|
||||
# Activate by adding `./blackbox.nix` to hosts/AZ-PRM-1/services/monitoring/default.nix imports.
|
||||
{config, ...}: let
|
||||
blackboxPort = config.m3ta.ports.get "blackbox-exporter";
|
||||
prometheusPort = config.m3ta.ports.get "prometheus";
|
||||
in {
|
||||
services.prometheus.exporters.blackbox = {
|
||||
enable = true;
|
||||
port = blackboxPort;
|
||||
listenAddress = "127.0.0.1";
|
||||
openFirewall = false;
|
||||
configFile = (builtins.toFile "blackbox.yml" ''
|
||||
modules:
|
||||
http_2xx:
|
||||
prober: http
|
||||
timeout: 5s
|
||||
http_post_2xx:
|
||||
prober: http
|
||||
timeout: 5s
|
||||
http:
|
||||
method: POST
|
||||
icmp_ping:
|
||||
prober: icmp
|
||||
timeout: 5s
|
||||
tcp_connect:
|
||||
prober: tcp
|
||||
timeout: 5s
|
||||
'');
|
||||
};
|
||||
|
||||
services.prometheus.scrapeConfigs = [
|
||||
{
|
||||
job_name = "blackbox_http";
|
||||
metrics_path = "/probe";
|
||||
params.module = ["http_2xx"];
|
||||
static_configs = [
|
||||
{
|
||||
targets = [
|
||||
"https://g.l.az-gruppe.com"
|
||||
"https://wf.l.az-gruppe.com"
|
||||
"https://k.l.az-gruppe.com"
|
||||
"https://git.az-gruppe.com"
|
||||
"https://ping.az-gruppe.com"
|
||||
"https://llm.az-gruppe.com"
|
||||
"https://r.az-gruppe.com"
|
||||
];
|
||||
labels = {
|
||||
instance = "AZ-PRM-1-blackbox";
|
||||
};
|
||||
}
|
||||
];
|
||||
relabel_configs = [
|
||||
{
|
||||
source_labels = ["__address__"];
|
||||
target_label = "__param_target";
|
||||
}
|
||||
{
|
||||
source_labels = ["__param_target"];
|
||||
target_label = "target";
|
||||
}
|
||||
{
|
||||
target_label = "__address__";
|
||||
replacement = "localhost:${toString blackboxPort}";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
job_name = "blackbox_icmp";
|
||||
metrics_path = "/probe";
|
||||
params.module = ["icmp_ping"];
|
||||
static_configs = [
|
||||
{
|
||||
targets = [
|
||||
"100.91.203.184" # AZ-CLD-1 netbird
|
||||
"192.168.152.97" # SMB/DMS share
|
||||
"192.168.152.98" # SkriptHelper
|
||||
"192.168.152.102" # legacy PRTG (until decommissioned)
|
||||
"1.1.1.1" # upstream DNS reachability
|
||||
"8.8.8.8" # upstream DNS reachability
|
||||
];
|
||||
}
|
||||
];
|
||||
relabel_configs = [
|
||||
{
|
||||
source_labels = ["__address__"];
|
||||
target_label = "__param_target";
|
||||
}
|
||||
{
|
||||
source_labels = ["__param_target"];
|
||||
target_label = "target";
|
||||
}
|
||||
{
|
||||
target_label = "__address__";
|
||||
replacement = "localhost:${toString blackboxPort}";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user