Nagios check_procs returns wrong value when called from NRPE
This makes me think about a reported Bug caused by the COLUMN
environment variable.
Here, you have COLUMNS=96
.
This means that any process command line that exceeds COLUMN
value will be lost.
AS you said that your process name is long, you could be facing this issue.
You can try to increase your COLUMN
variable in your command definition in nrpe.cfg
:
command[check_myprogram_proc]=COLUMN=256 /usr/lib/nagios/plugins/check_procs ...
Reference : http://christoph-probst.com/article.php/20110718143604605
Related videos on Youtube
Abdul
Updated on September 18, 2022Comments
-
Abdul almost 2 years
I have added the following line in nrpe.conf of a monitored server say named myserver:
command[check_mysrv_process]=/usr/lib/nagios/plugins/check_procs -c 1: -C java -a mysrv
which works locally as expected:
myserver> /usr/lib/nagios/plugins/check_procs -c 1: -C java -a mysrv PROCS OK: 1 process with command name 'java', args 'mysrv'
However when I run the check through nrpe from my nagios server I get a zero output whatever the number of processes with the specific patterns will be (usually 0 or 1):
mynagiosserver>/opt/nagios/libexec/check_nrpe -H myserver -u -c check_mysrv_process PROCS CRITICAL: 0 processes with command name 'java', args 'mysrv'
More Details:
- NRPE version = 2.12
- Nagios Plugins version = 1.4.16
- OS Type: SLES 11.3
- The specific process name that contains mysrv is a long one.
EDIT
When doing
cat /proc/pid of nrpe/environ
I get the following line:CONSOLE=/dev/consoleSELINUX_INIT=YESROOTFS_FSTYPE=ext3SHELL=/bin/shTERM=linuxROOTFS_FSCK=0crashkernel=256M-:128MLC_ALL=POSIXINIT_VERSION=sysvinit-2.86REDIRECT=/dev/tty1COLUMNS=96PATH=/bin:/sbin:/usr/bin:/usr/sbinvga=0x314DO_CONFIRM=RUNLEVEL=5PWD=/SPLASHCFG=/etc/bootsplash/themes/SLES/config/bootsplash-800x600.cfgPREVLEVEL=NLINES=33HOME=/SHLVL=2splash=silentSPLASH=yesROOTFS_BLKDEV=/dev/sda2_=/sbin/startprocDAEMON=/usr/sbin/nrpe
-
Flup over 10 yearsDoes the specific process name contain spaces or anything else that could need escaping in
nrpe.cfg
? -
Abdul over 10 yearsYes it contains spaces, it is an application server process.
-
Flup over 10 yearsTry escaping the spaces with backslashes (e.g.
this\ is\ my\ process\ name
). -
Abdul over 10 yearsI do not know what the process name exactly is: it has the pattern <path>/java <arg1> <arg2> ... <argn> mysrv, but I have no idea what the args are each time. I just want the check_procs to check for a process with that name pattern (and it works locally).
-
Flup over 10 yearsAh sorry, I thought you mean that you had substituted those argument to anonymise your question.
-
krisFR over 10 yearsCan you post the output for
cat /proc/pid of nrpe/environ
?
-
Abdul over 10 yearsOk, this worked but with setting "command[check_myprogram_proc]=COLUMNS=4000 ...", because the specific process names are more than 3000 characters long. Thanks a lot!
-
krisFR over 10 years@trikelef 3000 ? Wow Impressive ! You should have specified this in your first question because it is not so common ;)