From f0dbcabf70f44b5748a83d2509476d0f02b1e3be Mon Sep 17 00:00:00 2001 From: =?utf8?q?Carsten=20K=C3=B6bke?= Date: Tue, 9 Aug 2016 13:47:16 +0200 Subject: [PATCH] ITL: Add db2_health CheckCommand definition fixes #12061 --- doc/7-icinga-template-library.md | 27 +++++++++ itl/plugins-contrib.d/databases.conf | 91 ++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) diff --git a/doc/7-icinga-template-library.md b/doc/7-icinga-template-library.md index 739ec398a..7e1257757 100644 --- a/doc/7-icinga-template-library.md +++ b/doc/7-icinga-template-library.md @@ -1794,6 +1794,33 @@ uncommenting the corresponding line in [icinga2.conf](4-configuring-icinga-2.md# All database plugins go in this category. +#### db2_health + +The plugin `db2_health` utilises Perl DBD::DB2. +For release tarballs and detailed documentation especially on the different modes and required permissions see [https://labs.consol.de](https://labs.consol.de/nagios/check_db2_health/). For development check [https://github.com](https://github.com/lausser/check_db2_health). + +Custom attributes passed as [command parameters](3-monitoring-basics.md#command-passing-parameters): + +Name | Description +---------------------------------|------------------------------------------------------------------------------------------------------------------------------ +db2_health_database | **Required.** The name of the database. (If it was catalogued locally, this parameter is the only you need. Otherwise you must specify database, hostname and port) +db2_health_username | **Optional.** The username for the database connection. +db2_health_password | **Optional.** The password for the database connection. +db2_health_port | **Optional.** The port where DB2 is listening. +db2_health_warning | **Optional.** The warning threshold depending on the mode. +db2_health_critical | **Optional.** The critical threshold depending on the mode. +db2_health_mode | **Required.** The mode uses predefined keywords for the different checks. For example "connection-time", "database-usage" or "sql". +db2_health_method | **Optional.** This tells the plugin how to connect to the database. The only method implemented yet is “dbi” which is the default. (It means, the plugin uses the perl module DBD::DB2). +db2_health_name | **Optional.** The tablespace, datafile, wait event, latch, enqueue depending on the mode or SQL statement to be executed with "db2_health_mode" sql. +db2_health_name2 | **Optional.** If "db2_health_name" is a sql statement, "db2_health_name2" can be used to appear in the output and the performance data. +db2_health_regexp | **Optional.** If set to true, "db2_health_name" will be interpreted as a regular expression. Defaults to false. +db2_health_units | **Optional.** This is used for a better output of mode=sql and for specifying thresholds for mode=tablespace-free. Possible values are "%", "KB", "MB" and "GB". +db2_health_maxinactivity | **Optional.** Used for the maximum amount of time a certain event has not happened. +db2_health_mitigation | **Optional.** Classifies the severity of an offline tablespace. +db2_health_lookback | **Optional.** How many days in the past db2_health check should look back to calculate exitcode. +db2_health_env_db2_home | **Required.** Specifies the location of the db2 client libraries as environment variable `DB2_HOME`. Defaults to "/opt/ibm/db2/V10.5". +db2_health_env_db2_version | **Optional.** Specifies the DB2 version as environment variable `DB2_VERSION`. + #### mssql_health The plugin `mssql_health` utilises Perl DBD::Sybase based on FreeTDS to connect to MSSQL databases for monitoring. diff --git a/itl/plugins-contrib.d/databases.conf b/itl/plugins-contrib.d/databases.conf index ef0e2f591..24b128bd5 100644 --- a/itl/plugins-contrib.d/databases.conf +++ b/itl/plugins-contrib.d/databases.conf @@ -246,6 +246,97 @@ object CheckCommand "mysql_health" { vars.mysql_health_hostname = "$check_address$" } +object CheckCommand "db2_health" { + import "plugin-check-command" + + command = [ PluginContribDir + "/check_db2_health" ] + + arguments = { + "--hostname" = { + value = "$db2_health_hostname$" + description = "the host to connect" + order = -2 + } + "--database" = { + value = "$db2_health_database$" + description = "the database to connect" + order = 0 + } + "--username" = { + value = "$db2_health_username$" + description = "the db2 user" + order = 1 + } + "--password" = { + value = "$db2_health_password$" + description = "the db2 user's password" + order = 2 + } + "--port" = { + value = "$db2_health_port$" + description = "the db2 port for connection" + order = -1 + } + "--warning" = { + value = "$db2_health_warning$" + description = "the warning range" + order = 5 + } + "--critical" = { + value = "$db2_health_critical$" + description = "the critical range" + order = 6 + } + "--mode" = { + value = "$db2_health_mode$" + description = "the mode of the plugin" + order = 3 + } + "--name" = { + value = "$db2_health_name$" + description = "the name of the tablespace, datafile, wait event, latch, enqueue, or sql statement depending on the mode" + order = 4 + } + "--name2" = { + value = "$db2_health_name2$" + description = "if name is a sql statement, name2 can be used to appear in the output and the performance data" + order = 7 + } + "--regexp" = { + set_if = "$db2_health_regexp$" + description = "name will be interpreted as a regular expression" + } + "--units" = { + value = "$db2_health_units$" + description = "This is used for a better output of mode=sql and for specifying thresholds for mode=tablespace-free" + } + "--maxinactivity" = { + value = "$db2_health_maxinactivity$" + description = "used for the maximum amount of time a certain event has not happened." + } + "--mitigation" = { + value = "$db2_health_mitigation$" + description = "let you classify the severity of an offline tablespace." + } + "--lookback" = { + value = "$db2_health_lookback$" + description = "How many days iin the past db2_health check should look back to calculate exitcode." + } + + } + + env = { + "DB2_HOME" = "$db2_health_env_db2_home$" + "DB2_VERSION" = "$db2_health_env_db2_version$" + } + + vars.db2_health_regexp = false + vars.db2_health_hostname = "$check_address$" + + vars.db2_health_env_db2_home = "/opt/ibm/db2/V10.5" + vars.db2_health_env_db2_version = "10.5" +} + object CheckCommand "oracle_health" { import "plugin-check-command" -- 2.40.0