This is a quick guide on how to install Grafana plugins behind a proxy server.
Install Grafana Plugins Behind a Proxy server
If you have tried, to install or try to list available Grafana plugins when you are behind a proxy, you might have experienced errors as;
grafana-cli plugins list-remote
Failed to send requesterrorGet https://grafana.com/api/plugins/repo: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Error: ✗ Failed to send request. error: Get https://grafana.com/api/plugins/repo: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Configure System Proxy
Simply configure your system proxy by executing the command below;
echo "export http_proxy='http://192.168.43.3:3128'" | tee /etc/profile.d/proxy.sh
If your proxy server supports both HTTP and HTTPS, then you can add the line below;
echo "export https_proxy='https://192.168.43.3:3128'" | tee -a /etc/profile.d/proxy.sh
However, if you encounter the error below;
Failed to send request: Get https://grafana.com/api/plugins/repo/grafana-worldmap-panel: proxyconnect tcp: tls: first record does not look like a TLS handshake
Error: ✗ Failed to send request. error: Get https://grafana.com/api/plugins/repo/grafana-worldmap-panel: proxyconnect tcp: tls: first record does not look like a TLS handshake
Remove the https line from the proxy configuration file created above.
sed -i '/https/d' /etc/profile.d/proxy.sh
Next, source the proxy configuration file to refresh the enviroment variables.
source /etc/profile.d/proxy.sh
You can as well, log out and log in to apply the settings.
Verify your Proxy configurations.
echo $http_proxy
http://192.168.43.3:3128
There are other multiple ways of setting system-wide proxy. See the link below;
How to Set System Wide Proxy in Ubuntu 18.04
Install Grafana Plugins Behind a Proxy Server
Once you have setup your system proxy, you can now install Grafana plugins. For example, to list available grafana plugins;
grafana-cli plugins list-remote
id: abhisant-druid-datasource version: 0.0.5
id: agenty-flowcharting-panel version: 0.3.0
id: akumuli-datasource version: 1.2.8
id: alexanderzobnin-zabbix-app version: 3.10.2
id: andig-darksky-datasource version: 1.0.0
id: ayoungprogrammer-finance-datasource version: 1.0.0
id: belugacdn-app version: 1.2.0
id: bessler-pictureit-panel version: 1.0.0
id: blackmirror1-singlestat-math-panel version: 1.1.7
id: blackmirror1-statusbygroup-panel version: 1.1.1
id: bosun-app version: 0.0.28
...
So to install a plugin, for example the grafana-worldmap-panel.
grafana-cli plugins install grafana-worldmap-panel
installing grafana-worldmap-panel @ 0.2.0
from url: https://grafana.com/api/plugins/grafana-worldmap-panel/versions/0.2.0/download
into: /var/lib/grafana/plugins
✔ Installed grafana-worldmap-panel successfully
Restart grafana after installing plugins . <service grafana-server restart>
Once the installation is done, you need to restart Grafana server.
systemctl restart grafana-server
You can list all installed plugins by running the command;
grafana-cli plugins ls
installed plugins:
briangann-datatable-panel @ 0.0.6
grafana-piechart-panel @ 1.3.6
grafana-worldmap-panel @ 0.2.0
That is just it on how to install Grafana plugins behind a proxy server.
Related Tutorials;
Integrate Prometheus with Grafana for Monitoring
Monitor Squid logs with Grafana and Graylog
Install Grafana 6.2.x on Ubuntu 18.04/Debian 9