commit: 78c738a92acb31b3a2700df1d925cf39c6f80bde
parent cbdd9591690dbb6c96c795e8fcde17c84d2dab02
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Mon, 4 Nov 2024 21:23:28 +0100
pleroma_oban: make user + database params configurable
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/pleroma_oban b/pleroma_oban
@@ -2,16 +2,17 @@
# Copyright © 2022 Haelwenn (lanodan) Monnier
# SPDX-License-Identifier: MIT
-DB="pleroma_prod2"
+: "${db_user:=pleroma}"
+: "${database:=pleroma_prod}"
if [[ "$@" = *config* ]]; then
echo 'graph_title Pleroma Oban status'
echo 'graph_category pleroma'
- for state in $(psql -U pleroma "${DB}" --csv -c 'SELECT state FROM oban_jobs GROUP BY state;' | sed -n '2,$p' | sort); do
+ for state in $(psql -U "${db_user}" "${database}" --csv -c 'SELECT state FROM oban_jobs GROUP BY state;' | sed -n '2,$p' | sort); do
echo "state_${state}.label ${state} jobs"
echo "state_${state}.min 0"
done
else
- psql -U pleroma "${DB}" --csv -c 'SELECT count(id), state FROM oban_jobs GROUP BY state;' | sed -n -E -e 's;^([0-9]*),(\w*)$;state_\2.value \1;' -e '2,$p' | sort
+ psql -U "${db_user}" "${database}" --csv -c 'SELECT count(id), state FROM oban_jobs GROUP BY state;' | sed -n -E -e 's;^([0-9]*),(\w*)$;state_\2.value \1;' -e '2,$p' | sort
fi