From cdfc283395b3de1bc5502333586385bfbd0857de Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Sun, 1 Nov 2015 13:26:01 +0100 Subject: [PATCH] Add check command mysql fixes #10511 Signed-off-by: Michael Friedrich --- doc/7-icinga-template-library.md | 27 ++++++++++++++++++++++++ itl/command-plugins.conf | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/doc/7-icinga-template-library.md b/doc/7-icinga-template-library.md index 79bdd7b81..acd52100d 100644 --- a/doc/7-icinga-template-library.md +++ b/doc/7-icinga-template-library.md @@ -987,6 +987,33 @@ pgsql_query_warning | **Optional.** SQL query value to result in warning status pgsql_query_critical | **Optional.** SQL query value to result in critical status (double). +### mysql + +Check command object for the `check_mysql` plugin. + +Custom attributes passed as [command parameters](3-monitoring-basics.md#command-passing-parameters): + +Name | Description +------------------------|--------------------------------------------------------------- +mysql_hostname | **Optional.** Host name, IP Address, or unix socket (must be an absolute path). +mysql_port | **Optional.** Port number (default: 3306). +mysql_ignore_auth | **Optional.** Ignore authentication failure and check for mysql connectivity only. +mysql_database | **Optional.** Check database with indicated name. +mysql_file | **Optional.** Read from the specified client options file. +mysql_group | **Optional.** Use a client options group. +mysql_username | **Optional.** Connect using the indicated username. +mysql_password | **Optional.** Use the indicated password to authenticate the connection. +mysql_check_slave | **Optional.** Check if the slave thread is running properly. +mysql_warning | **Optional.** Exit with WARNING status if slave server is more than INTEGER seconds behind master. +mysql_critical | **Optional.** Exit with CRITICAL status if slave server is more then INTEGER seconds behind master. +mysql_ssl | **Optional.** Use ssl encryptation. +mysql_cacert | **Optional.** Path to CA signing the cert. +mysql_cert | **Optional.** Path to SSL certificate. +mysql_key | **Optional.** Path to private SSL key. +mysql_cadir | **Optional.** Path to CA directory. +mysql_ciphers | **Optional.** List of valid SSL ciphers. + + ## Windows Plugins for Icinga 2 To allow a basic monitoring of Windows clients Icinga 2 comes with a set of Windows only plugins. While trying to mirror the functionalities of their linux cousins from the monitoring-plugins package, the differences between Windows and Linux are too big to be able use the same CheckCommands for both systems. diff --git a/itl/command-plugins.conf b/itl/command-plugins.conf index a46580b68..06931b3ef 100644 --- a/itl/command-plugins.conf +++ b/itl/command-plugins.conf @@ -1667,3 +1667,38 @@ object CheckCommand "pgsql" { vars.pgsql_hostname = "$check_address$" } +object CheckCommand "mysql" { + import "plugin-check-command" + import "ipv4-or-ipv6" + + command = [ PluginDir + "/check_mysql" ] + + arguments = { + "-H" = "$mysql_hostname$" + "-P" = "$mysql_port$" + "-n" = { + set_if = "$mysql_ignore_auth$" + } + "-s" = "$mysql_socket$" + "-d" = "$mysql_database$" + "-f" = "$mysql_file$" + "-g" = "$mysql_group$" + "-u" = "$mysql_username$" + "-p" = "$mysql_password$" + "-S" = { + set_if = "$mysql_check_slave$" + } + "-w" = "$mysql_warning$" + "-c" = "$mysql_critical$" + "-l" = { + set_if = "$mysql_ssl$" + } + "-C" = "$mysql_cacert$" + "-a" = "$mysql_cert$" + "-k" = "$mysql_key$" + "-D" = "$mysql_cadir$" + "-L" = "$mysql_ciphers$" + } + + vars.mysql_hostname = "$check_address$" +}