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 »

A long time ago, I rewrote check_http to use curl instead of whatever it does today. It included all the curl-style proxy options. If that might help, I might still have a copy somewhere....
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Check_http over a proxy

Post by hsmith »

I would be interested in this :)
Former Nagios Employee.
me.
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 »

Will have to sanitize it before posting. Will put it on the Exchange and drop a link here when done (tomorrow).
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Check_http over a proxy

Post by hsmith »

Great, thanks!
Former Nagios Employee.
me.
mleo40
Posts: 37
Joined: Tue Jan 27, 2015 10:21 pm

Re: Check_http over a proxy

Post by mleo40 »

Just back from vacation...I'll review new suggestions and report back.

thanks
mleo40
Posts: 37
Joined: Tue Jan 27, 2015 10:21 pm

Re: Check_http over a proxy

Post by mleo40 »

amprantino wrote:To force traffic pass through a proxy add the following

export http_proxy=http://192.168.0.1:3128

Modify the above if you want to add username or password to access proxy.
I'm not sure what to add this to. It appears to be just a shell environment, which nagios doesn't use when executing its commands.
mleo40
Posts: 37
Joined: Tue Jan 27, 2015 10:21 pm

Re: Check_http over a proxy

Post by mleo40 »

jolson wrote:I'd like to know more about the configuration changes that you made to get your proxy working, and any guides you may have followed. What does your /etc/sysconfig/nagios files look like?
cat /etc/sysconfig/nagios

It is my understanding that Nagios Core is not aware of /etc/sysconfig/nagios, which is why I'm curious about any guides you might have followed. In my experience, re-writing your service checks is the only way to accomplish what you're trying to do, but if you have a guide or information that states otherwise I would like to see it.
For the record I have not gotten this working yet.
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 »

Every user, including the nagios user, has a shell environment. I think the idea was to add this to the nagios user's .cshrc or .bashrc file to set the proxy variable.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
mleo40
Posts: 37
Joined: Tue Jan 27, 2015 10:21 pm

Re: Check_http over a proxy

Post by mleo40 »

eloyd wrote:Every user, including the nagios user, has a shell environment. I think the idea was to add this to the nagios user's .cshrc or .bashrc file to set the proxy variable.
I see. That doesn't help as I've tried that already. Our environment automatically includes shell info for everyone to use the proxy already.
mleo40
Posts: 37
Joined: Tue Jan 27, 2015 10:21 pm

Re: Check_http over a proxy

Post by mleo40 »

I changed my checkcommands.cfg as follows:

define command {
command_name check_http
command_line $USER1$/check_http -I {IPOFMYPROXY} --hostname=$HOSTADDRESS$
}

and it worked.

However....this means EVERY check_http will use the proxy, even internal stuff....right? I don't want that either as this fix will break currently working check_http stuff that doesn't require the use of the proxy.

It seems as if I will have to re-structure all my checks and tell nagios which one is a "over-proxy" check and what isn't.

Still hoping for a better solution.
Locked