Commit 61542184ef17
Changed files (3)
systems
systems/aomi/openshift-port-forward.nix
@@ -73,6 +73,9 @@
# Allow Prometheus node exporter
tcp dport 9000 accept
+ # Allow Docker Prometheus metrics
+ tcp dport 9323 accept
+
# Allow libvirt
tcp dport 16509 accept
systems/common/services/docker.nix
@@ -10,6 +10,7 @@
userland-proxy = true;
experimental = true;
bip = "172.26.0.1/16";
+ metrics-addr = "0.0.0.0:9323";
features = {
buildkit = true;
};
@@ -28,4 +29,5 @@
environment.systemPackages = with pkgs; [ docker-buildx ];
networking.firewall.trustedInterfaces = [ "docker0" ];
networking.firewall.checkReversePath = false;
+ networking.firewall.allowedTCPPorts = [ 9323 ]; # Docker Prometheus metrics
}
systems/sakhalin/extra.nix
@@ -65,6 +65,19 @@ let
exportarrTargets = lib.mapAttrsToList (
_name: cfg: "rhea.sbr.pm:${toString cfg.port}"
) exportarrServices;
+
+ # Docker hosts with metrics enabled
+ dockerMachines = lib.filterAttrs (
+ _name: _machine:
+ builtins.elem _name [
+ "sakhalin"
+ "aomi"
+ ]
+ ) globals.machines;
+ dockerTargets = monitoring.mkPrometheusTargets {
+ machines = dockerMachines;
+ port = 9323;
+ };
in
{
@@ -259,6 +272,14 @@ in
metrics_path = "/api/prometheus";
bearer_token_file = config.age.secrets."homeassistant-prometheus-token".path;
}
+ {
+ job_name = "docker";
+ static_configs = [
+ {
+ targets = dockerTargets;
+ }
+ ];
+ }
];
};