Page 1 of 1

Unable to install NRPE with MariaDB 10.2

Posted: Tue Mar 19, 2019 11:31 am
by PHQuentin
Hi Nagios User/Sys-Admin,

Firstly I want to congratulate you for the excellent work that you realized this year ! :-)

This topic is about an issue to install the NRPE on new cPanel server, we use this line to install it form a long time:

Code: Select all

wget https://assets.nagios.com/downloads/nagiosxi/agents/linux-nrpe-agent.tar.gz  -O /root/linux-nrpe-agent.tar.gz
cd /root/
tar -xzf /root/linux-nrpe-agent.tar.gz
cd /root/linux-nrpe-agent/
touch installed.firewall
./fullinstall --non-interactive
The error return is:

Code: Select all

make[3]: quittant le répertoire « /root/linux-nrpe-agent/subcomponents/nagiosplugins/nagios-plugins-2.2.1/lib/tests »
make[2]: quittant le répertoire « /root/linux-nrpe-agent/subcomponents/nagiosplugins/nagios-plugins-2.2.1/lib/tests »
make[1]: quittant le répertoire « /root/linux-nrpe-agent/subcomponents/nagiosplugins/nagios-plugins-2.2.1/lib »
Making install in plugins
make[1]: entrant dans le répertoire « /root/linux-nrpe-agent/subcomponents/nagiosplugins/nagios-plugins-2.2.1/plugins »
gcc -DLOCALEDIR=\"/usr/local/nagios/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/mysql  -DNP_VERSION='"2.2.1"' -I/usr/include/mysql -I/usr/include/mysql/mysql -g -O2 -MT check_mysql-check_mysql.o -MD -MP -MF .deps/check_mysql-check_mysql.Tpo -c -o check_mysql-check_mysql.o `test -f 'check_mysql.c' || echo './'`check_mysql.c
check_mysql.c:61: erreur: ‘MYSQL_PORT’ undeclared here (not in a function)
make[1]: *** [check_mysql-check_mysql.o] Erreur 1
make[1]: quittant le répertoire « /root/linux-nrpe-agent/subcomponents/nagiosplugins/nagios-plugins-2.2.1/plugins »
make: *** [install-recursive] Erreur 1

real	0m0.403s
user	0m0.325s
sys	0m0.057s
Subcomponents installation failed - exiting
RESULT=1

===================
INSTALLATION ERROR!
===================
Installation step failed - exiting.
Check for error messages in the install log (install.log).

If you require assistance in resolving the issue, please include install.log
in your communications with Nagios XI technical support.
The error look "check_mysql.c:61: erreur: ‘MYSQL_PORT’ undeclared here (not in a function)" look due to MariaDB10.2:

Code: Select all

[~/linux-nrpe-agent]# rpm -qa | grep MariaDB
MariaDB-compat-10.2.22-1.el6.x86_64
MariaDB-devel-10.2.22-1.el6.x86_64
MariaDB-client-10.2.22-1.el6.x86_64
MariaDB-server-10.2.22-1.el6.x86_64
MariaDB-shared-10.2.22-1.el6.x86_64
MariaDB-common-10.2.22-1.el6.x86_64
After some research I found those topic:

https://github.com/gentoo/gentoo/pull/5876
https://github.com/monitoring-plugins/m ... ssues/1508
https://github.com/nagios-plugins/nagio ... issues/288

I try to define MYSQL_PORT in /root/linux-nrpe-agent/subcomponents/nagiosplugins/nagios-plugins-2.2.1/plugins/check_mysql.c like this:

Code: Select all

sed -i 's/int db_port = MYSQL_PORT/int db_port = 3306/' /root/linux-nrpe-agent/subcomponents/nagiosplugins/nagios-plugins-2.2.1/plugins/check_mysql.c
But each time I launch "./fullinstall" it's overwrite this file....

Do you have a work-arround for this ?

Best regards,
Quentin

Re: Unable to install NRPE with MariaDB 10.2

Posted: Tue Mar 19, 2019 4:28 pm
by cdienger
Usually this variable is pulled from mysql_version.h which should be found even on systems with mariadb.

That said, you'll likely need to modify decompress /root/linux-nrpe-agent/subcomponents/nagiosplugins/nagios-plugins-2.2.1.tar.gz, edit the check_mysql.c found in it, and then compress it back into a tar.gz file before running ./fullinstall.

Re: Unable to install NRPE with MariaDB 10.2

Posted: Tue Mar 19, 2019 4:46 pm
by tgriep
When using the newer MariaDB package from Mariadb, they changed some settings in the header files which will cause the
check_mysql
and the
check_mysql_query
plugins to not compile.


To fix this, you can either go back to the default MariaDB packages or manually compile the plugins.

To manually compile the software, you will have to extract the plugins package, edit the c files and then run the XI install/
If the Nagios XI package is in the /tmp/nagiosxi folder, do the following

Code: Select all

cd /tmp/linux-nrpe-agent/subcomponents/nagiosplugins
tar xvfz nagios-plugins-2.2.1.tar.gz
cd nagios-plugins-2.2.1/plugins
Edit the check_mysql.c and check_mysql_query.c files and add the following line

Code: Select all

#include <server/private/custom_conf.h>
Below this line

Code: Select all

#include <errmsg.h>

Save the file and try installing the Agent.