No, you can do things in two ways.
1) Use two checks, one that has the proxy portion and one that doesn't.
2) Use one check with custom service variables that defines the proxy only for service checks that need it. More information is available at https://assets.nagios.com/downloads/nag ... tvars.html
Check_http over a proxy
Re: Check_http over a proxy
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
-
amprantino
- Posts: 140
- Joined: Thu Apr 18, 2013 8:25 am
- Location: libexec
Re: Check_http over a proxy
Define two different checks and select the needed one
define command {
command_name check_http
command_line $USER1$/check_http --hostname=$HOSTADDRESS$
}
define command {
command_name check_http_proxy
command_line $USER1$/check_http -I {IPOFMYPROXY} --hostname=$HOSTADDRESS$
}
Last edited by amprantino on Fri Oct 16, 2015 12:54 pm, edited 1 time in total.
Re: Check_http over a proxy
Yes, that was my option 1. 
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Check_http over a proxy
Not clear if you implemented the different checks. Did you try that out? If so, did it work?
Former Nagios employee
Re: Check_http over a proxy
If I changed the "define command" to include the -I (that's an eye) with the proxy info, everything worked that requires the proxy but everything failed that doesn't.tmcdonald wrote:Not clear if you implemented the different checks. Did you try that out? If so, did it work?
Re: Check_http over a proxy
We have provided two potential fixes to that:
1) Write two commands, one without the proxy (check_http) and one with the proxy (check_http_proxy). Update all the services that need to use the proxy to use the check_http_proxy command.
2) Use a custom service variable that would be something like _proxy="-I <proxy ip"> for service that need it, and _proxy="" for services that don't. Then update the check_http to use the $SERVICEPROXY$ custom variable in the command line and it will add it when it's set and skip it when it's blank.
1) Write two commands, one without the proxy (check_http) and one with the proxy (check_http_proxy). Update all the services that need to use the proxy to use the check_http_proxy command.
2) Use a custom service variable that would be something like _proxy="-I <proxy ip"> for service that need it, and _proxy="" for services that don't. Then update the check_http to use the $SERVICEPROXY$ custom variable in the command line and it will add it when it's set and skip it when it's blank.
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Check_http over a proxy
I'd personally go with option 1 above - it's easier to make mass changes and it's going to be more obvious during troubleshooting down the road.
Former Nagios employee
Re: Check_http over a proxy
Just to be obtuse, I have an option 3:
Always use the version without a proxy specification and write an event handler that gets triggered when the result returns failure. Then have the event handler try the same check with a proxy and if it returns correctly, then submit a service check command output to the nagios.cmd file with an OK status.
Adjust notifications accordingly.

Always use the version without a proxy specification and write an event handler that gets triggered when the result returns failure. Then have the event handler try the same check with a proxy and if it returns correctly, then submit a service check command output to the nagios.cmd file with an OK status.
Adjust notifications accordingly.
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Check_http over a proxy
Just wait till 1:59pm Friday... I'll show you obtuse. 
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!