Check_http over a proxy

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Check_http over a proxy

Post by eloyd »

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
Image
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

Post by amprantino »

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.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Check_http over a proxy

Post by eloyd »

Yes, that was my option 1. :-)
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Check_http over a proxy

Post by tmcdonald »

Not clear if you implemented the different checks. Did you try that out? If so, did it work?
Former Nagios employee
mleo40
Posts: 37
Joined: Tue Jan 27, 2015 10:21 pm

Re: Check_http over a proxy

Post by mleo40 »

tmcdonald wrote:Not clear if you implemented the different checks. Did you try that out? If so, did it work?
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.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Check_http over a proxy

Post by eloyd »

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.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Check_http over a proxy

Post by tmcdonald »

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
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Check_http over a proxy

Post by eloyd »

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.

:-)
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Check_http over a proxy

Post by tmcdonald »

You? Obtuse? Nonsense :)
Former Nagios employee
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Check_http over a proxy

Post by eloyd »

Just wait till 1:59pm Friday... I'll show you obtuse. :)
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Locked