2024-08-01 09:01:53 +00:00
|
|
|
{ config, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.custom.prometheus;
|
|
|
|
immichEnv = config.services.immich.environment;
|
|
|
|
metricPort =
|
2024-08-25 09:45:58 +00:00
|
|
|
if builtins.hasAttr "IMMICH_API_METRICS_PORT" immichEnv then
|
|
|
|
immichEnv.IMMICH_API_METRICS_PORT
|
|
|
|
else
|
|
|
|
8081;
|
2024-08-01 09:01:53 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
config = lib.mkIf (cfg.enable && cfg.exporters.immich.enable) {
|
|
|
|
services.immich.environment = {
|
|
|
|
IMMICH_METRICS = "true";
|
|
|
|
};
|
|
|
|
|
|
|
|
services.prometheus.scrapeConfigs = [
|
|
|
|
{
|
|
|
|
job_name = "immich";
|
2024-08-25 09:45:58 +00:00
|
|
|
static_configs = [ { targets = [ "127.0.0.1:${toString metricPort}" ]; } ];
|
2024-08-01 09:01:53 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|