check_log3 plugin not working on Linux

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
jyoti22
Posts: 254
Joined: Mon Mar 23, 2015 4:50 am

check_log3 plugin not working on Linux

Post 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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_log3 plugin not working on Linux

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
jyoti22
Posts: 254
Joined: Mon Mar 23, 2015 4:50 am

Re: check_log3 plugin not working on Linux

Post 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]#
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: check_log3 plugin not working on Linux

Post by hsmith »

On the remote server, can you try it as the 'nagios' user instead of the 'root' user?
Former Nagios Employee.
me.
jyoti22
Posts: 254
Joined: Mon Mar 23, 2015 4:50 am

Re: check_log3 plugin not working on Linux

Post 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]#
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: check_log3 plugin not working on Linux

Post 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 '(#.*$)|(^$)'
Former Nagios Employee.
me.
jyoti22
Posts: 254
Joined: Mon Mar 23, 2015 4:50 am

Re: check_log3 plugin not working on Linux

Post 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 ~]#
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_log3 plugin not working on Linux

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
jyoti22
Posts: 254
Joined: Mon Mar 23, 2015 4:50 am

Re: check_log3 plugin not working on Linux

Post 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$
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_log3 plugin not working on Linux

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked