diff --git a/check_couchdb b/check_couchdb index b50425b241a89e554445e580d2a52c319b12b4dc..1dbae7de834b55ef6e9c445b1ce46d83e84fc9d8 100755 --- a/check_couchdb +++ b/check_couchdb @@ -21,6 +21,7 @@ # 2023-08-28 v0.6 <axel.hahn@unibe.ch> add check "httpd_methods" # 2023-08-29 v0.7 <axel.hahn@unibe.ch> add check "httpd" # 2023-08-29 v0.8 <axel.hahn@unibe.ch> add check "httpd_status_codes" +# 2024-01-25 v0.9 <axel.hahn@unibe.ch> "httpd_status_codes" show total requests per sec # ====================================================================== . $(dirname $0)/inc_pluginfunctions @@ -30,6 +31,9 @@ export self_APPVERSION=0.8 cfgfile=/etc/icingaclient/.couchdb export RESPONSE +NL=" +" + # ---------------------------------------------------------------------- # FUNCTIONS # ---------------------------------------------------------------------- @@ -200,16 +204,23 @@ case "${sMode}" in # 204:0 # ... - ph.status "Couchdb :: Http status codes" - printf "%10s %10s %10s\n" "Status" "Counter" "Delta" | tr ' ' '_' + out="" + typeset -i iTotal=0 for myVar in $( grep "^[1-9]" <<< "$_status" | cut -f 1 -d ':' ) do _iValue=$( grep "^$myVar:" <<< "$_status" | cut -f 2 -d ':' ) _label="couchdb-hs-${myVar//_/-}" # underscrore to minus _iDelta=$( ph.perfdeltaspeed "${_label}" $_iValue) - printf "%10s %10s %10s per sec\n" "$myVar" $_iValue $_iDelta + iTotal+=$_iValue + out+="$( printf "%10s %10s %10s per sec\n" "$myVar" $_iValue $_iDelta )$NL" ph.perfadd "http${myVar}" "$_iDelta" "" "" done + _iTotalDelta=$( ph.perfdeltaspeed "couchdb-hs-total" $iTotal) + + ph.status "Couchdb :: Http status codes - requests per sec: $_iTotalDelta" + printf "%10s %10s %10s\n" "Status" "Counter" "Delta" | tr ' ' '_' + echo "$out" + ;; # ............................................................