Nagios check_procs returns wrong value when called from NRPE

6,234

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

Share:
6,234

Related videos on Youtube

Abdul
Author by

Abdul

Updated on September 18, 2022

Comments

  • Abdul
    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
      Flup over 10 years
      Does the specific process name contain spaces or anything else that could need escaping in nrpe.cfg?
    • Abdul
      Abdul over 10 years
      Yes it contains spaces, it is an application server process.
    • Flup
      Flup over 10 years
      Try escaping the spaces with backslashes (e.g. this\ is\ my\ process\ name).
    • Abdul
      Abdul over 10 years
      I 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
      Flup over 10 years
      Ah sorry, I thought you mean that you had substituted those argument to anonymise your question.
    • krisFR
      krisFR over 10 years
      Can you post the output for cat /proc/pid of nrpe/environ ?
  • Abdul
    Abdul over 10 years
    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!
  • krisFR
    krisFR over 10 years
    @trikelef 3000 ? Wow Impressive ! You should have specified this in your first question because it is not so common ;)