diff --git a/bin/monitor.sh b/bin/monitor.sh
index 50665ca7bb6201419b13d237849f686734c54bb9..312c4d7281f6429d6a2b4aa67b34745605edbd53 100755
--- a/bin/monitor.sh
+++ b/bin/monitor.sh
@@ -2,23 +2,14 @@
 
 if [ -z "${BFAHOME}" ]; then echo "\$BFAHOME not set. Did you source bfa/bin/env ?" >&2; exit 1; fi
 source ${BFAHOME}/bin/libbfa.sh || exit 1
+ERRTEXT="Monitoring failed"
 
 function json_query
 {
-  cmd=$1
-  params=$2
-  if [ -n "$params" ]
-  then
-    params=",\"parameters\":[$2]"
-  fi
-  json=$(
-    curl -s -H 'Content-type: application/json' -X POST --data "{\"jsonrpc\":\"2.0\",\"method\":\"${cmd}\"${params},\"id\":1}" http://127.0.0.1:$rpcport
-  )
-}
-
-function json_err
-{
-  echo "$json" | jq -r '.result'
+  local ERRTEXT="Monitoring RPC failed"
+  trap '' ERR
+  json=$( geth_rpc $* )
+  trap errtrap ERR
 }
 
 function json_arraylength
@@ -26,13 +17,9 @@ function json_arraylength
   jq -r length
 }
 
-function json_result
-{
-  echo "$json" | jq -r '.result'
-}
-
 json_query admin_peers
-numpeers=$( json_result | json_arraylength )
+test -n "${json}" || exit 0
+numpeers=$( echo $json | json_arraylength )
 statusfile=$( mktemp )
 cleanup     "${statusfile}"
 chmod 644   "${statusfile}"