Optional ARGs


Hi guys,

Is there a way to get nagios to choose between $USERn$ and $ARGn$ based on if $ARGn$ is defined?

I’m trying to use check_http to check a bunch of URLs and some of them need to have user-agent or size returned or follow redirects set and I would like to use something like:

command_line $USER1$/check_http -H $HOSTADDRESS$ -u $ARG1$ -m $ARG2$ -f $ARG3$ -A $ARG4$

and use something like this on my checks…


I tried to define $ARG2$ - $ARG4$ in resources.cfg with the idea that if it’s set it get overridden but it doesn’t work

Is there like an optional syntax to choose which ever is defined, something like

command_line $USER1$/check_http -H $HOSTADDRESS$ -u $ARG1$ -m $USER2$|$ARG2$] -f $USER3$|$ARG3$] -A $USER4$|$ARG4$]


define different check_http_something commands, with different arguments and use them as needed.


Yea, I ended up doing that, just a pain cause I have to make a bunch of checks for each of the possible combinations.