This is an upstream problem, but just want to point out if using a recent version of mariadb: (link from here: https://github.com/monitoring-plugins/monitoring-plugins/issues/1508 ) After upgrading to MariaDB 10.2.8, these two plugins above no longer compile, both failing with the same error: x86_64-pc-linux-gnu-gcc -DLOCALEDIR="/usr/share/locale" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include -I/usr/include/mysql -I/usr/include/mysql/.. -DNP_VERSION='"2.2"' -I/usr/include/mysql -I/usr/include/mysql/.. -O2 -pipe -march=native -mtune=native -fno-strict-aliasing -c -o check_mysql-check_mysql.o test -f 'check_mysql.c' || echo './'check_mysql.c check_mysql.c:61:24: error: ‘MYSQL_PORT’ undeclared here (not in a function); did you mean ‘MYSQL_STMT’? unsigned int db_port = MYSQL_PORT; ^~~~~~~~~~ MYSQL_STMT make: *** [Makefile:1873: check_mysql-check_mysql.o] Error 1 tornado plugins # This is with monitoring-plugins 2.2 on a Gentoo Linux system (very up to date). It seems that MYSQL_PORT is no longer defined in the usual mysql headers, however it is defined in: mysql/server/private/custom_conf.h By adding this include: --- a/plugins/check_mysql.c 2017-09-09 10:48:45.725792432 +1000 +++ b/plugins/check_mysql.c 2017-09-09 10:40:53.173809026 +1000 @@ -44,6 +44,7 @@ #include <mysql.h> #include <mysqld_error.h> #include <errmsg.h> +#include <server/private/custom_conf.h> char *db_user = NULL; char *db_host = NULL; --- a/plugins/check_mysql_query.c 2017-09-09 10:50:15.969789263 +1000 +++ b/plugins/check_mysql_query.c 2017-09-09 10:41:24.869807913 +1000 @@ -40,6 +40,7 @@ #include <mysql.h> #include <errmsg.h> +#include <server/private/custom_conf.h> char *db_user = NULL; char *db_host = NULL; The two plugins then compile again. Can this - or a similar/better fix that perhaps deals with the case where this include does not exist - please be committed to the source tree? Or could we just remove the hard dependency on the definition of MYSQL_PORT so that this include is not required in the first place? Thanks, Reuben
Please do not use MYSQL_PORT. Instead use a 0 to have the library read from the my.cnf (or similar) file as noted in https://dev.mysql.com/doc/refman/5.5/en/mysql-real-connect.html The include makes the plugin non-portable and it has an incorrect value as well.
(In reply to tudor from comment #0) > --- a/plugins/check_mysql.c 2017-09-09 10:48:45.725792432 +1000 > +++ b/plugins/check_mysql.c 2017-09-09 10:40:53.173809026 +1000 > @@ -44,6 +44,7 @@ > #include <mysql.h> > #include <mysqld_error.h> > #include <errmsg.h> > +#include <server/private/custom_conf.h> > > char *db_user = NULL; > char *db_host = NULL; This will compile, but: # ./check_mysql --help -P, --port=INTEGER Port number (default: 5002)
https://github.com/gentoo/gentoo/pull/5876
*** Bug 635106 has been marked as a duplicate of this bug. ***
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0de961617a6ad772b0280838a8ab9d850846451a commit 0de961617a6ad772b0280838a8ab9d850846451a Author: Michael Orlitzky <mjo@gentoo.org> AuthorDate: 2017-10-27 12:41:16 +0000 Commit: Michael Orlitzky <mjo@gentoo.org> CommitDate: 2017-10-27 12:41:16 +0000 net-analyzer/monitoring-plugins: new revision to fix build failure with MariaDB. The latest -r2 adds a patch (which I've sent upstream) to fix a build failure against newer versions of MariaDB. Closes: https://bugs.gentoo.org/633548 Package-Manager: Portage-2.3.8, Repoman-2.3.3 .../files/define-own-mysql-port-constant.patch | 102 +++++++++++++++++++++ ...-r1.ebuild => monitoring-plugins-2.2-r2.ebuild} | 2 + 2 files changed, 104 insertions(+) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=20d288e5098552ca42a508f998eed6f2e5229e87 commit 20d288e5098552ca42a508f998eed6f2e5229e87 Author: Michael Orlitzky <mjo@gentoo.org> AuthorDate: 2017-10-27 12:37:56 +0000 Commit: Michael Orlitzky <mjo@gentoo.org> CommitDate: 2017-10-27 12:37:56 +0000 net-analyzer/nagios-plugins: new revision to fix build failure with MariaDB. The latest -r2 adds a patch (which I've sent upstream) to fix a build failure against newer versions of MariaDB. Bug: https://bugs.gentoo.org/633548 Bug: https://bugs.gentoo.org/635106 Package-Manager: Portage-2.3.8, Repoman-2.3.3 .../files/define-own-mysql-port-constant.patch | 100 +++++++++++++++++++++ ....1-r1.ebuild => nagios-plugins-2.2.1-r2.ebuild} | 2 + 2 files changed, 102 insertions(+)}