check_procs plugin is not working over nrpe

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

check_procs plugin is not working over nrpe

Postby anusha » Wed Nov 08, 2017 11:36 pm

Hi,

I am trying to get the java process working on client. When I am trying to execute the plugin in client machine it is working fine whereas when I am trying to get the result over nrpe it is showing 0 processes with args 'java'.


I tried to change the configuration with below command but no luck.

./configure --enable-extra-opts=yes --with-ps-command="/bin/ps axwwo 'stat uid pid comm args'" --with-ps-format="%s %d %d %n %s" --with-ps-cols=5 --with-ps-varlist="procstat,&procuid,&procpid,&pos procargs"


Master: 11.4 (SuSe linux)
Client: 12.2 (SuSe linux)
anusha
 
Posts: 4
Joined: Mon Sep 11, 2017 4:38 am

Re: check_procs plugin is not working over nrpe

Postby npolovenko » Thu Nov 09, 2017 3:22 pm

Hello, @anusha.
Looks like your NRPE wasn't configured to accept command line arguments.
One way around this would be to manually change the check command in
Code: Select all
/usr/local/nagios/etc/nrpe.cfg


Uncomment this line:
command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$
and change it to:
command[check_procs]=/usr/local/nagios/libexec/check_procs -a 'java'

After that please restart nrpe with:
service nrpe restart
or
service xinetd restart
Depending on your system.
User avatar
npolovenko
 
Posts: 354
Joined: Mon May 15, 2017 5:00 pm

Re: check_procs plugin is not working over nrpe

Postby anusha » Thu Nov 16, 2017 5:03 am

Hello @npolovenko

Thank you for your quick response. I have edited the nrpe.cfg file but still I am not getting the expected result. :?


PROCS CRITICAL: 0 processes with UID
anusha
 
Posts: 4
Joined: Mon Sep 11, 2017 4:38 am

Re: check_procs plugin is not working over nrpe

Postby npolovenko » Thu Nov 16, 2017 1:19 pm

@anusha, Ok, please change your command inside nrpe.cfg to:
Code: Select all
command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$

Also in the same file please chnage dont_blame_nrpe=0 to dont_blame_nrpe=1.

After that please restart nrpe with:
service nrpe restart
or
service xinetd restart
Depending on your system.

When you actually run the check command against NRPE please use this syntax:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_procs -a '-w 10 -c 20 -a java'



If the above doesn't help please send the whole command that you're running against NRPE.
User avatar
npolovenko
 
Posts: 354
Joined: Mon May 15, 2017 5:00 pm

Re: check_procs plugin is not working over nrpe

Postby anusha » Fri Nov 17, 2017 1:35 am

@npolovenko

In nrpe.cfg I have added command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$

Can you please config=rm the below values in master server

command.cfg file:
define command{
command_name check_local_procs
command_line $USER1$/check_procs -a $ARG1$
}


server file:

define service{
check_command check_procs -a '-c 1:4 -a java'
}
anusha
 
Posts: 4
Joined: Mon Sep 11, 2017 4:38 am

Re: check_procs plugin is not working over nrpe

Postby npolovenko » Fri Nov 17, 2017 2:00 pm

@anusha, The problem is that you were not using nrpe for your checks, but instead you were checking the same plugin locally. That's why you had 0 java processes.

For example, here command_line $USER1$/check_procs -a $ARG1$ $USER1$ is a macross that represents the path on your local system /usr/local/nagios/libexec/.

Now let's fix the configs to actually use NRPE:

1. Your command in nrpe.cfg file on nrpe server looks fine. Leave it as it is.


Next steps you need to perform on a nagios server:
1. Navigate to /usr/local/nagios/etc/objects/

2. In the commands.cfg you need to change:
Code: Select all
define command{
command_name check_local_procs
command_line $USER1$/check_procs -a $ARG1$
}
to
Code: Select all
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}


3. In templates.cfg add this new template(insert this in host templates section):
Code: Select all
define host{
name linux-box ; Name of this template
use generic-host ; Inherit default values
check_period 24x7
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 30
notification_options d,r
contact_groups admins
register 0 ; DONT REGISTER THIS - ITS A TEMPLATE
}



4. Now create a new file newhost.cfg. in /usr/local/nagios/etc/objects/
Insert there:
Code: Select all
define host{
use linux-box
host_name test-server
alias NRPE server testing
address paste_your_nrpe_server_IP_here
}


Code: Select all
define service{
use generic-service
host_name test-server
service_description Check Java Processes
check_command check_nrpe!check_procs -a '-w 10 -c 20 -a java'
}


5. Navigate to /usr/local/nagios/etc/nagios.cfg and import this new config:
Code: Select all
cfg_file=/usr/local/nagios/etc/objects/newhost.cfg


6. Restart nagios with service nagios restart


***PS On your nagios server make sure that you have check_nrpe plugin in /usr/local/nagios/libexec/
And if you don't please refer to the following manual to install it:
https://assets.nagios.com/downloads/nag ... e/NRPE.pdf
Page 9.
User avatar
npolovenko
 
Posts: 354
Joined: Mon May 15, 2017 5:00 pm


Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 7 guests