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

update psql output

parent 74250085
No related branches found
No related tags found
1 merge request!112update psql output
...@@ -233,6 +233,9 @@ case "${sMode}" in ...@@ -233,6 +233,9 @@ case "${sMode}" in
typeset -i iQOther; iQOther=$iQTotal-$iQActive-$iQIdle-$iQFastpath typeset -i iQOther; iQOther=$iQTotal-$iQActive-$iQIdle-$iQFastpath
descr="Running total: $iQTotal ... active: $iQActive idle: $iQIdle fastpath: $iQFastpath other: $iQOther" descr="Running total: $iQTotal ... active: $iQActive idle: $iQIdle fastpath: $iQFastpath other: $iQOther"
out+="${NL}"
out+="Hint: Query for details:${NL}"
out+="select * from pg_stat_activity.${NL}"
# typeset -i iMax; iMax=20 # typeset -i iMax; iMax=20
# out=$( grep "^.[a-z]" <<< "${_out}" | cut -c 1-150 | tr '|' ':' | head -${iMax} ) # out=$( grep "^.[a-z]" <<< "${_out}" | cut -c 1-150 | tr '|' ':' | head -${iMax} )
# if [ ${iQTotal} -gt ${iMax} ]; then # if [ ${iQTotal} -gt ${iMax} ]; then
...@@ -247,7 +250,7 @@ case "${sMode}" in ...@@ -247,7 +250,7 @@ case "${sMode}" in
"conflicts") "conflicts")
deltaunit=min deltaunit=min
descr="(from pg_stat_database_conflicts)" descr=""
renderCounters "select \ renderCounters "select \
sum(confl_tablespace) as confl_tablespace, \ sum(confl_tablespace) as confl_tablespace, \
sum(confl_lock) as confl_lock, \ sum(confl_lock) as confl_lock, \
...@@ -260,15 +263,17 @@ case "${sMode}" in ...@@ -260,15 +263,17 @@ case "${sMode}" in
typeset -i iTotal; iTotal=$( echo "$out" | awk '{ sum+=$7} END { print sum;}' ) typeset -i iTotal; iTotal=$( echo "$out" | awk '{ sum+=$7} END { print sum;}' )
if [ $iTotal -gt 0 ]; then if [ $iTotal -gt 0 ]; then
ph.setStatus "critical" ph.setStatus "critical"
descr+=" ... $iTotal conflicts detected" descr+=" ... $iTotal per min conflicts detected"
else else
descr+=" ... OK, nothing was found" descr+=" ... OK, nothing was found"
fi fi
descr+=" - currently $iTotal per ${deltaunit}" out+="${NL}"
out+="Hint: Query for details per database:${NL}"
out+="select * from pg_stat_database_conflicts.${NL}"
;; ;;
"dbrows") "dbrows")
descr="Count of database row actions (from pg_stat_database)" descr="Count of database row actions"
renderCounters "select \ renderCounters "select \
sum(tup_returned) as tup_returned, \ sum(tup_returned) as tup_returned, \
sum(tup_fetched) as tup_fetched, \ sum(tup_fetched) as tup_fetched, \
...@@ -276,6 +281,9 @@ case "${sMode}" in ...@@ -276,6 +281,9 @@ case "${sMode}" in
sum(tup_updated) as tup_updated, \ sum(tup_updated) as tup_updated, \
sum(tup_deleted) as tup_deleted \ sum(tup_deleted) as tup_deleted \
from pg_stat_database " from pg_stat_database "
out+="${NL}"
out+="Hint: Query for details per database:${NL}"
out+="select * from pg_stat_database.${NL}"
;; ;;
"diskblock") "diskblock")
...@@ -284,6 +292,9 @@ case "${sMode}" in ...@@ -284,6 +292,9 @@ case "${sMode}" in
sum(blks_read) as blks_read, \ sum(blks_read) as blks_read, \
sum(blks_hit) as blks_hit \ sum(blks_hit) as blks_hit \
from pg_stat_database " from pg_stat_database "
out+="${NL}"
out+="Hint: Query for details per database:${NL}"
out+="select * from pg_stat_database.${NL}"
;; ;;
"problems") "problems")
...@@ -301,11 +312,13 @@ case "${sMode}" in ...@@ -301,11 +312,13 @@ case "${sMode}" in
typeset -i iTotal; iTotal=$( echo "$out" | awk '{ sum+=$7} END { print sum;}' ) typeset -i iTotal; iTotal=$( echo "$out" | awk '{ sum+=$7} END { print sum;}' )
if [ $iTotal -gt 0 ]; then if [ $iTotal -gt 0 ]; then
ph.setStatus "critical" ph.setStatus "critical"
descr+="... $iTotal Problems and troublemakers were found" descr+="... $iTotal (per min) Problems and troublemakers were found"
else else
descr+=" ... OK, nothing was found" descr+=" ... OK, nothing was found"
fi fi
descr+=" - currently $iTotal per ${deltaunit}" out+="${NL}"
out+="Hint: Query for details per database:${NL}"
out+="select * from pg_stat_database.${NL}"
;; ;;
"replication") "replication")
...@@ -359,15 +372,23 @@ case "${sMode}" in ...@@ -359,15 +372,23 @@ case "${sMode}" in
out+=$( echo "${_out}${NL}" | tr '|' ':' ) out+=$( echo "${_out}${NL}" | tr '|' ':' )
out+="${NL}"
out+="Hint: Query for details per replication:${NL}"
out+="select * from pg_stat_replication.${NL}"
fi fi
;; ;;
"transactions") "transactions")
descr="Count of transactions over all databases (from pg_stat_database)" descr="Count of transactions over all databases"
renderCounters "select \ renderCounters "select \
sum(xact_commit) as commit, \ sum(xact_commit) as commit, \
sum(xact_rollback) as rollback \ sum(xact_rollback) as rollback \
from pg_stat_database " from pg_stat_database "
out+="${NL}"
out+="Hint: Query for details per database:${NL}"
out+="select * from pg_stat_database.${NL}"
;; ;;
*) *)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment