check_nrpe!check_cpu failing on new CentOS8 Server

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

check_nrpe!check_cpu failing on new CentOS8 Server

Post by mccrakem »

Hi

We are testing Nagios Agent on CentOS8 and I have come across 1 issue
I have tried a few thing but nothing seems to have corrected the problem

If I go to Configure, Core Configure manager and then Services
I goto one of the servers that the check_cpu monitor works on

So the command is basically
Check Command = check_nrpe
$ARG1$ = check-cpu

so if I click on the "Test Check Command" Button
and paste in one of our RHEL6 Servers I get the following details
COMMAND: /usr/local/nagios/libexec/check_nrpe -H bwylbopjiras02 -t 30 -c check_cpu
OUTPUT: DM-CPU OK - Idle=98.25% | user=1.05%;60;70 nice=0.00%;60;70 system=0.60%;60;70 idle=98.25%;100;100 iowait=0.10%;80;90 irq=0.00%;60;70 softirq=0.00%;60;70


If I Do the same but specify the hostname of the new CentOS 8 Server I just get the following
COMMAND: /usr/local/nagios/libexec/check_nrpe -H dwylbopsndbx14 -t 30 -c check_cpu
OUTPUT: NRPE: Unable to read output


The two systems have both got the same configuration of the nrpe.cfg files
On the new CentOS 8 system we have 4 monitors configured

/Disk Usage This is configured as - check_nrpe check_disk
Load This is configured as - check_nrpe check_load
Memory Usage This is configured as - check_nrpe check_mem

These 3 work fine so this is why I am puzzled

any help would be appreciated

Thanks
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Re: check_nrpe!check_cpu failing on new CentOS8 Server

Post by mccrakem »

Sorry just a quick question came to mind
Is there any prerequisites that need to be installed for the nagios Agent to work correctly ?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_nrpe!check_cpu failing on new CentOS8 Server

Post by lmiltchev »

Did you follow the document below when installing the Linux agent on your CentOS 8 machine?

https://assets.nagios.com/downloads/nag ... _Agent.pdf
Is there any prerequisites that need to be installed for the nagios Agent to work correctly ?
I didn't have any issues with installing the agent on CentOS 8. The installer script should take care of prerequisites. Having said that, I would like to mention that the command that is created is "check_cpu_stats", not "check_cpu". It is added to the common.cfg file.

Example:
On the client

Code: Select all

command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$
On the server

Code: Select all

[root@main-nagios-xi ~]# /usr/local/nagios/libexec/check_nrpe -u -H 192.168.x.x -t 60 -c check_cpu_stats -a '-w 85 -c 95'
CPU STATISTICS OK: user=0.00% system=0.20% iowait=0.00% idle=99.80% | user=0.0% system=0.0% iowait=0.0%;85;95 idle=99.80%
Can you post the nrpe.cfg and common.cfg files from the client on the forum?

Also, run the following commands on the Nagios XI server from the command line, and show the output:

Code: Select all

ip addr
/usr/local/nagios/libexec/check_nrpe -H dwylbopsndbx14
/usr/local/nagios/libexec/check_nrpe -H <ip address of dwylbopsndbx14>
/usr/local/nagios/libexec/check_nrpe -H <ip address of dwylbopsndbx14> -t 60 -c check_cpu_stats -a '-w 85 -c 95'
Be sure to check out our Knowledgebase for helpful articles and solutions!
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Re: check_nrpe!check_cpu failing on new CentOS8 Server

Post by mccrakem »

Hi
Sorry turns out the test system I have been given is a Red Hat 8 and not a CentOS8
The previous systems was CentOS8 but I cannot modify that system

I have done a search for common.cfg but no files where found on the system
So I got a test system and uninstalled the version of Nagios Agent
and then followed the link above to download and do a install

But when I run the ./fullinstall command I get the following message

[root@dwylbopsndbx19 linux-nrpe-agent]# ./fullinstall
RedHatEnterprise is not currently supported. Please use either Red Hat, CentOS, Oracle Linux, CloudLinux, SUSE Enterprise, OpenSUSE, Ubuntu, or Debian.
[root@dwylbopsndbx19 linux-nrpe-agent]#

[root@dwylbopsndbx19 linux-nrpe-agent]# lsb_release -i -r
Distributor ID: RedHatEnterprise
Release: 8.1


The Linux team install the agent via puppet code but when I reinstalled the agent I did get the following message

Notice: /Stage[main]/Opnagios::Profile::Nagios_agent/Package[nrpe]/ensure: created
Error: Execution of '/usr/bin/yum -d 0 -e 0 -y install nagios-plugins-lcgdm-common' returned 1:
Error: /Stage[main]/Opnagios::Profile::Nagios_agent/Package[nagios-plugins-lcgdm-common]/ensure: change from purged to present failed: Execution of '/usr/bin/yum -d 0 -e 0 -y install nagios-plugins-lcgdm-common' returned 1:

Thanks
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_nrpe!check_cpu failing on new CentOS8 Server

Post by lmiltchev »

So I got a test system and uninstalled the version of Nagios Agent
and then followed the link above to download and do a install

But when I run the ./fullinstall command I get the following message

[root@dwylbopsndbx19 linux-nrpe-agent]# ./fullinstall
RedHatEnterprise is not currently supported. Please use either Red Hat, CentOS, Oracle Linux, CloudLinux, SUSE Enterprise, OpenSUSE, Ubuntu, or Debian.
I think this is a bug in our installer, as it checks for the output of "lsb_release -si" first, but then the "RedHatEnterprise" option is not included as a supported distro... I didn't have "lsb_release" on my test RHEL 8 system, so the installer worked for me. Anyway, I will be notifying our developers of the issue. Meanwhile, you can modify the "fullinstall" script by changing line 87 from this:

Code: Select all

if [ "$distro" == "CentOS" ] || [ "$distro" == "RedHatEnterpriseServer" ]; then
to this:

Code: Select all

if [ "$distro" == "CentOS" ] || [ "$distro" == "RedHatEnterpriseServer" ] || [ "$distro" == "RedHatEnterprise" ]; then
Save, exit. Now the installer should work, provided you installed dev tools.

Code: Select all

dnf group install "Development Tools"
FYI, here's the repos I have on my test box:

Code: Select all

[root@TEST_XI_RHEL_8 linux-nrpe-agent]# yum repolist
Updating Subscription Management repositories.
Last metadata expiration check: 0:11:24 ago on Thu 09 Apr 2020 12:56:47 PM EDT.
repo id                                                repo name                                                                      status
*epel                                                  Extra Packages for Enterprise Linux 8 - x86_64                                 5,219
*epel-modular                                          Extra Packages for Enterprise Linux Modular 8 - x86_64                             0
rhel-8-for-x86_64-appstream-rpms                       Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)                       8,820
rhel-8-for-x86_64-baseos-rpms                          Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)                          3,801
just to give you an idea of my test environment. Hope this helps.
The Linux team install the agent via puppet code but when I reinstalled the agent I did get the following message

Notice: /Stage[main]/Opnagios::Profile::Nagios_agent/Package[nrpe]/ensure: created
Error: Execution of '/usr/bin/yum -d 0 -e 0 -y install nagios-plugins-lcgdm-common' returned 1:
Error: /Stage[main]/Opnagios::Profile::Nagios_agent/Package[nagios-plugins-lcgdm-common]/ensure: change from purged to present failed: Execution of '/usr/bin/yum -d 0 -e 0 -y install nagios-plugins-lcgdm-common' returned 1:
This is out of scope of Nagios support. You would need to remove all of the custom packages installed by puppet and try our official installer.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Re: check_nrpe!check_cpu failing on new CentOS8 Server

Post by mccrakem »

Hi

I have just edited the fullinstall script and added the line you mentioned
But now when I run the Fullinstall script I got the following message

Nagios Linux Agent Installation Log
===================================
DATE: Wed Apr 15 03:54:15 EDT 2020

DISTRO INFO:
RedHatEnterprise
8.1
x86_64

Configuring Repos...
Repos configured OK
Installing prerequisites...
Prerequisites installed OK
Adding users and groups...
useradd: user 'nagios' already exists
groupadd: group 'nagios' already exists
useradd: user 'nagios' already exists
Users and groups added OK
/etc/services updated
Firewall rules updated OK
SUB
NAGIOSPLUGINS
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to disable maintainer-specific portions of Makefiles... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/tmp/linux-nrpe-agent/subcomponents/nagiosplugins/nagios-plugins-2.2.1':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

real 0m7.385s
user 0m0.136s
sys 0m0.150s
make: *** No rule to make target 'clean'. Stop.

real 0m0.003s
user 0m0.001s
sys 0m0.002s
make: *** No targets specified and no makefile found. Stop.

real 0m0.003s
user 0m0.003s
sys 0m0.000s
make: *** No rule to make target 'install'. Stop.

real 0m0.003s
user 0m0.001s
sys 0m0.001s

real 0m7.840s
user 0m0.225s
sys 0m0.287s
Subcomponents installation failed - exiting


Thanks
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Re: check_nrpe!check_cpu failing on new CentOS8 Server

Post by mccrakem »

The config.log file basically gives the same message

## ----------- ##
## Core tests. ##
## ----------- ##

configure:3173: checking for a BSD-compatible install
configure:3241: result: /usr/bin/install -c
configure:3252: checking whether build environment is sane
configure:3312: result: yes
configure:3453: checking for a thread-safe mkdir -p
configure:3492: result: /usr/bin/mkdir -p
configure:3505: checking for gawk
configure:3521: found /usr/bin/gawk
configure:3532: result: gawk
configure:3543: checking whether make sets $(MAKE)
configure:3565: result: yes
configure:3648: checking whether to disable maintainer-specific portions of Makefiles
configure:3657: result: yes
configure:3678: checking build system type
configure:3696: result: x86_64-unknown-linux-gnu
configure:3718: checking host system type
configure:3733: result: x86_64-unknown-linux-gnu
configure:3840: checking for gcc
configure:3870: result: no
configure:3933: checking for cc
configure:3980: result: no
configure:4036: checking for cl.exe
configure:4066: result: no
configure:4090: error: in `/tmp/linux-nrpe-agent/subcomponents/nagiosplugins/nagios-plugins-2.2.1':
configure:4093: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_nrpe!check_cpu failing on new CentOS8 Server

Post by lmiltchev »

Did you install the dev tools, prior to running the installer script?

Code: Select all

dnf group install "Development Tools"
Be sure to check out our Knowledgebase for helpful articles and solutions!
mccrakem
Posts: 129
Joined: Mon Jun 19, 2017 8:28 am

Re: check_nrpe!check_cpu failing on new CentOS8 Server

Post by mccrakem »

Hi
I am still working on this agent install but can you tell me besides the installing the Dev Tools
and modifying the script is there anything else that should be installed ?

What are the packages (rpms) require to configure monitory on Redhat8 servers

Thanks
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_nrpe!check_cpu failing on new CentOS8 Server

Post by lmiltchev »

You don't need anything else. Once the dev tools is installed, you should have a compiler, and the Linux agent should install. The Linux agent consists of NRPE daemon and Nagios pluings. This is all you need to start monitoring your client machine.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked