Skip to content
Snippets Groups Projects
Commit 199ce30f authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add check "httpd_methods"

parent 5189faa6
Branches
No related tags found
1 merge request!1526588 add couchdb check
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment