From 9562018447931084a15959b609791dd80edc3f5f Mon Sep 17 00:00:00 2001 From: Ferdi Gueran Date: Mon, 27 Apr 2015 17:15:52 +0200 Subject: [PATCH] Add database CheckCommand definition for mongodb fixes #9191 Signed-off-by: Gunnar Beutner --- doc/7-icinga-template-library.md | 27 ++++++++++ itl/plugins-contrib.d/databases.conf | 80 ++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/doc/7-icinga-template-library.md b/doc/7-icinga-template-library.md index 7606b47e9..aa695d18b 100644 --- a/doc/7-icinga-template-library.md +++ b/doc/7-icinga-template-library.md @@ -1404,6 +1404,33 @@ postgres_production | **Optional.** Assume that the server is in production mod postgres_action | **Required.** Determines the test executed. postgres_unixsocket | **Optional.** If "postgres_unixsocket" is set to true the unix socket is used instead of an address. Defaults to false. +### mongodb + +The plugin `mongodb` utilises Python PyMongo. +For development check [https://github.com](https://github.com/mzupan/nagios-plugin-mongodb). + +Custom attributes passed as [command parameters](3-monitoring-basics.md#command-passing-parameters): + +Name | Description +---------------------------------|------------------------------------------------------------------------------------------------------------------------------ +mongodb_host | **Required.** Specifies the hostname or address. +mongodb_port | **Required.** The port mongodb is runnung on. +mongodb_user | **Optional.** The username you want to login as +mongodb_passwd | **Optional.** The password you want to use for that user +mongodb_warning | **Optional.** The warning threshold we want to set +mongodb_critical | **Optional.** The critical threshold we want to set +mongodb_action | **Required.** The action you want to take +mongodb_maxlag | **Optional.** Get max replication lag (for replication_lag action only) +mongodb_mappedmemory | **Optional.** Get mapped memory instead of resident (if resident memory can not be read) +mongodb_perfdata | **Optional.** Enable output of Nagios performance data +mongodb_database | **Optional.** Specify the database to check +mongodb_alldatabases | **Optional.** Check all databases (action database_size) +mongodb_ssl | **Optional.** Connect using SSL +mongodb_replicaset | **Optional.** Connect to replicaset +mongodb_querytype | **Optional.** The query type to check [query|insert|update|delete|getmore|command] from queries_per_second +mongodb_collection | **Optional.** Specify the collection to check +mongodb_sampletime | **Optional.** Time used to sample number of pages faults + ## IPMI Devices This category includes all plugins for IPMI devices. diff --git a/itl/plugins-contrib.d/databases.conf b/itl/plugins-contrib.d/databases.conf index 7025e02a0..ebe1f1e0e 100644 --- a/itl/plugins-contrib.d/databases.conf +++ b/itl/plugins-contrib.d/databases.conf @@ -303,3 +303,83 @@ object CheckCommand "postgres" { vars.postgres_production = false vars.postgres_unixsocket = false } + +object CheckCommand "mongodb" { + import "plugin-check-command" + + command = [ PluginDir + "/check_mongodb.py" ] + + arguments = { + "-H" = { + value = "$mongodb_address$" + description = "The hostname you want to connect to" + } + "-P" = { + value = "$mongodb_port$" + description = "The port mongodb is runnung on" + } + "-u" = { + value = "$mongodb_user$" + description = "The username you want to login as" + } + "-p" = { + value = "$mongodb_passwd$" + description = "The password you want to use for that user" + } + "-A" = { + value = "$mongodb_action$" + description = "The action you want to take" + } + "-c" = { + value = "$mongodb_collection$" + description = "Specify the collection to check" + } + "-T" = { + value = "$mongodb_sampletime$" + description = "Time used to sample number of pages faults" + } + "-q" = { + value = "$mongodb_querytype$" + description = "The query type to check [query|insert|update|delete|getmore|command] from queries_per_second" + } + "--database" = { + value = "$mongodb_database$" + description = "Specify the database to check" + } + "-D" = { + set_if = "$mongodb_perfdata$" + description = "Enable output of Nagios performance data" + } + "--max-lag" = { + set_if = "$mongodb_maxlag$" + description = "Get max replication lag (for replication_lag action only)" + } + "--mapped-memory" = { + set_if = "$mongodb_mappedmemory$" + description = "Get mapped memory instead of resident (if resident memory can not be read)" + } + "--ssl" = { + set_if = "$mongodb_ssl$" + description = "Connect using SSL" + } + "--replicaset" = { + set_if = "$mongodb_replicaset$" + description = "Connect to replicaset" + } + "--all-databases" = { + set_if = "$mongodb_alldatabases$" + description = "Check all databases (action database_size)" + } + "-C" = { + value = "$mongodb_critical$" + description = "The critical threshold we want to set" + } + "-W" = { + value = "$mongodb_warning$" + description = "The warning threshold we want to set" + } + } + + vars.mongodb_perfdata = true + vars.mongodb_action = "connections" +} -- 2.40.0