Wrong count of nrpe processes with check_procs

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Firm
Posts: 4
Joined: Mon Apr 01, 2019 9:34 am

Wrong count of nrpe processes with check_procs

Post 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"
}
}
}
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Wrong count of nrpe processes with check_procs

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Firm
Posts: 4
Joined: Mon Apr 01, 2019 9:34 am

Re: Wrong count of nrpe processes with check_procs

Post by Firm »

I've posted the output in the original message above.
Firm
Posts: 4
Joined: Mon Apr 01, 2019 9:34 am

Re: Wrong count of nrpe processes with check_procs

Post 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;
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Wrong count of nrpe processes with check_procs

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Firm
Posts: 4
Joined: Mon Apr 01, 2019 9:34 am

Re: Wrong count of nrpe processes with check_procs

Post by Firm »

Could we modify code to mitigate this? Like masking forked process from being counted.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Wrong count of nrpe processes with check_procs

Post 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!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked