All Apps and Add-ons

Is there a way for the HipChat Room Notification Alert app to use an http_proxy setting to make calls to the internet?

New Member

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,

0 Karma

Explorer

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)

Explorer

Thanks, adding this to the hipchat.py worked!

0 Karma

Path Finder

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.

0 Karma

Explorer

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.

0 Karma