monitoring
This commit is contained in:
1 parent
decc501b3c
commit
8d55b87546
4 files changed
+340
-27
No files matched your search
@@ -1,15 +1,13 @@
|
||||
{ inputs, ... }: {
|
||||
# Every host: node + blackbox exporters scraped by a local Prometheus.
|
||||
# Hosts without services.monitoring run it in agent mode and push to https://metrics.<domain> (basic auth "push",
|
||||
# password in ~/.config/monitoring/password), buffering in the WAL while the server is unreachable.
|
||||
# Uptime probes go to every http(s) tunnel hostname of the server, labelled with the probing host (`from`).
|
||||
den.aspects.system.monitoring = {
|
||||
nixos = { config, lib, host, ... }: let
|
||||
name = config.networking.hostName;
|
||||
home = config.users.users.${host.owner}.home;
|
||||
ingress = lib.foldl' (a: t: a // t.ingress) { }
|
||||
(lib.attrValues inputs.self.nixosConfigurations.box.config.services.cloudflared.tunnels);
|
||||
targets = map (h: "https://${h}") (lib.attrNames (lib.filterAttrs (_: lib.hasPrefix "http") ingress));
|
||||
noProbe = [ "music" "monitor" "metrics" ];
|
||||
targets = map (h: "https://${h}") (lib.attrNames (lib.filterAttrs
|
||||
(n: v: lib.hasPrefix "http" v && !lib.elem (lib.head (lib.splitString "." n)) noProbe) ingress));
|
||||
nvidia = lib.elem "nvidia" config.services.xserver.videoDrivers;
|
||||
exp = config.services.prometheus.exporters;
|
||||
local = job: port: {
|
||||
@@ -21,13 +19,13 @@
|
||||
enable = true;
|
||||
enableAgentMode = lib.mkDefault true;
|
||||
listenAddress = "127.0.0.1";
|
||||
checkConfig = "syntax-only"; # credential files only exist at runtime
|
||||
checkConfig = "syntax-only";
|
||||
|
||||
exporters = {
|
||||
node = {
|
||||
enable = true;
|
||||
listenAddress = "127.0.0.1";
|
||||
enabledCollectors = [ "systemd" "drm" ]; # drm: amdgpu busy / vram
|
||||
enabledCollectors = [ "systemd" "drm" ];
|
||||
};
|
||||
|
||||
blackbox = {
|
||||
@@ -73,6 +71,8 @@
|
||||
}];
|
||||
};
|
||||
|
||||
systemd.services.prometheus-node-exporter.serviceConfig.ProtectHome = lib.mkForce "read-only";
|
||||
|
||||
systemd.services.prometheus.serviceConfig.LoadCredential =
|
||||
lib.mkIf config.services.prometheus.enableAgentMode [ "pw:${home}/.config/monitoring/password" ];
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user