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

add checks "open_databases" + "open_os_files"

parent 2770f91c
No related branches found
No related tags found
1 merge request!1516588 add couchdb check - add checks "open_databases" + "open_os_files"
...@@ -17,11 +17,12 @@ ...@@ -17,11 +17,12 @@
# 2023-08-28 v0.2 <axel.hahn@unibe.ch> first check "up" # 2023-08-28 v0.2 <axel.hahn@unibe.ch> first check "up"
# 2023-08-28 v0.3 <axel.hahn@unibe.ch> add check "replication" # 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.4 <axel.hahn@unibe.ch> add check "pending"
# 2023-08-28 v0.5 <axel.hahn@unibe.ch> add checks "open_databases" + "open_os_files"
# ====================================================================== # ======================================================================
. $(dirname $0)/inc_pluginfunctions . $(dirname $0)/inc_pluginfunctions
export self_APPVERSION=0.4 export self_APPVERSION=0.5
cfgfile=/etc/icingaclient/.couchdb cfgfile=/etc/icingaclient/.couchdb
export RESPONSE export RESPONSE
...@@ -44,7 +45,7 @@ $_self [-h] [-t FILE] -m MODE ...@@ -44,7 +45,7 @@ $_self [-h] [-t FILE] -m MODE
OPTIONS: OPTIONS:
-h or --help show this help. -h or --help show this help.
-c CFGFILE set a custom config file -c CFGFILE set a custom config file
default: ${cfgfile} default: /etc/icingaclient/.couchdb
-m MODE test a value; for debugging purposes the full json -m MODE test a value; for debugging purposes the full json
response will be shown response will be shown
...@@ -52,6 +53,8 @@ OPTIONS: ...@@ -52,6 +53,8 @@ OPTIONS:
up show general couchdb status up show general couchdb status
replication show last replication status replication show last replication status
pending show count of pending updates for nodes, dbs and users 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
EXAMPLE: EXAMPLE:
$_self -m up $_self -m up
...@@ -122,7 +125,8 @@ case "${sMode}" in ...@@ -122,7 +125,8 @@ case "${sMode}" in
ph.setStatus critical ph.setStatus critical
fi fi
ph.status "Couchdb :: health status (value 'status' in ${REQ} is '$_status')" ph.status "Couchdb :: health status (value 'status' in ${REQ} is '$_status')"
echo "Reponse of ${REQ}: "; echo "${RESPONSE}" | jq echo "Reponse of ${REQ}: ";
echo "${RESPONSE}" | jq
;; ;;
# ............................................................ # ............................................................
"replication") "replication")
...@@ -139,7 +143,8 @@ case "${sMode}" in ...@@ -139,7 +143,8 @@ case "${sMode}" in
fi fi
ph.status "Couchdb :: replication (values 'last_replication_status' in ${REQ} are '$_status')" ph.status "Couchdb :: replication (values 'last_replication_status' in ${REQ} are '$_status')"
echo "Reponse: of ${REQ}"; echo "${RESPONSE}" | jq echo "Reponse: of ${REQ}";
echo "${RESPONSE}" | jq
;; ;;
# ............................................................ # ............................................................
"pending") "pending")
...@@ -165,7 +170,20 @@ case "${sMode}" in ...@@ -165,7 +170,20 @@ case "${sMode}" in
done done
ph.status "Couchdb :: pending updates: $_iTotal (values below 'pending_updates' in ${REQ})" ph.status "Couchdb :: pending updates: $_iTotal (values below 'pending_updates' in ${REQ})"
echo "Reponse: of ${REQ}"; echo "${RESPONSE}" | jq 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" "" ""
ph.status "Couchdb :: ${sMode} = $value"
# echo "$descr"
echo "Reponse: of ${REQ}";
echo "${RESPONSE}" | jq
;; ;;
# ............................................................ # ............................................................
*) *)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment