pleroma_oban (643B)
- #!/bin/sh
- # Copyright © 2022 Haelwenn (lanodan) Monnier
- # SPDX-License-Identifier: MIT
- : "${db_user:=pleroma}"
- : "${database:=pleroma_prod}"
- if [[ "$@" = *config* ]]; then
- echo 'graph_title Pleroma Oban status'
- echo 'graph_category pleroma'
- 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 "${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