check_procs not finding what "ps ax | grep" finds

I’m trying to set up a command to check for running processes using nagios. I create a check command named ‘check_procs’ with the command line:

$USER1$/check_procs -c $ARG1$ -C $ARG2$

Then i set up a service check named SpamAssassin with the arguments:


When there is an instance of the SpamAssassin program running, this check always fails. When i run it on the command line like so:

/usr/local/libexec/nagios/check_procs -c 1: -C spamd

I get the result: PROCS CRITICAL: 0 processes with command name ‘spamd’

When i do a manual check using the following command line:

ps ax | grep spamd | grep -v "grep"

I get the correct result:

824 ?? Ss 0:27.91 /usr/local/bin/spamd -c -d -Q -x -r /var/run/spamd/ (perl5.8.6) 38838 ?? S 0:04.79 spamd child (perl5.8.6) 66820 ?? S 0:00.01 spamd child (perl5.8.6)

Is this a bug in check_procs? Or am I executing it incorrectly.

Any help would be greatly appreciated!

hm, I mentioned that you used
I think it should be

I found out what my issue was. Apparently programs like SpamAssassin and AMaViS are processes of Perl, not on their own. So the correct check command would be something like:

$USER1$/check_procs -c $ARG1$ -C $ARG2$ -a ‘$ARG3$’

Where the service check is: check_procs!1:idea:Perl5.8.6!/usr/local/bin/spamd

Using the 1: instead of 1 just indicates that I want a minimum of 1 process running with no maximum.