check_couchdb.md
check_couchdb
Introduction
Check couchdb status.
Requirements
- curl
- jq
- a running couchdb service
- authentication (see section Installation below)
Syntax
> check_couchdb -h
______________________________________________________________________
CHECK_COUCHDB
v0.3
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_couchdb.html
______________________________________________________________________
Show couchdb status.
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
EXAMPLE:
check_couchdb -m up
Check if couchdb is up and running
Installation
The check script by default sources a file /etc/icingaclient/.couchdb
.
It is a shell script with read permissions for the icinga user.
It contains a line with the url to couchdb
# ls -l /etc/icingaclient/.couchdb
-r--------. 1 icingaclient icingaclient 110 Aug 29 09:53 /etc/icingaclient/.couchdb
# cat /etc/icingaclient/.couchdb
export COUCH_URL=http://USERNAME:PASSWORD@localhost:5984
The variable COUCH_URL will be used to request status information.
With parameter -c CFGFILE
can define another location where to find the variable COUCH_URL.
Checks
With the parameter -m METHOD
you define what kind of check to perform.
up
Simple check if couchdb is up and running.
From url /up
it fetches the value status.
It switches to critical if one of the seeds is not "ok".
check_couchdb -m up
returns
OK: Couchdb status (value in /_up is 'ok')
Reponse:
{
"status": "ok", <<< checked value
"seeds": {
"couchdb@192.168.25.172": {
"timestamp": "2023-08-28T07:27:54.938619Z",
"last_replication_status": "ok",
"pending_updates": {
"_nodes": 0,
"_dbs": 0,
"_users": 0
}
},
"couchdb@192.168.25.61": {}
}
}
replication
From url /up
it fetches seeds -> [node] -> last_replication_status.
It switches to critical if one of the seeds is not "ok".
check_couchdb -m replication
returns
OK: Couchdb replication
Reponse:
{
"status": "ok",
"seeds": {
"couchdb@192.168.25.172": {
"timestamp": "2023-08-28T07:27:54.938619Z",
"last_replication_status": "ok", <<< checked value
"pending_updates": {
"_nodes": 0,
"_dbs": 0,
"_users": 0
}
},
"couchdb@192.168.25.61": {}
}
}