Add Immich user and library metrics dashboard

This commit is contained in:
feedc0de committed 2026-10-22 13:30:47 +02:00
1 parent b4ac38f251
commit ff3e41e856
7 files changed
+204 -8

No files matched your search

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ "$(kubectl config current-context)" != "kubernetes-admin@kubernetes" ]]; then
echo "Refusing to modify Immich PostgreSQL outside the homelab context." >&2
exit 1
fi
app_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
primary="$(kubectl --namespace immich get pods \
--selector='cnpg.io/cluster=immich-postgresql,cnpg.io/instanceRole=primary' \
--output=jsonpath='{.items[0].metadata.name}')"
if [[ -z "${primary}" ]]; then
echo "No Immich PostgreSQL primary is available." >&2
exit 1
fi
kubectl --namespace immich exec -i "${primary}" --container postgres -- \
psql --set=ON_ERROR_STOP=1 --username=postgres --dbname=immich \
< "${app_dir}/metrics-view.sql"