Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Running Grafana behind a proxy (grafana.net access) #5057

Open
tmonk42 opened this issue May 16, 2016 · 8 comments

Comments

Projects
None yet
7 participants
@tmonk42
Copy link
Contributor

commented May 16, 2016

Grafana version: grafana-3.0.2-1463383025.x86_64
OS: Amazon Linux AMI release 2016.03

When installing Grafana3 on a system that requires using a HTTP proxy to reach the internet, Grafana is unable to reach grafana.net to check for plugins:
2016/05/16 18:15:08 [T] Failed to get plugins repo from grafana.net, Get https://grafana.net/api/plugins/versioncheck?slugIn=&grafanaVersion=3.0.2: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

I was able to work around this by editing my init file adding this block to the 'start' section:
# Start Daemon
cd $GRAFANA_HOME
export http_proxy="http://myproxy:3128"
export https_proxy="http://myproxy:3128"
export no_proxy="127.0.0.1,localhost"
su -s /bin/sh -c "nohup ${DAEMON} ${DAEMON_OPTS} >> /dev/null 3>&1 &" $GRAFANA_USER 2> /dev/null

I was then experimenting with using grafana-cli for installing the clock plugin and ran into similar issue, had to set the proxy variables in my shell, then could do plugin install.

My preference would be that 'outbound' proxy could be set in grafana.ini, and that would be used by both grafana-server and grafana-cli.

@torkelo

This comment has been minimized.

Copy link
Member

commented May 17, 2016

what is wrong with using http_proxy? seems like a more standard approach than having custom config options

@torkelo torkelo closed this May 17, 2016

@tmonk42

This comment has been minimized.

Copy link
Contributor Author

commented May 17, 2016

Most package management systems have some way of setting a proxy via config (yum, apt, npm, git, etc). While it's certainly possible for me to edit the init file by hand (or via automation) and to set environment variables, it creates extra (and un-documented) work for anyone who would want to use grafana.net for plugins. Without my manual edits, my logs were filling up with failure messages of 'checking for updates'.

Long term, I'm going to have to do work to verify there's no changes to the init file on each release/update of grafana to ensure my edited copy that adds proxy settings hasn't deviated. While it seems simple enough to set my personal environment variables before using the CLI, if I had to do that each time I wanted to do git clone, I'd find another solution. In theory, I could set the proxy env vars in my bashrc, except I need to use sudo to actually install grafana-plugins, and our enterprise standard for sudo strips custom env vars. So then my option is to su to root, set the proxy settings in roots shell for all systems.

Or, there could be an option in grafana.ini for 'http_proxy' that was used by grafana-server and grafana-cli.

In the end, if you want to encourage usage of grafana.net especially among Enterprises, adding proxy support is like getting a surprise extra piece of bacon with breakfast.

Is there a way to disable grafana-server from attempting to check grafana.net for plugins altogether?

@torkelo

This comment has been minimized.

Copy link
Member

commented May 17, 2016

you don't have to do that, you can modify the environments file placed where they usually are (/etc/default/grafana-server on debian, and /etc/sysconfig/grafana-server this is file is marked as a config file same as /etc/grafana/grafana.ini.

But if it's true that it is common for server tools to have a proxy config, then I am open for it.

@tmonk42

This comment has been minimized.

Copy link
Contributor Author

commented May 17, 2016

Cool, the sysconfig/defaults route I like much better for grafana-server. Would still love to have an option for grafana-cli :)

@Krylon360

This comment has been minimized.

Copy link

commented May 21, 2016

You can try setting the proxy info in /etc/environment . Grafana-server is running as a different user. But yes, a config option would be great. I brought this up when the cloudwatch ds was implemented. I could work on integrating the go module that reads from ENV:http_(https,no)proxy; but probably won't be able to get to it till next week.

https://golang.org/src/net/http/transport.go?s=7918:7975#L202

func ProxyFromEnvironment(req _Request) (_url.URL, error)

@PieperCH

This comment has been minimized.

Copy link

commented Jan 2, 2017

It's not possible to set this environment flag in Windows - so a command line paramter would be great!

grafana-cli plugins install grafana-clock-panel

Failed to send requesterrorGet https://grafana.net/api/plugins/repo/grafana-cloc
k-panel: dial tcp 107.178.222.220:443: connectex: No connection could be made be
cause the target machine actively refused it.
←[31mError←[0m: ←[31m?←[0m Failed to send request. error: Get https://grafana.ne
t/api/plugins/repo/grafana-clock-panel: dial tcp 107.178.222.220:443: connectex:
No connection could be made because the target machine actively refused it.

@bergquist bergquist added this to the 4.2.0 milestone Jan 3, 2017

walkamongus pushed a commit to walkamongus/puppet-grafana that referenced this issue Feb 3, 2017

Chadwick Banning
Add support for Grafana behind a proxy
Grafana doesn't currently have any configuration for sending outbound
connections through a proxy. This injects environment variables as a
workaround. A Grafana feature request for this configuration is open at
grafana/grafana#5057.

walkamongus pushed a commit to walkamongus/puppet-grafana that referenced this issue Feb 3, 2017

Chadwick Banning
Add support for Grafana behind a proxy
Grafana doesn't currently have any configuration for sending outbound
connections through a proxy. This injects environment variables as a
workaround. A Grafana feature request for this configuration is open at
grafana/grafana#5057.

walkamongus pushed a commit to walkamongus/puppet-grafana that referenced this issue Feb 3, 2017

Chadwick Banning
Add support for Grafana behind a proxy
Grafana doesn't currently have any configuration for sending outbound
connections through a proxy. This injects environment variables as a
workaround. A Grafana feature request for this configuration is open at
grafana/grafana#5057.

walkamongus pushed a commit to walkamongus/puppet-grafana that referenced this issue Feb 3, 2017

Chadwick Banning
Add support for Grafana behind a proxy
Grafana doesn't currently have any configuration for sending outbound
connections through a proxy. This injects environment variables as a
workaround. A Grafana feature request for this configuration is open at
grafana/grafana#5057.

@bergquist bergquist modified the milestones: 4.2.0-beta1, 4.2.0 Feb 14, 2017

@bergquist bergquist self-assigned this Feb 16, 2017

@bergquist bergquist modified the milestones: 4.3.0, 4.2.0-beta1 Feb 17, 2017

@bergquist bergquist removed their assignment Feb 21, 2017

@torkelo torkelo modified the milestones: 5.0, 4.3.0 Apr 10, 2017

@torkelo torkelo added the help wanted label Apr 10, 2017

@torkelo torkelo removed this from the 5.0 milestone Jul 31, 2017

@sresam89

This comment has been minimized.

Copy link

commented Apr 6, 2018

Is the http_proxy parameter for windows implemented in this push?

@mkaszta

This comment has been minimized.

Copy link

commented Jun 29, 2018

Is it already implemented? I'm struggling with Azure DS connection behind proxy (Windows).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.