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

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

6588 add couchdb check - add checks "open_databases" + "open_os_files"

See merge request !151
parents 3daa0754 5189faa6
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
;; ;;
# ............................................................ # ............................................................
*) *)
......
...@@ -18,7 +18,7 @@ Check couchdb status. ...@@ -18,7 +18,7 @@ Check couchdb status.
______________________________________________________________________ ______________________________________________________________________
CHECK_COUCHDB CHECK_COUCHDB
v0.4 v0.5
(c) Institute for Medical Education - University of Bern (c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3 Licence: GNU GPL 3
...@@ -42,6 +42,8 @@ OPTIONS: ...@@ -42,6 +42,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:
check_couchdb -m up check_couchdb -m up
...@@ -164,3 +166,41 @@ Reponse: of /_up ...@@ -164,3 +166,41 @@ Reponse: of /_up
} }
} }
``` ```
### open_databases
Show number of open databases
This check sends performance data.
``check_couchdb -m open_databases`` returns
```txt
OK: Couchdb :: open_databases = 0
Reponse: of /_node/_local/_stats/couchdb/open_databases
{
"value": 0,
"type": "counter",
"desc": "number of open databases"
}
|opendatabases=0;;
```
### open_os_files
Show number of file descriptors CouchDB has open
This check sends performance data.
``check_couchdb -m open_os_files`` returns
```txt
OK: Couchdb :: open_os_files = 0
Reponse: of /_node/_local/_stats/couchdb/open_os_files
{
"value": 0,
"type": "counter",
"desc": "number of file descriptors CouchDB has open"
}
|openosfiles=0;;
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment