2

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

trikelef
  • 518
  • 1
  • 7
  • 26
  • Does the specific process name contain spaces or anything else that could need escaping in `nrpe.cfg`? – Flup Mar 07 '14 at 15:33
  • Yes it contains spaces, it is an application server process. – trikelef Mar 07 '14 at 15:36
  • Try escaping the spaces with backslashes (e.g. `this\ is\ my\ process\ name`). – Flup Mar 07 '14 at 15:37
  • I do not know what the process name exactly is: it has the pattern /java ... 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). – trikelef Mar 07 '14 at 15:41
  • Ah sorry, I thought you mean that you had substituted those argument to anonymise your question. – Flup Mar 07 '14 at 15:42
  • Can you post the output for `cat /proc/pid of nrpe/environ` ? – krisFR Mar 08 '14 at 13:30

1 Answers1

3

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

krisFR
  • 13,280
  • 4
  • 36
  • 42
  • Ok, 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! – trikelef Mar 10 '14 at 10:21
  • @trikelef 3000 ? Wow Impressive ! You should have specified this in your first question because it is not so common ;) – krisFR Mar 10 '14 at 22:50