Param passing

Hi

I have a problem passing parameters from nagios to a bash script.
I am trying to use a bash script for monitoring memory usage. There are several parameters to this, which are hard-coded and a warning/critical which are passed in.
When the script is run from command line, it works fine, using the raw .sh and also using the check_nrpe methods
However, when this is force checked on the web front end, there seems to be no params being passed into the call.

/ussr/local/nagios/etc/nrpe.cfg has the following line…
command[check_mem]=/usr/local/nagios/libexec/check_mem.sh -w $ARG1$ -c $ARG2$ ram -m -r

/ussr/local/nagios/etc/commands.cfg has the following…
define command{
command_name check_mem
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c check_mem -a $ARG1$ $ARG2$
}

/ussr/local/nagios/etc/hosts/all.cfg hass …
define service{
use generic-service
hostgroup_name test-servers
service_description Server: Mem usage
check_command check_nrpe!check_mem!20!10
}

To all intents and purposes, the script works as intended when run from the command line and returns the correct status messages.
I backed up this script and created another “check_mem.sh” which only echo out the arguments and the values they take in. Again, this worked as intended from CL but not from web front end. The front end just lists the arguments and the hard-coded values, but not the passed in $ARGS1$ and $ARGS2$
Also ran as nagios user from CL and again, all worked fine

Am I missing something or am I doing something the wrong way?
Any suggestions gratefully appreciated

Cheers

edit-----
I also just haardcoded the warning/critical values into the nrpe.cfg and it all worked fine, so i can only deduce that the problem lies somewhere between the all.cfg and when the params are passed into nrpe.cfg. ?