diff --git a/check_psqlserver b/check_psqlserver
index b1cc02771e739e3605d615077b4479a2b1e05095..1dc096f728e6a93dd87a1d67815c19c498614375 100755
--- a/check_psqlserver
+++ b/check_psqlserver
@@ -143,7 +143,7 @@ EOH
 # param  string       database query
 function renderCounters(){
   local _query;      _query="$1"
-  local _out;        _out=$( psql -c "${_query} 2>&1") || _queryFailed
+  local _out;        _out=$( psql -c "${_query} " 2>&1) || _queryFailed
   local _iCounter;   typeset -i _iCounter=0
   local _header;     _header=$( echo "${_out}" | head -1 | tr -d ' ')
   local _data;       _data=$( echo "${_out}" | head -3 | tail -1 | tr -d ' ')
@@ -220,14 +220,20 @@ sMode=$(ph.getValueWithParam '' m "$@")
 
 case "${sMode}" in
     "activity")
-        _out=$( psql -c "select pid,usename,state,query,backend_type,backend_start from pg_stat_activity" ) || _queryFailed
-        typeset -i iQTotal;  iQTotal=$(  tail -1 <<< "$_out"  | cut -f 1 -d ' ' | tr -d '(' )
-        typeset -i iQActive; iQActive=$( awk '{ print $5 }' <<< "$_out" | grep -c "active"  )
-
-        descr="Running total: $iQTotal ... active: $iQActive"
-        out="${_out}${NL}"
-        ph.perfadd "running-total"  "${iQTotal}"
-        ph.perfadd "running-active" "${iQActive}"
+        _out=$( psql -c "select backend_type,state,query from pg_stat_activity" 2>&1 ) || _queryFailed
+        typeset -i iQTotal;    iQTotal=$(   tail -1 <<< "$_out"  | cut -f 1 -d ' ' | tr -d '(' )
+        typeset -i iQActive;   iQActive=$(  awk '{ print $4 }' <<< "$_out" | grep -c "active"  )
+        typeset -i iQIdle;     iQIdle=$(    awk '{ print $4 }' <<< "$_out" | grep -c "idle"  )
+        typeset -i iQFastpath; iQFastpath=$(awk '{ print $4 }' <<< "$_out" | grep -c "fastpath"  )
+        typeset -i iQOther;    iQOther=$iQTotal-$iQActive-$iQIdle-$iQFastpath
+
+        descr="Running total: $iQTotal ... active: $iQActive idle: $iQIdle fastpath: $iQFastpath other: $iQOther"
+        out=$( grep "^.[a-z]" <<< "${_out}" | cut -c 1-150 )
+        ph.perfadd "running-total"     "${iQTotal}"
+        ph.perfadd "running-active"    "${iQActive}"
+        ph.perfadd "running-idle"      "${iQIdle}"
+        ph.perfadd "running-fastpath"  "${iQFastpath}"
+        ph.perfadd "running-other"     "${iQOther}"
         ;;
     "conflicts")
         descr="Detected conflicts (from pg_stat_database_conflicts)"
@@ -267,7 +273,7 @@ case "${sMode}" in
             from pg_stat_database "
           ;;
     "replication")
-        _out=$( psql -c "select * from pg_stat_replication" ) || _queryFailed
+        _out=$( psql -c "select * from pg_stat_replication" 2>&1 ) || _queryFailed
         if tail -1 <<< "$_out"  | grep "(0 rows)" >/dev/null ; then
             descr="No data in pg_stat_replication - this is no slave."
             out=""