2024-09-10 22:53:42 +07:00
|
|
|
{ config, lib, ... }:
|
|
|
|
let
|
|
|
|
ip = "10.88.222.222";
|
2024-09-24 11:42:11 +07:00
|
|
|
cfg = config.profile.podman;
|
|
|
|
inherit (lib) mkIf;
|
2024-09-10 22:53:42 +07:00
|
|
|
in
|
|
|
|
{
|
2024-10-21 12:31:30 +07:00
|
|
|
virtualisation.oci-containers.containers."metrics" =
|
|
|
|
mkIf (cfg.enable && config.profile.services.telemetry.enable)
|
|
|
|
{
|
|
|
|
image = "quay.io/navidys/prometheus-podman-exporter";
|
|
|
|
hostname = "metrics";
|
|
|
|
autoStart = true;
|
|
|
|
user = "0:0";
|
|
|
|
environment = {
|
|
|
|
TZ = "Asia/Jakarta";
|
|
|
|
CONTAINER_HOST = "unix:///run/podman/podman.sock";
|
|
|
|
};
|
|
|
|
volumes = [ "/run/podman/podman.sock:/run/podman/podman.sock" ];
|
|
|
|
extraOptions = [
|
|
|
|
"--network=podman"
|
|
|
|
"--ip=${ip}"
|
|
|
|
"--security-opt=label=disable"
|
|
|
|
];
|
|
|
|
labels = {
|
|
|
|
"io.containers.autoupdate" = "registry";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
environment.etc."alloy/config.alloy".text = # hcl
|
|
|
|
''
|
|
|
|
prometheus.scrape "podman" {
|
|
|
|
targets = [{__address__ = "${ip}:9882"}]
|
2024-09-10 22:53:42 +07:00
|
|
|
|
2024-10-21 12:31:30 +07:00
|
|
|
job_name = "podman"
|
2024-09-10 22:53:42 +07:00
|
|
|
|
2024-10-21 12:31:30 +07:00
|
|
|
forward_to = [prometheus.remote_write.mimir.receiver]
|
|
|
|
}
|
|
|
|
'';
|
2024-09-10 22:53:42 +07:00
|
|
|
}
|