]> granicus.if.org Git - icinga2/commitdiff
Add database CheckCommand definition for mongodb
authorFerdi Gueran <ferdi.gueran@nextevolution.de>
Mon, 27 Apr 2015 15:15:52 +0000 (17:15 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 28 Apr 2015 12:28:12 +0000 (14:28 +0200)
fixes #9191

Signed-off-by: Gunnar Beutner <gunnar@beutner.name>
doc/7-icinga-template-library.md
itl/plugins-contrib.d/databases.conf

index 7606b47e964dfb638845087c82c3b64c3bddc230..aa695d18b2713c90742528cfac01412063655ee6 100644 (file)
@@ -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.
 
+### <a id="plugins-contrib-command-mongodb"></a> 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
+
 ## <a id="plugins-contrib-ipmi"></a> IPMI Devices
 
 This category includes all plugins for IPMI devices.
index 7025e02a06495c6542e04419349b880f6cce25fb..ebe1f1e0ec6c1e2da5349211b7f79b6e53bcd2a3 100644 (file)
@@ -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"
+}