In Nagios, you don’t define the command to run in the service or host definition. You define it in the command definition. It makes it more flexible in case you need to update the plugin one day… just one place to change it. So that command that works in the shell is what would be called in the command definition, not the service definition. The command definition lets you pass arguments to the plugin via macros.
If you check your command definitions I’m betting you see something like:
command_line $USER1$/check_http -H $HOSTADDRESS$ -u $ARG1$ -r $ARG2$
if so, the -H option is already handled. It is pulled automatically from the host definition the service is associated with. So for each service, all you need to do is tell it the -u and -r options, which are $ARG1$ and $ARG2$. To do this, just call the command and separate the args with !'s:
you would also make sure that the host definition for Exchange had that IP as the ‘address’.
if you want to pass the full command line options, including the -H option in the service definition, just set up the command definition to have a single argument (which would be all of the flags and args)
command_line $USER!$/check_http $ARG1$
Then in the service, the command_line would be:
command_line check_http!-H ipaddress -u address -r success
this is obviously not as flexible, as changes to the host’s address aren’t automatically passed down to the services.