Page 2 of 4

Re: NRPE on ubuntu 16 not working

Posted: Mon Jan 29, 2018 4:54 pm
by tcanthonyii

Code: Select all

root@PHPHost:~# find / -name *nrpe
/etc/xinetd.d/nrpe
/usr/sbin/nrpe
/usr/local/nagios/libexec/check_nrpe
/usr/local/nagios/bin/nrpe
/usr/local/nagios/etc/nrpe
root@PHPHost:~# find / -name *nrpe*
/var/lib/dpkg/info/nagios-nrpe-server.postinst
/var/lib/dpkg/info/nagios-nrpe-server.prerm
/var/lib/dpkg/info/nagios-nrpe-server.conffiles
/var/lib/dpkg/info/nagios-nrpe-server.postrm
/var/lib/dpkg/info/nagios-nrpe-server.preinst
/var/lib/dpkg/info/nagios-nrpe-server.md5sums
/var/lib/dpkg/info/nagios-nrpe-server.list
/var/lib/lxcfs/cgroup/blkio/system.slice/nagios-nrpe-server.service
/var/lib/lxcfs/cgroup/memory/system.slice/nagios-nrpe-server.service
/var/lib/lxcfs/cgroup/cpu,cpuacct/system.slice/nagios-nrpe-server.service
/var/lib/lxcfs/cgroup/pids/system.slice/nagios-nrpe-server.service
/var/lib/lxcfs/cgroup/devices/system.slice/nagios-nrpe-server.service
/var/lib/lxcfs/cgroup/name=systemd/system.slice/nagios-nrpe-server.service
/var/cache/apt/archives/nagios-nrpe-server_2.15-1ubuntu1.1_amd64.deb
/etc/default/nagios-nrpe-server
/etc/rc5.d/S03nagios-nrpe-server
/etc/rc4.d/S03nagios-nrpe-server
/etc/rc3.d/S03nagios-nrpe-server
/etc/rc0.d/K01nagios-nrpe-server
/etc/xinetd.d/nrpe
/etc/rc1.d/K01nagios-nrpe-server
/etc/nagios/nrpe.d
/etc/nagios/nrpe.cfg
/etc/nagios/nrpe_local.cfg
/etc/rc6.d/K01nagios-nrpe-server
/etc/init.d/nagios-nrpe-server
/etc/rc2.d/S03nagios-nrpe-server
/run/nagios/nrpe.pid
/run/systemd/generator.late/nagios-nrpe-server.service
/run/systemd/generator.late/graphical.target.wants/nagios-nrpe-server.service
/run/systemd/generator.late/multi-user.target.wants/nagios-nrpe-server.service
/usr/sbin/nrpe
/usr/lib/tmpfiles.d/nrpe.conf
/usr/share/doc/nagios-nrpe-server
/usr/share/man/man8/nrpe.8.gz
/usr/local/nagios/libexec/check_nrpe
/usr/local/nagios/bin/nrpe
/usr/local/nagios/bin/nrpe-uninstall
/usr/local/nagios/etc/nrpe
/usr/local/nagios/etc/nrpe.cfg
/sys/fs/cgroup/blkio/system.slice/nagios-nrpe-server.service
/sys/fs/cgroup/memory/system.slice/nagios-nrpe-server.service
/sys/fs/cgroup/cpu,cpuacct/system.slice/nagios-nrpe-server.service
/sys/fs/cgroup/pids/system.slice/nagios-nrpe-server.service
/sys/fs/cgroup/devices/system.slice/nagios-nrpe-server.service
/sys/fs/cgroup/systemd/system.slice/nagios-nrpe-server.service
root@PHPHost:~# apt list --installed | grep nrpe

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

nagios-nrpe-server/xenial-updates,now 2.15-1ubuntu1.1 amd64 [installed]
root@PHPHost:~# apt list --installed | grep nagios

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

nagios-nrpe-server/xenial-updates,now 2.15-1ubuntu1.1 amd64 [installed]
nagios-plugins/xenial,xenial,now 2.1.2-2ubuntu2 all [installed]
nagios-plugins-basic/xenial,xenial,now 2.1.2-2ubuntu2 all [installed]
nagios-plugins-standard/xenial,xenial,now 2.1.2-2ubuntu2 all [installed]
root@PHPHost:~# find / -name nrpe
/etc/xinetd.d/nrpe
/usr/sbin/nrpe
/usr/local/nagios/bin/nrpe
/usr/local/nagios/etc/nrpe
root@PHPHost:~#

Re: NRPE on ubuntu 16 not working

Posted: Tue Jan 30, 2018 11:04 am
by kyang
Thanks for the output. You are indeed running two versions of NRPE.
Which NRPE version would you like to keep and remove? It is not recommended to have two versions of the agent on a system.

The choice between running NRPE under xinetd or as a dedicated daemon?
OK now I allowed dont_blame_nrpe to 1 and I can run the checks now and get a response. But the response is:
NRPE: Command 'check_disk' not defined
Before moving too quickly, we should have only 1 NRPE version running for a good practice.

The output "NRPE: Command 'check_disk' not defined" --> Do you have NRPE and Nagios plugins installed on the remote host you want to monitor?

Re: NRPE on ubuntu 16 not working

Posted: Tue Jan 30, 2018 12:49 pm
by tcanthonyii
OK so I'm not real Linux savvy. I don't know the difference between the two. I want the preferred Nagios method so I'll do which ever you recommend.

Re: NRPE on ubuntu 16 not working

Posted: Tue Jan 30, 2018 2:48 pm
by kyang
by tcanthonyii
OK now I allowed dont_blame_nrpe to 1 and I can run the checks now and get a response. But the response is:

NRPE: Command 'check_disk' not defined
What command did you use to restart NRPE after this change was made?

Re: NRPE on ubuntu 16 not working

Posted: Tue Jan 30, 2018 3:55 pm
by tcanthonyii
sudo service nagios-nrpe-server restart


That's the last restart command I show in my log.

Re: NRPE on ubuntu 16 not working

Posted: Wed Jan 31, 2018 10:19 am
by kyang
Thanks, I just wanted to make sure.

Did you use our installation guide?

Run these commands to uninstall the dedicated NRPE.

Code: Select all

sudo systemctl stop nrpe.service
sudo systemctl disable nrpe.service
sudo rm -f /lib/systemd/system/nrpe.service
sudo systemctl daemon-reload
Then run these.

Code: Select all

sudo rm -f /usr/local/nagios/bin/nrpe*
sudo rm -f /usr/local/nagios/etc/nrpe*
sudo rm -f /usr/local/nagios/libexec/*nrpe*
Please post any issues when running these commands. Thanks

Re: NRPE on ubuntu 16 not working

Posted: Wed Jan 31, 2018 11:07 am
by tcanthonyii

Code: Select all

root@PHPHost:~# sudo systemctl stop nrpe.service
Failed to stop nrpe.service: Unit nrpe.service not loaded.
root@PHPHost:~# sudo systemctl disable nrpe.service
Failed to execute operation: No such file or directory
root@PHPHost:~# sudo rm -f /lib/systemd/system/nrpe.service
root@PHPHost:~# sudo systemctl daemon-reload
root@PHPHost:~# sudo rm -f /usr/local/nagios/bin/nrpe*
root@PHPHost:~# sudo rm -f /usr/local/nagios/etc/nrpe*
rm: cannot remove '/usr/local/nagios/etc/nrpe': Is a directory
root@PHPHost:~# sudo rm -f /usr/local/nagios/libexec/*nrpe*
root@PHPHost:~#

Here are the results. Several failures.

Re: NRPE on ubuntu 16 not working

Posted: Wed Jan 31, 2018 11:16 am
by kyang
Thanks for posting.
These are the uninstallation of NRPE I was referring to. (One for xinetd and one for dedicated daemon)
https://support.nagios.com/kb/article/n ... tml#Ubuntu

How is your NRPE configuration?

Does it still show this?
NRPE: Command 'check_disk' not defined

The remote host you are checking, does it have NRPE and the nagios plugins on it?

Another forum post shows examples that you should have in your nrpe.cfg

https://support.nagios.com/forum/viewto ... 9&p=176218

Re: NRPE on ubuntu 16 not working

Posted: Wed Jan 31, 2018 11:37 am
by tcanthonyii
All that is defined is:

command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200


command[check_users]=/usr/lib/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
command[check_load]=/usr/lib/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_procs]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$

The wizard looks for disk, cpu, cron, load, memory, open files, ping, ssh server, swap, total processes and users. most of which are not defined above. How do I get these in there?

Re: NRPE on ubuntu 16 not working

Posted: Wed Jan 31, 2018 11:48 am
by kyang
Is this from the remote machine?

The commands need to be defined on the remote machine in order to work.

Are you wanting to hard code this command on the remote machine or pass the $ARG$ through the command?

This is hardcoding the commands on the "Remote Machine" nrpe.cfg file. Something like that.

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk -a '-w 15% -c 10% -p/'
This is passing the commands if you have a MISC command in the nrpe.cfg

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_disk -a 20 10 /
MISC command.

Code: Select all

command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
You need to either have it hard coded or have it as a MISC command, then define the $ARGS$ when running the command through XI or the terminal.

Let me know if this makes sense.