From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- .../423473-nagiosplug-HEAD-mysql_noauth.patch | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 web/attachments/423473-nagiosplug-HEAD-mysql_noauth.patch (limited to 'web/attachments/423473-nagiosplug-HEAD-mysql_noauth.patch') diff --git a/web/attachments/423473-nagiosplug-HEAD-mysql_noauth.patch b/web/attachments/423473-nagiosplug-HEAD-mysql_noauth.patch new file mode 100644 index 0000000..e414423 --- /dev/null +++ b/web/attachments/423473-nagiosplug-HEAD-mysql_noauth.patch @@ -0,0 +1,74 @@ +diff -Naur nagiosplug/plugins/check_mysql.c nagiosplug.new/plugins/check_mysql.c +--- nagiosplug/plugins/check_mysql.c 2011-09-13 15:56:05.667051730 +0300 ++++ nagiosplug.new/plugins/check_mysql.c 2011-09-13 15:57:08.786832084 +0300 +@@ -42,6 +42,7 @@ + #include "netutils.h" + + #include ++#include + #include + + char *db_user = NULL; +@@ -51,6 +52,7 @@ + char *db = NULL; + unsigned int db_port = MYSQL_PORT; + int check_slave = 0, warn_sec = 0, crit_sec = 0; ++int ignore_auth = 0; + int verbose = 0; + + thresholds *my_threshold = NULL; +@@ -91,7 +93,16 @@ + + /* establish a connection to the server and error checking */ + if (!mysql_real_connect(&mysql,db_host,db_user,db_pass,db,db_port,db_socket,0)) { +- if (mysql_errno (&mysql) == CR_UNKNOWN_HOST) ++ if (ignore_auth && mysql_errno (&mysql) == ER_ACCESS_DENIED_ERROR) ++ { ++ printf("MySQL OK - Version: %s (protocol %d)\n", ++ mysql_get_server_info(&mysql), ++ mysql_get_proto_info(&mysql) ++ ); ++ mysql_close (&mysql); ++ return STATE_OK; ++ } ++ else if (mysql_errno (&mysql) == CR_UNKNOWN_HOST) + die (STATE_WARNING, "%s\n", mysql_error (&mysql)); + else if (mysql_errno (&mysql) == CR_VERSION_ERROR) + die (STATE_WARNING, "%s\n", mysql_error (&mysql)); +@@ -252,6 +263,7 @@ + {"critical", required_argument, 0, 'c'}, + {"warning", required_argument, 0, 'w'}, + {"check-slave", no_argument, 0, 'S'}, ++ {"ignore-auth", no_argument, 0, 'n'}, + {"verbose", no_argument, 0, 'v'}, + {"version", no_argument, 0, 'V'}, + {"help", no_argument, 0, 'h'}, +@@ -262,7 +274,7 @@ + return ERROR; + + while (1) { +- c = getopt_long (argc, argv, "hvVSP:p:u:d:H:s:c:w:", longopts, &option); ++ c = getopt_long (argc, argv, "hvVSnP:p:u:d:H:s:c:w:", longopts, &option); + + if (c == -1 || c == EOF) + break; +@@ -300,6 +312,9 @@ + case 'S': + check_slave = 1; /* check-slave */ + break; ++ case 'n': ++ ignore_auth = 1; /* ignore-auth */ ++ break; + case 'w': + warning = optarg; + break; +@@ -385,6 +400,9 @@ + printf (UT_EXTRA_OPTS); + + printf (UT_HOST_PORT, 'P', myport); ++ printf (" %s\n", "-n, --ignore-auth"); ++ printf (" %s\n", _("Ignore authentication failure and check for mysql connectivity only")); ++ + printf (" %s\n", "-s, --socket=STRING"); + printf (" %s\n", _("Use the specified socket (has no effect if -H is used)")); + -- cgit v1.2.3-74-g34f1