Skip to content
Snippets Groups Projects

couchdb "httpd_status_codes" show total requests per sec

Merged Hahn Axel (hahn) requested to merge docker-checks into master
1 file
+ 14
3
Compare changes
  • Side-by-side
  • Inline
+ 14
3
@@ -21,6 +21,7 @@
@@ -21,6 +21,7 @@
# 2023-08-28 v0.6 <axel.hahn@unibe.ch> add check "httpd_methods"
# 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.7 <axel.hahn@unibe.ch> add check "httpd"
# 2023-08-29 v0.8 <axel.hahn@unibe.ch> add check "httpd_status_codes"
# 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
. $(dirname $0)/inc_pluginfunctions
@@ -30,6 +31,9 @@ export self_APPVERSION=0.8
@@ -30,6 +31,9 @@ export self_APPVERSION=0.8
cfgfile=/etc/icingaclient/.couchdb
cfgfile=/etc/icingaclient/.couchdb
export RESPONSE
export RESPONSE
 
NL="
 
"
 
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# FUNCTIONS
# FUNCTIONS
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
@@ -200,16 +204,23 @@ case "${sMode}" in
@@ -200,16 +204,23 @@ case "${sMode}" in
# 204:0
# 204:0
# ...
# ...
ph.status "Couchdb :: Http status codes"
out=""
printf "%10s %10s %10s\n" "Status" "Counter" "Delta" | tr ' ' '_'
typeset -i iTotal=0
for myVar in $( grep "^[1-9]" <<< "$_status" | cut -f 1 -d ':' )
for myVar in $( grep "^[1-9]" <<< "$_status" | cut -f 1 -d ':' )
do
do
_iValue=$( grep "^$myVar:" <<< "$_status" | cut -f 2 -d ':' )
_iValue=$( grep "^$myVar:" <<< "$_status" | cut -f 2 -d ':' )
_label="couchdb-hs-${myVar//_/-}" # underscrore to minus
_label="couchdb-hs-${myVar//_/-}" # underscrore to minus
_iDelta=$( ph.perfdeltaspeed "${_label}" $_iValue)
_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" "" ""
ph.perfadd "http${myVar}" "$_iDelta" "" ""
done
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"
 
;;
;;
# ............................................................
# ............................................................
Loading