check_procs plugin is not working over nrpe
check_procs plugin is not working over nrpe
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)
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)
-
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: check_procs plugin is not working over nrpe
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
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.
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
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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: check_procs plugin is not working over nrpe
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
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
-
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: check_procs plugin is not working over nrpe
@anusha, Ok, please change your command inside nrpe.cfg to:
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:
If the above doesn't help please send the whole command that you're running against NRPE.
Code: Select all
command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$
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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: check_procs plugin is not working over nrpe
@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'
}
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'
}
-
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: check_procs plugin is not working over nrpe
@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: to
3. In templates.cfg add this new template(insert this in host templates section):
4. Now create a new file newhost.cfg. in /usr/local/nagios/etc/objects/
Insert there:
5. Navigate to /usr/local/nagios/etc/nagios.cfg and import this new config:
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.
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$
}
Code: Select all
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
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'
}
Code: Select all
cfg_file=/usr/local/nagios/etc/objects/newhost.cfg
***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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: check_procs plugin is not working over nrpe
Thank you @npolovenko. It is working fine......
-
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: check_procs plugin is not working over nrpe
@anusha , Great! I'll close this thread as resolved but if you'll have other questions go ahead and open a new one.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.