NRPE response not found

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
turboscrew
Posts: 23
Joined: Wed Jul 30, 2014 6:15 am

Re: NRPE response not found

Post by turboscrew »

I should be sorry for bothering people. :-)

Sometimes quick fixes don't exist and sometimes they hide themselves very well. :-)
I already have a lot of splinters under my finger nails from scratching my head. :-)

Anyway, I guess I have to leave for home anyway.
Back as a hawk tomorrow. :-)
turboscrew
Posts: 23
Joined: Wed Jul 30, 2014 6:15 am

Re: NRPE response not found

Post by turboscrew »

Some additional info (if it's of any use):
Added these to nrpe.cfg:

Code: Select all

command[whoami]=whoami
command[getenv]=env
Running them locally gave:

Code: Select all

[root@elukancompute nagios]# /usr/lib64/nagios/plugins/check_nrpe -H localhost -c whoami
nrpe
[root@elukancompute nagios]# /usr/lib64/nagios/plugins/check_nrpe -H localhost -c getenv
NRPE_PROGRAMVERSION=2.15
USER=nrpe
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
PWD=/
LANG=en_US.UTF-8
SHLVL=1
HOME=/var/run/nrpe
LOGNAME=nrpe
NRPE_SSL_OPT=
NRPE_MULTILINESUPPORT=1
_=/usr/bin/env
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: NRPE response not found

Post by eloyd »

This is beginning to sound as though the nrpe user on localhost is unable to execute the check_omat script. Can you paste the output of:

Code: Select all

ls -la /etc/nagios/check_omat
And would it be possible to actually see the check_omat script?
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
turboscrew
Posts: 23
Joined: Wed Jul 30, 2014 6:15 am

Re: NRPE response not found

Post by turboscrew »

# ls -la /etc/nagios/check_omat
-rwxrwxrwx. 1 root root 178 Jul 25 22:03 /etc/nagios/check_omat

The script was there in the first posting, but here:

Code: Select all

# cat /etc/nagios/check_omat
#!/bin/sh
#if [ ! -e /etc/nagios/outfile.txt ]
#then
#touch /etc/nagios/outfile.txt
#fi

echo $1 $2 $3 $4 $5 $6 $7 $8 > /etc/nagios/outfile.txt
echo SERVICE STATUS: OK
exit 0

Oh, and:

Code: Select all

[root@elukancompute nagios]# /etc/nagios/check_omat 10 5;echo $?
SERVICE STATUS: OK
0
The funny thing is:

Code: Select all

[root@elukancompute ~]# su -c "/etc/nagios/check_omat 20% 10% 2>/dev/null" nrpe
SERVICE STATUS: OK
[root@elukancompute ~]# su -c "/etc/nagios/check_omat 20% 10% 1>/dev/null" nrpe
[root@elukancompute ~]#

Code: Select all

[root@elukancompute ~]# su -c "/usr/lib64/nagios/plugins/check_nrpe -H localhost -c check_omat -a '20% 10%'" nrpe
NRPE: Unable to read output

Code: Select all

Jul 26 06:33:19 elukancompute su[11761]: pam_unix(su:session): session opened for user nrpe by ec2-user(uid=0)
Jul 26 06:33:19 elukancompute nrpe[11764]: Connection from 127.0.0.1 port 48043
Jul 26 06:33:19 elukancompute nrpe[11764]: Host address is in allowed_hosts
Jul 26 06:33:19 elukancompute nrpe[11764]: Handling the connection...
Jul 26 06:33:19 elukancompute nrpe[11764]: Host is asking for command 'check_omat' to be run...
Jul 26 06:33:19 elukancompute nrpe[11764]: Running command: /etc/nagios/check_omat 20% 10%
Jul 26 06:33:19 elukancompute nrpe[11764]: Command completed with return code 3 and output:
Jul 26 06:33:19 elukancompute nrpe[11764]: Return Code: 3, Output: NRPE: Unable to read output
Jul 26 06:33:19 elukancompute nrpe[11764]: [30B blob data]
Jul 26 06:33:19 elukancompute su[11761]: pam_unix(su:session): session closed for user nrpe
Last edited by turboscrew on Fri Aug 01, 2014 9:47 am, edited 1 time in total.
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: NRPE response not found

Post by eloyd »

Please remove the "2>/dev/null" from your commands. Try this:

Code: Select all

su -c "/etc/nagios/check_omat this is a test" nrpe
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
turboscrew
Posts: 23
Joined: Wed Jul 30, 2014 6:15 am

Re: NRPE response not found

Post by turboscrew »

That '2>/dev/null' was there only to make sure the output came from stdout and not stderr.

Code: Select all

[root@elukancompute nagios]# su -c "/etc/nagios/check_omat this is a test" nrpe
SERVICE STATUS: OK
As you see, the variables were not used for output (except to be written in a file)
The string "SERVICE STATUS: OK" is always returned.

Maybe you wanted to see this?

Code: Select all

[root@elukancompute nagios]# cat /etc/nagios/outfile.txt
this is a test
BUT:

Code: Select all

[root@elukancompute nagios]# /usr/lib64/nagios/plugins/check_nrpe -H localhost -c check_omat -a "AARGHH"
NRPE: Unable to read output
[root@elukancompute nagios]# cat /etc/nagios/outfile.txt
this is a test
So it is not run - not even as root.
Last edited by turboscrew on Fri Aug 01, 2014 10:06 am, edited 1 time in total.
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: NRPE response not found

Post by eloyd »

No, I wanted to see if any messages were being written to STDERR, which is what you were redirecting with the 2>/dev/null statement

For fun, move the check_omat script to the same directory as all the other plugins. I can't see that this would make a difference, but I'm almost out of ideas.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
turboscrew
Posts: 23
Joined: Wed Jul 30, 2014 6:15 am

Re: NRPE response not found

Post by turboscrew »

Actually, I tried that with no change. Maybe if I changed the path in the config too...

Code: Select all

[root@elukancompute nagios]# ls /usr/lib64/nagios/plugins/
check_breeze    check_game       check_mrtgtraf     check_oracle   check_ssmtp
check_by_ssh    check_hpjd       check_mysql        check_overcr   check_swap
check_clamd     check_http       check_mysql_query  check_pgsql    check_tcp
check_cluster   check_icmp       check_nagios       check_ping     check_time
check_dhcp      check_ide_smart  check_nntp         check_pop      check_udp
check_dig       check_imap       check_nntps        check_procs    check_ups
check_disk      check_ircd       check_nrpe         check_real     check_users
check_disk_smb  check_jabber     check_nt           check_rpc      check_wave
check_dns       check_ldap       check_ntp          check_sensors  negate
check_dummy     check_ldaps      check_ntp_peer     check_simap    urlize
check_file_age  check_load       check_ntp.pl       check_smtp     utils.pm
check_flexlm    check_log        check_ntp_time     check_snmp     utils.sh
check_fping     check_mailq      check_nwstat       check_spop
check_ftp       check_mrtg      [b] check_omat[/b]         check_ssh

Code: Select all

[root@elukancompute nagios]# tail /etc/nagios/nrpe.cfg
        command[check_users]=/usr/lib64/nagios/plugins/check_users -w 10 -c 20
        command[df_var]=df /var/ | sed -re 's/.* ([0-9]+)%.*/\1/' | grep -E '^[0-9]'
        command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w $ARG1$ -c $ARG2$
        command[load5]=cut /proc/loadavg -f 1 -d " "
        command[xinetd]=/usr/lib64/nagios/plugins/check_procs -c 1: -a xinetd
        command[httpd]=/usr/lib64/nagios/plugins/check_procs -c 1: -a httpd
        command[check_omat]=/usr/lib64/nagios/plugins//check_omat $ARG1$ $ARG2$
        command[whoami]=whoami
        command[getenv]=env
[root@elukancompute nagios]# !ser
service nrpe restart
Redirecting to /bin/systemctl restart  nrpe.service
Now this is getting very weird:

Code: Select all

[root@elukancompute nagios]# su -c "/usr/lib64/nagios/plugins/check_nrpe -H localhost -c check_omat -a 'AARGHH'" nrpe
SERVICE STATUS: OK - Sun Jul 27 08:59:46 EEST 2014
[root@elukancompute nagios]# cat /etc/nagios/outfile.txt
this is a test
[root@elukancompute nagios]# cat /usr/lib64/nagios/plugins/check_omat
#!/bin/sh
if [ ! -e /etc/nagios/outfile.txt ]
then
touch /etc/nagios/outfile.txt
fi

echo $1 $2 $3 $4 $5 $6 $7 $8 >> /etc/nagios/outfile.txt
echo "SERVICE STATUS: OK - `date`"
exit 0

Now I have to get home (and shops). It's almost 18:30 local time.
Have to continue on Monday.

Don't think about this too hard. Instead, have a nice weekend.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE response not found

Post by lmiltchev »

command[check_omat]=/usr/lib64/nagios/plugins//check_omat $ARG1$ $ARG2$
This doesn't seem right (the two forward slashes)...
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: NRPE response not found

Post by eloyd »

It shouldn't matter but it's worth checking out.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
Locked