Page 1 of 2

check_log3 plugin not working on Linux

Posted: Mon Mar 07, 2016 1:58 pm
by jyoti22
Hi Team,

I have copied check_log3 plugin into plugins file (/usr/lib64/nagios/plugins) on Linux server.
Then I have modified nrpe.cfg file
command[check_log3]=/usr/lib64/nagios/plugins/check_log3.pl $ARG1$

When I am checking it from Nagios XI server, get below error

[root@auscrpmonprd00 libexec]# ./check_nrpe -H 192.168.153.197 -c check_log3.pl -l /oracle/app/oracle/diag/rdbms/aldb2/aldb2/trace/alert_aldb2.log -p 'ORA-00060'
Incorrect command line arguments supplied

NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.15
Last Modified: 09-06-2013
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required

Usage: check_nrpe -H <host> [ -b <bindaddr> ] [-4] [-6] [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]
.
.
.
how can I fix it

Re: check_log3 plugin not working on Linux

Posted: Mon Mar 07, 2016 2:15 pm
by lmiltchev
./check_nrpe -H 192.168.153.197 -c check_log3.pl -l /oracle/app/oracle/diag/rdbms/aldb2/aldb2/trace/alert_aldb2.log -p 'ORA-00060'
You command is not correct. You need to pass arguments using the "-a" flag.

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <remote ip> -c <command> -a <arguments>
In addition to this, your command is defined as "check_log3" NOT as "check_log3.pl"...
command[check_log3]=/usr/lib64/nagios/plugins/check_log3.pl $ARG1$

Try running:

Code: Select all

./check_nrpe -H 192.168.153.197 -c check_log3 -a '-l /oracle/app/oracle/diag/rdbms/aldb2/aldb2/trace/alert_aldb2.log -p ORA-00060'
BTW, can you show us the actual command run from the command line on the remote box along with the output of it?

Re: check_log3 plugin not working on Linux

Posted: Wed Mar 16, 2016 3:56 pm
by jyoti22
Hi
When I command from XI, I get below error

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_nrpe -H 192.168.153.195 -t 600 -c check_log3 -a '-l /oracle/app/oracle/diag/rdbms/ndb2/ndb2/trace/alert_ndb2.log -p ORA-00060'
OUTPUT: Cannot read '/oracle/app/oracle/diag/rdbms/ndb2/ndb2/trace/alert_ndb2.log'
However, when I try to test the command from remote server, command works fine

Code: Select all

[root@AUSVADNODB01 plugins]# ./check_log3.pl -l /oracle/app/oracle/diag/rdbms/ndb2/ndb2/trace/alert_ndb2.log -p ORA-00060
WARNING: Found 7 lines (limit=1/0): ORA-00060: Deadlock detected. More info in file /oracle/app/oracle/diag/rdbms/ndb2/ndb2/trace/ndb2_ora_27340.trc.|lines=7
[root@AUSVADNODB01 plugins]#

Re: check_log3 plugin not working on Linux

Posted: Wed Mar 16, 2016 4:11 pm
by hsmith
On the remote server, can you try it as the 'nagios' user instead of the 'root' user?

Re: check_log3 plugin not working on Linux

Posted: Wed Mar 16, 2016 4:18 pm
by jyoti22
We have installed nrpe agent on remote server with root account and not with nagios account. so cannot use nagios user on server
[root@AUSVADNODB01 plugins]# sudo su - nagios
This account is currently not available.
[root@AUSVADNODB01 plugins]#

Re: check_log3 plugin not working on Linux

Posted: Wed Mar 16, 2016 4:24 pm
by hsmith
What's the output of ps -ef | grep nag

How about this command?

Code: Select all

find / -name "nrpe.cfg" -exec cat {} \; | grep -Ev '(#.*$)|(^$)'

Re: check_log3 plugin not working on Linux

Posted: Wed Mar 16, 2016 5:24 pm
by jyoti22
[root@AUSVADNODB01 ~]# ps -ef | grep nag
root 24231 20349 0 17:20 pts/0 00:00:00 grep nag
nrpe 28387 1 0 14:59 ? 00:00:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
[root@AUSVADNODB01 ~]# find / -name "nrpe.cfg" -exec cat {} \; | grep -Ev '(#.*$)|(^$)'
log_facility=daemon
pid_file=/var/run/nrpe/nrpe.pid
server_port=5666
nrpe_user=nrpe
nrpe_group=nrpe
allowed_hosts=127.0.0.1, 10.161.4.180
dont_blame_nrpe=1
allow_bash_command_substitution=0
debug=0
command_timeout=60
connection_timeout=300
command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200
command[check_log3]=/usr/lib64/nagios/plugins/check_log3.pl $ARG1$
include_dir=/etc/nrpe.d/
[root@AUSVADNODB01 ~]#

Re: check_log3 plugin not working on Linux

Posted: Thu Mar 17, 2016 8:47 am
by lmiltchev
nrpe_user=nrpe
nrpe_group=nrpe
Do "nrpe" user/group exist on this system?

Can you run successfully your command as the "nrpe" user on the client machine?

Code: Select all

su nrpe
cd /usr/lib64/nagios/plugins/
./check_log3.pl -l /oracle/app/oracle/diag/rdbms/ndb2/ndb2/trace/alert_ndb2.log -p ORA-00060

Re: check_log3 plugin not working on Linux

Posted: Thu Mar 17, 2016 2:09 pm
by jyoti22
Ohh yes. When I log in with nrpe account I get permission issue

[root@AUSVADNODB01 ~]# su nrpe
bash-3.2$ cd /usr/lib64/nagios/plugins/
bash-3.2$ ./check_log3.pl -l /oracle/app/oracle/diag/rdbms/ndb2/ndb2/trace/alert_ndb2.log -p ORA-00060
Cannot read '/oracle/app/oracle/diag/rdbms/ndb2/ndb2/trace/alert_ndb2.log'
bash-3.2$

Re: check_log3 plugin not working on Linux

Posted: Thu Mar 17, 2016 2:30 pm
by lmiltchev
Cannot read '/oracle/app/oracle/diag/rdbms/ndb2/ndb2/trace/alert_ndb2.log'
It seems like that "nrpe" user doesn't have sufficient permissions. You will have to probably add "nrpe" user to sudoers in order to make this work.