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 @@
# 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.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
export self_APPVERSION=0.4
export self_APPVERSION=0.5
cfgfile=/etc/icingaclient/.couchdb
export RESPONSE
......@@ -42,16 +43,18 @@ SYNTAX:
$_self [-h] [-t FILE] -m MODE
OPTIONS:
-h or --help show this help.
-c CFGFILE set a custom config file
default: ${cfgfile}
-m MODE test a value; for debugging purposes the full json
response will be shown
MODE is one of
up show general couchdb status
replication show last replication status
pending show count of pending updates for nodes, dbs and users
-h or --help show this help.
-c CFGFILE set a custom config file
default: /etc/icingaclient/.couchdb
-m MODE test a value; for debugging purposes the full json
response will be shown
MODE is one of
up show general couchdb status
replication show last replication status
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:
$_self -m up
......@@ -122,7 +125,8 @@ case "${sMode}" in
ph.setStatus critical
fi
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")
......@@ -139,7 +143,8 @@ case "${sMode}" in
fi
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")
......@@ -165,7 +170,20 @@ case "${sMode}" in
done
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.
______________________________________________________________________
CHECK_COUCHDB
v0.4
v0.5
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
......@@ -32,16 +32,18 @@ SYNTAX:
check_couchdb [-h] [-t FILE] -m MODE
OPTIONS:
-h or --help show this help.
-c CFGFILE set a custom config file
default: /etc/icingaclient/.couchdb
-m MODE test a value; for debugging purposes the full json
response will be shown
MODE is one of
up show general couchdb status
replication show last replication status
pending show count of pending updates for nodes, dbs and users
-h or --help show this help.
-c CFGFILE set a custom config file
default: /etc/icingaclient/.couchdb
-m MODE test a value; for debugging purposes the full json
response will be shown
MODE is one of
up show general couchdb status
replication show last replication status
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:
check_couchdb -m 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