Page 1 of 1

Wrong count of nrpe processes with check_procs

Posted: Mon Apr 01, 2019 9:53 am
by Firm
Hi,

I got strange behavior with check_procs plugin trying to monitor a total count of nrpe processes on host. Running from shell it displays correct value:
# systemctl status nrpe
● nrpe.service - NRPE
Loaded: loaded (/etc/systemd/system/nrpe.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2017-03-27 13:07:14 UTC; 2 years 0 months ago
Main PID: 23533 (nrpe)
CGroup: /system.slice/nrpe.service
└─23533 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d

# /usr/lib64/nagios/plugins/check_procs -m PROCS -w 1:1 -c 1:1 -C nrpe
PROCS OK: 1 process with command name 'nrpe' | procs=1;1:1;1:1;0;
# sudo -u nagios /usr/lib64/nagios/plugins/check_procs -m PROCS -w 1:1 -c 1:1 -C nrpe
PROCS OK: 1 process with command name 'nrpe' | procs=1;1:1;1:1;0;
# nrpe

NRPE - Nagios Remote Plugin Executor
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.15
Last Modified: 09-06-2013


But when this check is executed from server - I get 2 as the result for counting of nrpe processes. This happens only for nrpe process. Counting for other processes like nginx works fine.

Command definition:
object CheckCommand "count-nrpe-processes" {
command = [ PluginDir + "/check_nrpe" ]

arguments = {
"-H" = {
value = "$host.vars.address$"
}
"-c" = {
value = "check_procs"
}
"-a" = {
value = "PROCS!1:1!1:1!nrpe"
}
}
}

Re: Wrong count of nrpe processes with check_procs

Posted: Mon Apr 01, 2019 3:57 pm
by benjaminsmith
Hello @Firm,
But when this check is executed from server - I get 2 as the result for counting of nrpe processes. This happens only for nrpe process. Counting for other processes like nginx works fine.
Can you login to the server and run the exact check command from the shell and post the output or take a screen shot for us to review?

Thank you.

Re: Wrong count of nrpe processes with check_procs

Posted: Tue Apr 02, 2019 4:02 am
by Firm
I've posted the output in the original message above.

Re: Wrong count of nrpe processes with check_procs

Posted: Tue Apr 02, 2019 7:41 am
by Firm
To clarify, the output above is captured when manually running check_procs on target host. Below is the output when running check from server:
# /usr/lib64/nagios/plugins/check_nrpe -H ws01 -c check_procs -a 'PROCS!1:1!1:1!nrpe'
PROCS CRITICAL: 2 processes with command name 'nrpe' | procs=2;1:1;1:1;0;

Re: Wrong count of nrpe processes with check_procs

Posted: Wed Apr 03, 2019 10:40 am
by benjaminsmith
Hello @Firm,

I discussed this this with the other support staff, and this is expected behavior. When you're running the check command from the server, NRPE is creating another process of itself to execute the check and that's way you're getting a different count only for NRPE.

Let me know if you have any questions.

Re: Wrong count of nrpe processes with check_procs

Posted: Fri Apr 05, 2019 7:52 am
by Firm
Could we modify code to mitigate this? Like masking forked process from being counted.

Re: Wrong count of nrpe processes with check_procs

Posted: Fri Apr 05, 2019 10:32 am
by benjaminsmith
Hi Firm,

Here's a link to our GitHub repository for this plugin.
https://github.com/nagios-plugins/nagio ... ck_procs.c

Please file a request/issue there.

Thanks!