Header RSS Feed
 
» Monitoring Plugins

Monitoring Plugin: check_couchdb_replication

Last Update: January 08, 2018

This is a plugin to monitor the status of CouchDB replications. Use the -d parameter to list all available replications and monitor them with -r parameter.

Jump to...
Download
Version History
Requirements
Definition of parameters
Command definition
Nagios and Icinga 1 service definition examples
Icinga 2 service definition examples
Screenshots

------------------------

Download
Download check_couchdb_replication check_couchdb_replication.sh
Download plugin and save it in your Nagios/Icinga plugin folder (e.g. /usr/local/nagios/libexec)
Contribute on https://github.com/Napsty/check_couchdb_replication
8 downloads so far...

------------------------

Version History
# 20180105: Created plugin
# 20180108: Added -d detection

------------------------

Requirements
- curl command (SUSE: zypper in curl, Debian/Ubuntu: apt-get install curl)
- jshon command (SUSE: search for jshon, Debian/Ubuntu: apt-get install jshon)
- Other bash relevant commands as tr (plugin checks for its existance)

------------------------

Definition of parameters

Parameter Description
-H * Hostname or ip address of CouchDB Host (or Cluster IP)
-P Port (defaults to 5984)
-S Use https
-u Username if authentication is required
-p Password if authentication is required
-r ** Replication ID to monitor (doc_id)
-d Dynamically detect and list all available replications
-h Help!

*-H is mandatory for all ways of running the script
**-r is mandatory to check a defined replication (doc_id)

------------------------

Usage

Here are some examples when the plugin is run on the command line.

Check the status of replication "rep_db1":

# ./check_couchdb_replication.sh -H mycouchdb.example.com -u admin -p mysecretpass -r "rep_db1"
COUCHDB REPLICATION OK - Replication rep_db1 is "running"

If there is no such replication with this doc_id (rep_db1), the plugin will return:

# ./check_couchdb_replication.sh -H mycouchdb.example.com -u admin -p mysecretpass -r "rep_db3"
COUCHDB REPLICATION CRITICAL - Replication for rep_db3 not found

If you're not sure or you forgot the name (doc_id) of a replication, run the plugin with the -d (detect) parameter:

# ./check_couchdb_replication.sh -H mycouchdb.example.com -d
COUCHDB AVAILABLE REPLICATIONS: "rep_db1" "rep_db2"

In the background, the plugin uses "/_active_tasks" the find the available replications.

------------------------

Command definition in Nagios and Icinga 1

# 'check_couchdb_replication' command definition
define command{
command_name check_couchdb_replication
command_line $USER1$/check_couchdb_replication.sh -H $ARG1$ -u $ARG2$ -p $ARG3$ -r $ARG4$
}

Command definition in Icinga 2

object CheckCommand "check_couchdb_replication" {
  import "plugin-check-command"
  command = [ PluginContribDir + "/check_couchdb_replication.sh" ]

   arguments = {
      "-H" = {
        value = "$couchdb_address$"
        description = "Hostname or IP Address of CouchDB host or cluster"
      }

      "-P" = {
        value = "$couchdb_port$"
        description = "Port number (default: 5984)"
      }

      "-S" = {
        set_if = "$couchdb_ssl$"
        description = "Use https"
      }

      "-u" = {
        value = "$couchdb_user$"
        description = "Username if authentication is required"
      }

      "-p" = {
        value = "$couchdb_password$"
        description = "Password if authentication is required"
      }

      "-d" = {
        set_if = "$couchdb_detect_replications$"
        description = "Detect and list available replications to monitor (should not be used in Icinga2, only on command line)"
      }

      "-r" = {
        value = "$couchdb_replication$"
        description = "Replication ID to monitor (doc_id)"
      }
  }

  vars.couchdb_address = "$address$"
  vars.couchdb_port = "5984"
}

------------------------

Nagios and Icinga 1 service check examples

# Check CouchDB Replication db1
define service{
  use generic-service
  host_name mycouchdb
  service_description CouchDB Replication DB1
  check_command check_couchdb_replication!mycouchdb!admin!password!rep_db1
}

In this example, the plugin checks for the current status of the replication with the "doc_id" of "rep_db1". If the status is not "running", the script will exit with a CRITICAL status and returns the current status of the replication.

------------------------

Icinga 2 service check examples

# Check CouchDB Replication db1
object Service "CouchDB Replication DB1" {
  import "generic-service"
  host_name = "mycouchdb"
  check_command = "check_chouchdb_replication"
  vars.couchdb_user = "admin"
  vars.couchdb_password = "password"
  vars.couchdb_replication = "rep_db1"
}

In this example, the plugin checks for the current status of the replication with the "doc_id" of "rep_db1". If the status is not "running", the script will exit with a CRITICAL status and returns the current status of the replication.

------------------------

Screenshots


Go to Homepage home
Linux Howtos how to's
Monitoring Plugins monitoring plugins
Links links

Valid HTML 4.01 Transitional
Valid CSS!
[Valid RSS]

7301 Days
until Death of Computers
Why?