Skip to content
Snippets Groups Projects
Commit 1128af75 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

get summary for cronflicts and problems

parent 31a1a554
Branches
No related tags found
1 merge request!96get summary for cronflicts and problems
......@@ -15,6 +15,7 @@
# ----------------------------------------------------------------------
# 2023-06-07 v0.2 <axel.hahn@unibe.ch>
# 2023-06-08 v0.3 <axel.hahn@unibe.ch> show unknown if database connection fails
# 2023-06-08 v0.4 <axel.hahn@unibe.ch> get summary for cronflicts and problems
# ======================================================================
......@@ -235,6 +236,7 @@ case "${sMode}" in
ph.perfadd "running-fastpath" "${iQFastpath}"
ph.perfadd "running-other" "${iQOther}"
;;
"conflicts")
descr="Detected conflicts (from pg_stat_database_conflicts)"
renderCounters "select \
......@@ -244,7 +246,15 @@ case "${sMode}" in
sum(confl_bufferpin) as confl_bufferpin, \
sum(confl_deadlock) as confl_deadlock \
from pg_stat_database_conflicts "
;;
# sum of 7th column (with delta per sec)
typeset -i iTotal; iTotal=$( echo "$out" | awk '{ sum+=$7} END { print sum;}' )
if [ $iTotal -gt 0 ]; then
ph.setStatus "warning"
fi
descr+=" - currently $iTotal per sec"
;;
"dbrows")
descr="Count of database row actions (from pg_stat_database)"
renderCounters "select \
......@@ -255,13 +265,15 @@ case "${sMode}" in
sum(tup_deleted) as tup_deleted \
from pg_stat_database "
;;
"diskblock")
descr="Count of diskblocks physically read or coming from cache (from pg_stat_database)"
renderCounters "select \
sum(blks_read) as blks_read, \
sum(blks_hit) as blks_hit \
from pg_stat_database "
;;
;;
"problems")
descr="Problems and troublemakers (from pg_stat_database)"
renderCounters "select \
......@@ -271,7 +283,15 @@ case "${sMode}" in
sum(temp_files) as temp_files, \
sum(temp_bytes) as temp_bytes \
from pg_stat_database "
;;
# sum of 7th column (with delta per sec)
typeset -i iTotal; iTotal=$( echo "$out" | awk '{ sum+=$7} END { print sum;}' )
if [ $iTotal -gt 0 ]; then
ph.setStatus "warning"
fi
descr+=" - currently $iTotal per sec"
;;
"replication")
_out=$( psql -c "select * from pg_stat_replication" 2>&1 ) || _queryFailed
if tail -1 <<< "$_out" | grep "(0 rows)" >/dev/null ; then
......@@ -290,6 +310,7 @@ case "${sMode}" in
sum(xact_rollback) as rollback \
from pg_stat_database "
;;
*)
echo ERRROR: [${sMode}] is an INVALID mode
_usage
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment