check_proc_age.sh not connecting to remote host

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
wspackaging
Posts: 43
Joined: Mon Jul 15, 2013 10:36 am

check_proc_age.sh not connecting to remote host

Post by wspackaging »

Goal: Check the running time of a java process and alert on it.

From the Nagios Exchange I got the check_proc_age.sh script.

From the cli on the host it runs great and gives me the output I'm expecting.
# /admin/nagios_plugins/check_proc_age.sh -p java -w 21600 -c 43200
WARNING: there are 2 process java, oldest has got 6 Hours 30 minutes age


from Nagios XI when I run the command is isn't connecting out to the remote host I want monitored. it is only checking the nagios xi server.
Ok
OK: there is no process matching java


The command being run from Nagios is:
check_process_age!-p java !-w 21600 -c 43200!!!!!!

The Exchange page doesn't explain how to configure in XI. Or I'm missing it.
http://exchange.nagios.org/directory/Pl ... sh/details

I'm missing something and I'm guessing it is a pretty basic thing. If anybody could point me to the doc or forum page explaining how to set this up I would appreciate it.

thanks
-pete
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: check_proc_age.sh not connecting to remote host

Post by BanditBBS »

You need to use check_nrpe to check the remote host and make sure the check file is copied to the remote host's NRPE plugins location.

Check_nrpe is used to execute scripts on remote hosts. If you need more details, just say so :)

Jim/Bandit
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_proc_age.sh not connecting to remote host

Post by lmiltchev »

Thanks, BanditBBS!

@wspackaging
Let us know if you have any issues with installing NRPE on the remote server or setting up your checks.
Be sure to check out our Knowledgebase for helpful articles and solutions!
wspackaging
Posts: 43
Joined: Mon Jul 15, 2013 10:36 am

Re: check_proc_age.sh not connecting to remote host

Post by wspackaging »

I still have something wrong.

I put the check_proc_age.sh on the remote server in /usr/local/nagios/libexec/

in the XI config manager > Services > modify > Check process age I have it configured:
Check Command = check_nrpe
active = checked
command view = $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
$ARG1$ = check_proc_age.sh
$ARG2$ = -p java w 21600 -c 43200

Then when I run the "Test Check Command" I get a usage error.
Testing check from command line...

COMMAND: /usr/local/nagios/libexec/check_nrpe -H dc1ux082 -t 30 -c check_proc_age.sh -p java w 21600 -c 43200
OUTPUT: Incorrect command line arguments supplied

NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.12
Last Modified: 03-10-2008
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 [-n] [-u] [-p ] [-t ] [-c ] [-a ]

Options:
-n = Do no use SSL
-u = Make socket timeouts return an UNKNOWN state instead of CRITICAL
= The address of the host running the NRPE daemon
[port] = The port on which the daemon is running (default=5666)
[timeout] = Number of seconds before connection times out (default=10)
[command] = The name of the command that the remote daemon should run
[arglist] = Optional arguments that should be passed to the command. Multiple
arguments should be separated by a space. If provided, this must be
the last option supplied on the command line.
wspackaging
Posts: 43
Joined: Mon Jul 15, 2013 10:36 am

Re: check_proc_age.sh not connecting to remote host

Post by wspackaging »

from the Service Details > Configure > Re-configure this service

it looks like this:
check_nrpe!check_proc_age.sh!-a '-p java -w 21600 -c 43200'!!!!!!

I get this error now.
NRPE: Command 'check_proc_age.sh' not defined
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_proc_age.sh not connecting to remote host

Post by sreinhardt »

How do you have this command definied in the nrpe configuration? Normally, you can make a check that does, you would not address the script directly from the nagios command definition, but have an additional command on the nrpe side that references it. Glad you found the -a flag!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: check_proc_age.sh not connecting to remote host

Post by BanditBBS »

Let me add to what Spencer said.....

Go into nrpe.cfg on the remote server and scroll to the bottom. In there you should see commands defined. Your check_pro_age isn't defined, you need to add it there. Also if your NRPE was not installed with the allow arguements enabled, the the -a and everything after it will cause an error. You would have to define the entire command in the nrpe.cfg file.

Remember, if you make a change to nrpe.cfg that nrpe needs restarted(either nrpe service or xinetd or however it is running.)

Let me know if I didn't explain that well enough.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
wspackaging
Posts: 43
Joined: Mon Jul 15, 2013 10:36 am

Re: check_proc_age.sh not connecting to remote host

Post by wspackaging »

Getting closer :D

I had nothing in the nrpe config. I added this.
command[check_proc_age.sh]=/usr/local/nagios/libexec/check_proc_age.sh -p $ARG1$ -w $ARG2$ -c $ARG3$

I then went back into config manager and I now have the command set up like:

check_nrpe!check_proc_age.sh!-a '-p java!-w 21600 -c 43200'!!!!!

Now when I run a check it comes back as null
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: check_proc_age.sh not connecting to remote host

Post by BanditBBS »

wspackaging wrote:Getting closer :D

I had nothing in the nrpe config. I added this.
command[check_proc_age.sh]=/usr/local/nagios/libexec/check_proc_age.sh -p $ARG1$ -w $ARG2$ -c $ARG3$

I then went back into config manager and I now have the command set up like:

check_nrpe!check_proc_age.sh!-a '-p java!-w 21600 -c 43200'!!!!!

Now when I run a check it comes back as null
Make it:
command[check_proc_age]=/usr/local/nagios/libexec/check_proc_age.sh -p $ARG1$ -w $ARG2$ -c $ARG3$

And forget testing in Nagios, just from the command line in the libexec folder of your nagios server type:

Code: Select all

./check_nrpe -H ip_address -c check_proc_age -a 'java! 21600 43200'
You might have to use double quotes because of the ! in the process name.

EDIT: That command I said to test with may be wrong, fighting my own issue at the moment and didn't spend enough time checking for you
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: check_proc_age.sh not connecting to remote host

Post by BanditBBS »

Ok, my issue has been resolved, so now I can continue to help you :)

Anyway, change the command definition in nrpe.cfg to

Code: Select all

command[check_java]=/usr/local/nagios/libexec/check_proc_age.sh -p java!-w 21600 -c 43200
Then from your nagios server

Code: Select all

./check_nrpe -H ip_address -c check_java
Again, make sure you restart nrpe after making the change. This eliminates any configuration issue and also won't cause an issue if your nrpe was installed with not allowing command line arguments. If this works, this at least gets you going, then you can play around with customizing with the arguments.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
Locked