Page 1 of 4
Check_http over a proxy
Posted: Fri Oct 02, 2015 2:51 pm
by mleo40
We are moving our nagios server behind a firewall and will need to route a lot of our check_http over a proxy
I have added variables to /etc/sysconfig/nagios and have confirmed /etc/init.d/nagios is sources that file and have restarted.
However, none of my check make it through.
Is there a way to verify that it is actually sourcing that file?
Where else can I universally set proxy settings so I don't have to re-write all of my checks?
From the command line:
./check_http --hostname={HOSTNAME} -v
CRITICAL - Socket timeout after 10 seconds
./check_http --hostname={HOSTNAME} -L {PROXY} -v
...
**** CONTENT ****
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.4.7</center>
</body>
</html>
Thanks in advance
Re: Check_http over a proxy
Posted: Mon Oct 05, 2015 1:00 pm
by hsmith
What operating system are you running on? Did you update your profile to have the proxy added?
Re: Check_http over a proxy
Posted: Mon Oct 05, 2015 1:06 pm
by mleo40
redhat linux 6.something.
What profile? It is a shell environment setting already (etc/profile.d/{shell}.sh and .bash) and in /etc/sysconfig/nagios where the nagios documents say to put it.
Is there somewhere else my proxy settings should be so that nagios traffic naturally flows over it?
Re: Check_http over a proxy
Posted: Mon Oct 05, 2015 1:33 pm
by hsmith
Is this the document you were referring to?
https://support.nagios.com/wiki/index.p ... th_Proxies
I was referring to ~/.bash_profile
Re: Check_http over a proxy
Posted: Mon Oct 05, 2015 1:43 pm
by mleo40
FYI: that makes no difference because the same environment settings are pulled in from /etc/sysconfig/profile.d/{name}.sh or bash when the nagios user logs in.
Re: Check_http over a proxy
Posted: Mon Oct 05, 2015 1:50 pm
by mleo40
Your reply only talks about nagiosXI...is there a similar nagios core 4.1.1 solution?
Re: Check_http over a proxy
Posted: Mon Oct 05, 2015 3:59 pm
by jolson
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.
Re: Check_http over a proxy
Posted: Tue Oct 06, 2015 7:31 am
by amprantino
You may use the following to check a proxy without messing with the system
define command{
command_name check_proxy_auth
command_line $USER1$/check_proxy $ARG1$ $ARG2$ $ARG3$
}
check_command check_proxy_auth!proxy1:8080!www.kernel.org!40
Inside the script (line 73) you can define a user:
$WGET --proxy-user "
domain\users" --proxy-password "
mypassword" -t 1 --timeout=$TIMEOUT --proxy --execute=http_proxy=$HTTP_PROXY -O $PROXIED_FILE $SAMPLE_URL $LOG
Re: Check_http over a proxy
Posted: Tue Oct 06, 2015 1:51 pm
by hsmith
Thanks
@amprantino!
@mleo40, does this help you out at all?
Re: Check_http over a proxy
Posted: Tue Oct 06, 2015 2:16 pm
by amprantino
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.