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

Merge branch '6588-add-couchdb-check' into 'master'

6588 add couchdb check

See merge request !152
parents db03ee54 1c44ff54
No related branches found
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
......
......@@ -18,7 +18,7 @@ Check couchdb status.
______________________________________________________________________
CHECK_COUCHDB
v0.5
v0.6
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
......@@ -44,6 +44,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:
check_couchdb -m up
......@@ -204,3 +205,22 @@ Reponse: of /_node/_local/_stats/couchdb/open_os_files
}
|openosfiles=0;;
```
### httpd_methods
Show counters for http request methods.
``check_couchdb -m httpd_methods`` returns
```txt
OK: Couchdb :: Http request methods
Method Counter Delta
COPY 0 0 per sec
DELETE 1 0 per sec
GET 116122 1 per sec
HEAD 0 0 per sec
OPTIONS 0 0 per sec
POST 0 0 per sec
PUT 0 0 per sec
|copy=0;; delete=0;; get=1;; head=0;; options=0;; post=0;; put=0;;
```
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment