diff --git a/check_couchdb b/check_couchdb index 1c53b0f040eba31806b58fe2c9fbeded6e836d23..1164e6dd51f1b62c15403ac53668c15c0302f07c 100755 --- a/check_couchdb +++ b/check_couchdb @@ -18,11 +18,12 @@ # 2023-08-28 v0.3 <axel.hahn@unibe.ch> add check "replication" # 2023-08-28 v0.4 <axel.hahn@unibe.ch> add check "pending" # 2023-08-28 v0.5 <axel.hahn@unibe.ch> add checks "open_databases" + "open_os_files" +# 2023-08-28 v0.6 <axel.hahn@unibe.ch> add check "httpd_methods" # ====================================================================== . $(dirname $0)/inc_pluginfunctions -export self_APPVERSION=0.5 +export self_APPVERSION=0.6 cfgfile=/etc/icingaclient/.couchdb export RESPONSE @@ -55,6 +56,7 @@ OPTIONS: pending show count of pending updates for nodes, dbs and users open_databases show number of open databases open_os_files show number of file descriptors CouchDB has open + httpd_methods Show counters for http request methods EXAMPLE: $_self -m up @@ -173,10 +175,11 @@ case "${sMode}" in echo "Reponse: of ${REQ}"; echo "${RESPONSE}" | jq ;; - + # ............................................................ "open_databases"|"open_os_files") REQ=/_node/_local/_stats/couchdb/${sMode} abortOnWrongResponse "${REQ}" '"value":' + # descr=$( jq '.desc' <<< "${RESPONSE}" | tr -d '"') value=$( jq '.value' <<< "${RESPONSE}" ) ph.perfadd "${sMode}" "$value" "" "" @@ -186,6 +189,28 @@ case "${sMode}" in echo "${RESPONSE}" | jq ;; # ............................................................ + "httpd_methods") + REQ=/_node/_local/_stats/couchdb/httpd_request_methods + abortOnWrongResponse "${REQ}" '"value":' + + _status=$( jq 'with_entries(.value |= .value)' <<< "${RESPONSE}" ) + typeset -i _iValue + typeset -i _iDelta + + ph.status "Couchdb :: Http request methods" + echo " Method Counter Delta" + for myMethod in $( grep "[A-Z]" <<< "$_status" | cut -f 1 -d ':' | tr -d ' ' | tr -d '"') + do + + _iValue=$( grep "$myMethod" <<< "$_status" | cut -f 2 -d ':' | tr -d ',' ) + _iDelta=$( ph.perfdeltaspeed "couchdb-method-${myMethod}" $_iValue) + printf "%10s %10s %10s per sec\n" "$myMethod" $_iValue $_iDelta + ph.perfadd "${myMethod}" "$_iDelta" "" "" + done + + # echo "${_status}" | jq + ;; + # ............................................................ *) echo "ERRROR: [${sMode}] is an INVALID mode" showHelp