logo

munin-plugins

Collection of my custom munin pluginsgit clone https://hacktivis.me/git/munin-plugins.git

pleroma_oban (643B)


  1. #!/bin/sh
  2. # Copyright © 2022 Haelwenn (lanodan) Monnier
  3. # SPDX-License-Identifier: MIT
  4. : "${db_user:=pleroma}"
  5. : "${database:=pleroma_prod}"
  6. if [[ "$@" = *config* ]]; then
  7. echo 'graph_title Pleroma Oban status'
  8. echo 'graph_category pleroma'
  9. for state in $(psql -U "${db_user}" "${database}" --csv -c 'SELECT state FROM oban_jobs GROUP BY state;' | sed -n '2,$p' | sort); do
  10. echo "state_${state}.label ${state} jobs"
  11. echo "state_${state}.min 0"
  12. done
  13. else
  14. 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
  15. fi