Page 3 of 7

Re: NRPE Chcek_Memory on Linix

Posted: Thu Aug 18, 2016 10:08 am
by lmiltchev
even after installing Nagios plugins

vi-admin@tgkw002:~/tmp/nagios-plugins-2.1.2> ls -la /usr/local/nagios/libexec
total 148
drwxrwxr-x 2 nagios nagios 4096 Aug 16 21:27 .
drwxr-xr-x 6 root root 4096 Aug 16 21:27 ..
-rwxrwxr-x 1 nagios nagios 137337 Aug 16 21:27 check_nrpe
vi-admin@tgkw002:~/tmp/nagios-plugins-2.1.2>

where did they go?
How did you install Nagios plugins? What is the document/guide/tutorial that you followed?
On my Cento Os 7 it is working and do not have plugins installed there just the NRPE client.
You probably have these plugins on your system if you installed NRPE from repo. It is different when you compile NRPE from source. Then you will need to install nagios plugins separately.

Keep in mind that even if you had nagios plugins installed, your checks would fail unless you make sure that the commands in nrpe.cfg include the correct path to the nagios plugins.

Re: NRPE Chcek_Memory on Linix

Posted: Thu Aug 18, 2016 4:23 pm
by kwhogster
I do not understand this

The NRPE check should look for the command and file on the Nagios Server not on the client servers correct?

I never had install Nagios plugins on other servers just on the Nagios server itself

I run NRPE commands against my windows computers with no trouble.

Linux should not be this problematic would you say.

Just install the NRPE client on Linux should be all you require.

I have 4 Linux boxes all diferent versions

1. Raspberry Pi Raspbian 8
2. Cent OS 7
3. Ubuntu 16.04.01
4. SUSE Linux Enterprise 11 SP3

Only number 2 above works with the check_mem command all others are failing to work

Thanks

Re: NRPE Chcek_Memory on Linix

Posted: Thu Aug 18, 2016 4:35 pm
by rkennedy

The NRPE check should look for the command and file on the Nagios Server not on the client servers correct?
No. NRPE will look for the commands referenced on the client machine. When you run check_nrpe -H yourhost -c commandhere, it's looking for a reference to commandhere in your /usr/local/nagios/etc/nrpe.cfg file like this -

Code: Select all

command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$
You need to have /usr/local/nagios/libexec/check_load on your system. NSClient++ has some NRPE commands built in, which is why there is no need to define them.

Re: NRPE Chcek_Memory on Linix

Posted: Thu Aug 18, 2016 4:43 pm
by kwhogster
So on my cent os 7 which is working I should find that folder correct?


this is the cent os 7 list of that folder


[root@TGCS018 ~]# ls /usr/local/nagios/libexec
check_apt check_load check_simap
check_asterisk.pl check_log check_sip
check_asterisk_sip_peers.sh check_mailq check_smtp
check_breeze check_mrtg check_snmp
check_by_ssh check_mrtgtraf check_spop
check_clamd check_nagios check_ssh
check_cluster check_netstat.pl check_ssmtp
check_cpu_stats.sh check_nntp check_swap
check_dhcp check_nntps check_tcp
check_disk check_nrpe check_time
check_disk_smb check_nt check_udp
check_dummy check_ntp check_ups
check_file_age check_ntp_peer check_uptime
check_flexlm check_ntp_time check_users
check_ftp check_nwstat check_wave
check_hpjd check_open_files.pl check_yum
check_http check_oracle custom_check_mem
check_icmp check_overcr custom_check_procs
check_ide_smart check_ping nagisk.pl
check_ifoperstatus check_pop negate
check_ifstatus check_procs send_nsca
check_imap check_real urlize
check_init_service check_rpc utils.pm
check_ircd check_sensors utils.sh
check_jabber check_services
[root@TGCS018 ~]#

Re: NRPE Chcek_Memory on Linix

Posted: Thu Aug 18, 2016 4:44 pm
by rkennedy
kwhogster wrote:So on my cent os 7 which is working I should find that folder correct?
Please see the previous response.
You probably have these plugins on your system if you installed NRPE from repo. It is different when you compile NRPE from source. Then you will need to install nagios plugins separately.

Re: NRPE Chcek_Memory on Linix

Posted: Thu Aug 18, 2016 9:16 pm
by kwhogster
lmiltchev

You posted this

nagios@tgcs017:/usr/local/nagios/etc/objects$ /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.7 -t 30 -c check_mem -a ' -w 80% -c 90%'
NRPE: Command 'check_mem' not defined

Let's clarify this. You are running the above command on your nagios server against the VMA host (10.2.8.7). This means that the "check_mem" command must be defined in the nrpe.cfg file on the client AND the "check_mem.sh" must exist in the plugins directory on the client...

Run the following commands and show the output:

On the nagios server:
Code: Select all/usr/lib/nagios/plugins/check_nrpe -H 10.2.8.7 -t 30 -c check_users

On the client (10.2.8.7):
Code: Select allls -la /usr/local/nagios/libexec/


Need example of the command to put in nrpe.cfg

I will try to get the check_mem.pl in the folder too

Re: NRPE Chcek_Memory on Linix

Posted: Thu Aug 18, 2016 10:44 pm
by kwhogster
lmitchev

I now have check_mem.sh in /usr/local/Nagios/libexec on VMA 10.2.8.7 host

nagios@tgkw002:/usr/local/nagios/libexec> ls
check_mem.sh check_nrpe


added this to nrpe.cfg

command[check_mem]=/usr/local/nagios/libexec/check_mem -w $ARG1$ -c $ARG2$

Still have the same error NRPE: Command 'check_mem' not defined



This is in my commands.cfg on the Nagios server
define command{
command_name check_mem
command_line $USER1$/check_mem.sh
}

So on the localhost

After making sure check_mem.sh was in /usr/local/Nagios/libexec

The error changed to a warning -e yes a minus E

what does that mean

Looks like we are getting close now



Update

Now on the VMA I did a service nrpe restart

Now the error went to a warning NRPE: Unable to read output


So both are warnings now and not errors

So close

Now it just changed to UNKNOWN NRPE: Unable to read output this is on the VMA host

Re: NRPE Chcek_Memory on Linix

Posted: Fri Aug 19, 2016 11:00 am
by lmiltchev
As your command is defined in the nrpe.cfg as such:

Code: Select all

command[check_mem]=/usr/local/nagios/libexec/check_mem -w $ARG1$ -c $ARG2$
you would need to run:

Code: Select all

/usr/lib/nagios/plugins/check_nrpe -H 10.2.8.7 -t 30 -c check_mem -a  80% 90%
If you changed your command (on the client) as such:

Code: Select all

command[check_mem]=/usr/local/nagios/libexec/check_mem $ARG1$
you would run (on the nagios server):

Code: Select all

/usr/lib/nagios/plugins/check_nrpe -H 10.2.8.7 -t 30 -c check_mem -a  '-w 80% -c 90%'

Re: NRPE Chcek_Memory on Linix

Posted: Fri Aug 19, 2016 11:56 am
by kwhogster
Made the change

the nrpe.cfg on vma host
command[check_mem]=/usr/local/nagios/libexec/check_mem $ARG1$




ran the command from the Nagios server get same results

root@tgcs017:/usr/local/nagios/etc/objects# /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.7 -t 30 -c check_mem -a '-w 80% -c 90%'
NRPE: Unable to read output


Thoughts

Re: NRPE Chcek_Memory on Linix

Posted: Fri Aug 19, 2016 12:08 pm
by lmiltchev
My bad - just noticed that your actual plugin is "check_mem.sh", not "check_mem", so you will need to modify the command on the client to look like this:

Code: Select all

command[check_mem]=/usr/local/nagios/libexec/check_mem.sh -w $ARG1$ -c $ARG2$
and restart NRPE, so that changes can take effect.

BTW, can you run the following command successfully on the remote machine?

Code: Select all

/usr/local/nagios/libexec/check_mem.sh -w 80% -c 90%
If you can, try running from the nagios server:

Code: Select all

/usr/lib/nagios/plugins/check_nrpe -H 10.2.8.7 -t 30 -c check_mem -a '-w 80% -c 90%'