services/prometheus: collect ping metrics in enthalpy network
This commit is contained in:
parent
ac082d8fec
commit
71ed8b5ebb
|
@ -10,6 +10,7 @@
|
|||
++ (with profiles; [
|
||||
services.caddy
|
||||
services.prometheus.node-exporter
|
||||
services.prometheus.ping-exporter
|
||||
])
|
||||
++ (mylib.path.scanPaths ./. "default.nix");
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
++ (with profiles; [
|
||||
services.caddy
|
||||
services.prometheus.node-exporter
|
||||
services.prometheus.ping-exporter
|
||||
])
|
||||
++ (mylib.path.scanPaths ./. "default.nix");
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
services.knot.secondary
|
||||
services.ntfy
|
||||
services.prometheus.node-exporter
|
||||
services.prometheus.ping-exporter
|
||||
services.prometheus.server
|
||||
])
|
||||
++ (mylib.path.scanPaths ./. "default.nix");
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
services.caddy
|
||||
services.knot.primary
|
||||
services.prometheus.node-exporter
|
||||
services.prometheus.ping-exporter
|
||||
])
|
||||
++ (mylib.path.scanPaths ./. "default.nix");
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
services.caddy
|
||||
services.knot.secondary
|
||||
services.prometheus.node-exporter
|
||||
services.prometheus.ping-exporter
|
||||
])
|
||||
++ (mylib.path.scanPaths ./. "default.nix");
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
services.miniflux
|
||||
services.postgresql
|
||||
services.prometheus.node-exporter
|
||||
services.prometheus.ping-exporter
|
||||
services.well-known
|
||||
])
|
||||
++ (mylib.path.scanPaths ./. "default.nix");
|
||||
|
|
|
@ -34,6 +34,7 @@ in
|
|||
prometheus-alertmanager = 4061;
|
||||
prometheus-node-exporter = 4070;
|
||||
prometheus-blackbox-exporter = 4071;
|
||||
prometheus-ping-exporter = 4072;
|
||||
|
||||
# public ports
|
||||
enthalpy-wireguard-reimu-aston = 13101;
|
||||
|
|
46
nixos/profiles/services/prometheus/ping-exporter.nix
Normal file
46
nixos/profiles/services/prometheus/ping-exporter.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
common = import ../../../../zones/common.nix;
|
||||
enthalpyHosts = lib.filterAttrs (_name: value: value.enthalpy_node_address != null) common.hosts;
|
||||
targets = lib.mapAttrsToList (name: _value: "${name}.enta.rebmit.link") enthalpyHosts;
|
||||
in
|
||||
{
|
||||
services.prometheus.exporters.ping = {
|
||||
enable = true;
|
||||
listenAddress = "127.0.0.1";
|
||||
port = config.networking.ports.prometheus-ping-exporter;
|
||||
telemetryPath = "/ping";
|
||||
settings = {
|
||||
inherit targets;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.prometheus-ping-exporter = {
|
||||
inherit (config.networking.netns.enthalpy) serviceConfig;
|
||||
after = [ "netns-enthalpy.service" ];
|
||||
partOf = [ "netns-enthalpy.service" ];
|
||||
wantedBy = [ "netns-enthalpy.service" ];
|
||||
};
|
||||
|
||||
networking.netns.default.forwardPorts = lib.singleton {
|
||||
protocol = "tcp";
|
||||
netns = "enthalpy";
|
||||
source = "127.0.0.1:${toString config.networking.ports.prometheus-ping-exporter}";
|
||||
target = "127.0.0.1:${toString config.networking.ports.prometheus-ping-exporter}";
|
||||
};
|
||||
|
||||
services.caddy.virtualHosts."${config.networking.fqdn}" = {
|
||||
extraConfig = with config.services.prometheus.exporters.ping; ''
|
||||
route /ping {
|
||||
basic_auth {
|
||||
prometheus {$PROM_PASSWD}
|
||||
}
|
||||
reverse_proxy ${listenAddress}:${toString port}
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -74,6 +74,16 @@ in
|
|||
};
|
||||
static_configs = [ { inherit targets; } ];
|
||||
}
|
||||
{
|
||||
job_name = "ping";
|
||||
scheme = "https";
|
||||
metrics_path = "/ping";
|
||||
basic_auth = {
|
||||
username = "prometheus";
|
||||
password_file = config.sops.secrets."prometheus/password".path;
|
||||
};
|
||||
static_configs = [ { inherit targets; } ];
|
||||
}
|
||||
{
|
||||
job_name = "dns";
|
||||
scheme = "http";
|
||||
|
|
Loading…
Reference in a new issue