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.
Code: Select all
command[whoami]=whoami
command[getenv]=env
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
Code: Select all
ls -la /etc/nagios/check_omat
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
Code: Select all
[root@elukancompute nagios]# /etc/nagios/check_omat 10 5;echo $?
SERVICE STATUS: OK
0
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
Code: Select all
su -c "/etc/nagios/check_omat this is a test" nrpeCode: Select all
[root@elukancompute nagios]# su -c "/etc/nagios/check_omat this is a test" nrpe
SERVICE STATUS: OK
Code: Select all
[root@elukancompute nagios]# cat /etc/nagios/outfile.txt
this is a test
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
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
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
This doesn't seem right (the two forward slashes)...command[check_omat]=/usr/lib64/nagios/plugins//check_omat $ARG1$ $ARG2$