Is there a way for certain Splunk apps to use a http_proxy setting to be able to make calls to the internet?
The one app I am targeting is the "HipChat Room Notification Alert" app. I need to be able to go through the http_proxy to get from the DC to the HC Room I am targeting.
I have seen the splunk-launch.conf file to set it for Splunk Web to use. Just not sure if this gets passed to splunk apps.
Thanks,
You'll want to install an opener like so...
existing code:
req = urllib2.Request(url, body, {"Content-Type": "application/json"})
try:
res = urllib2.urlopen(req)
Change to: (modify to suite your proxy address/port. Also if you need http and https calls you'll need to add both. )
req = urllib2.Request(url, body, {"Content-Type": "application/json"})
proxy = urllib2.ProxyHandler({'https': '127.0.0.1:8080'})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
try:
res = urllib2.urlopen(req)
Thanks, adding this to the hipchat.py worked!
Hi,
as there is no answer yet and I had the same question:
Yes, proxy settings in /etc/splunk-launch.conf are passed to Splunk apps.
Just adding
http_proxy=<proxyname>:<port>
or for https:
https_proxy=<proxyname>:<port>
to splunk-launch.conf worked for me and the Hipchat app happily uses the proxy for notification forwarding.
I downvoted this post because i tried this, restarted splunk, and it is not working for me. after reviewing hipchat.py, i'm not sure the how this would work anyway.