forked from pool/monitoring-plugins
7e6efb42c5
Enhancements General + using PRId64 and PRIu64 instead of %ld directly Single Plugins + check_http: Make faster with larger files + check_snmp: add 'multiplier' to modify current value + check_http: Implement chunked encoding decoding + check_http/check_curl: add chunked encoding test + check_log: Added --exclude to exclude patterns + check_log: Add tests + check_disk: Clarify usage possibilites Fixes General + fixed two PRId64 to PRIu64 in perfdata_uint64 Single Plugins + check_pgsql: Removing is_pg_dbname alltogether,using postgres API. + check_http: Remove superflous CRLF in HTTP-Requests + check_curl: detect ipv6 + check_icmp: fix parsing help/version long options + check_http: fix test plan + check_disk: Find accessible mount path if multiple are available + check_apt: Fix unknown escape sequence error output + check_curl: fix checking large bodys + check_snmp: Improve tests for check_snmp & multiply option + check_snmp: always apply format when applying multiplier + check_http: Use real booleans instead of ints + check_http: Document process_arguments a little bit better + check_http: Remove dead code + check_http: Fix several bug in the implementation of unchunking OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins?expand=0&rev=101
96 lines
3.4 KiB
Diff
96 lines
3.4 KiB
Diff
From d6bd787123aa9ccd96edec8286ec22dd0442c620 Mon Sep 17 00:00:00 2001
|
|
From: Michael Orlitzky <michael@orlitzky.com>
|
|
Date: Fri, 27 Oct 2017 07:58:43 -0400
|
|
Subject: [PATCH] plugins/check_mysql*.c: define our own default MySQL port.
|
|
|
|
The MYSQL_PORT constant used to be defined in mysql.h, and was used as
|
|
the default port in the two plugins check_mysql and check_mysql_query.
|
|
Now that mysql.h no longer defines that constant, our plugins fail to
|
|
build against newer versions of MySQL and MariaDB.
|
|
|
|
Since MYSQL_PORT used the "default port" on the local system, it
|
|
actually was not the best choice as the default for the check plugins:
|
|
when monitoring remote MySQL servers, the usual default of 3306 is
|
|
more likely to be correct than whatever the local server happens to be
|
|
listening on.
|
|
|
|
As a result, we fix the issue by defining our own constant, called
|
|
CHECK_PORT_DEFAULT, as "3306" at the top of both check_mysql.c and
|
|
check_mysql_query.c. The existing uses of MYSQL_PORT have been changed
|
|
to use the new CHECK_PORT_DEFAULT.
|
|
|
|
This change is backwards-incompatible: any users who compiled in a
|
|
MYSQL_PORT other than 3306 and who were running their checks on the
|
|
same server as the database will now need to specify that port
|
|
explicitly.
|
|
|
|
Closes: https://github.com/monitoring-plugins/monitoring-plugins/issues/1508
|
|
---
|
|
plugins/check_mysql.c | 8 ++++++--
|
|
plugins/check_mysql_query.c | 8 ++++++--
|
|
2 files changed, 12 insertions(+), 4 deletions(-)
|
|
|
|
Index: monitoring-plugins-2.3.3/plugins/check_mysql.c
|
|
===================================================================
|
|
--- monitoring-plugins-2.3.3.orig/plugins/check_mysql.c
|
|
+++ monitoring-plugins-2.3.3/plugins/check_mysql.c
|
|
@@ -35,6 +35,8 @@ const char *copyright = "1999-2011";
|
|
const char *email = "devel@monitoring-plugins.org";
|
|
|
|
#define SLAVERESULTSIZE 70
|
|
+/* The default port that MySQL servers listen on. */
|
|
+#define CHECK_PORT_DEFAULT 3306
|
|
|
|
#include "common.h"
|
|
#include "utils.h"
|
|
@@ -58,7 +60,7 @@ char *ciphers = NULL;
|
|
bool ssl = false;
|
|
char *opt_file = NULL;
|
|
char *opt_group = NULL;
|
|
-unsigned int db_port = MYSQL_PORT;
|
|
+unsigned int db_port = CHECK_PORT_DEFAULT;
|
|
int check_slave = 0, warn_sec = 0, crit_sec = 0;
|
|
int ignore_auth = 0;
|
|
int verbose = 0;
|
|
@@ -508,7 +510,7 @@ void
|
|
print_help (void)
|
|
{
|
|
char *myport;
|
|
- xasprintf (&myport, "%d", MYSQL_PORT);
|
|
+ xasprintf (&myport, "%d", CHECK_PORT_DEFAULT);
|
|
|
|
print_revision (progname, NP_VERSION);
|
|
|
|
Index: monitoring-plugins-2.3.3/plugins/check_mysql_query.c
|
|
===================================================================
|
|
--- monitoring-plugins-2.3.3.orig/plugins/check_mysql_query.c
|
|
+++ monitoring-plugins-2.3.3/plugins/check_mysql_query.c
|
|
@@ -33,6 +33,9 @@ const char *progname = "check_mysql_quer
|
|
const char *copyright = "1999-2007";
|
|
const char *email = "devel@monitoring-plugins.org";
|
|
|
|
+/* The default port that MySQL servers listen on. */
|
|
+#define CHECK_PORT_DEFAULT 3306
|
|
+
|
|
#include "common.h"
|
|
#include "utils.h"
|
|
#include "utils_base.h"
|
|
@@ -48,7 +51,7 @@ char *db_pass = NULL;
|
|
char *db = NULL;
|
|
char *opt_file = NULL;
|
|
char *opt_group = NULL;
|
|
-unsigned int db_port = MYSQL_PORT;
|
|
+unsigned int db_port = CHECK_PORT_DEFAULT;
|
|
|
|
int process_arguments (int, char **);
|
|
int validate_arguments (void);
|
|
@@ -299,7 +302,7 @@ void
|
|
print_help (void)
|
|
{
|
|
char *myport;
|
|
- xasprintf (&myport, "%d", MYSQL_PORT);
|
|
+ xasprintf (&myport, "%d", CHECK_PORT_DEFAULT);
|
|
|
|
print_revision (progname, NP_VERSION);
|
|
|