Skip to content

Commit

Permalink
feat(grafana): allow user to install plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
wuvs committed Feb 9, 2017
1 parent 26b9b4a commit 503ca0e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions grafana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@
| <a name="amqp_publisher_exchange"></a> [AMQP_PUBLISHER_EXCHANGE](#amqp_publisher_exchange) | no default | AMQP Publisher Exchange |
| <a name="dashboard_json"></a> [DASHBOARD_JSON](#dashboard_json) | true | Poll a location for json files that contain dashboards |
| <a name="dashboard_json_path"></a> [DASHBOARD_JSON_PATH](#dashboard_json_path) | /usr/share/grafana/dashboards | Location to scan for json dashboards |
| <a name="plugins_path"></a> [PLUGINS_PATH](#plugins_path) | /var/lib/grafana/plugins | Path to where grafana can install plugins |
| <a name="gf_install_plugins"></a> [GF_INSTALL_PLUGINS](#gf_install_plugins) | no default | Pass the plugins as a comma seperated list |

## Development
The provided `Makefile` has various targets to help support building and publishing new images into a kubernetes cluster.
Expand Down
5 changes: 5 additions & 0 deletions grafana/rootfs/usr/share/grafana/grafana.ini.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ data = {{ default "/var/lib/grafana" .DATA_PATH }}
#
logs = {{ default "/var/log" .LOG_PATH }}

#
# Directory where grafana will automatically scan and look for plugins
#
plugins = {{ default "/var/lib/grafana/plugins" .PLUGINS_PATH }}

#################################### Server ####################################
[server]
# Protocol (http or https)
Expand Down
15 changes: 15 additions & 0 deletions grafana/rootfs/usr/share/grafana/start-grafana
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ echo "###########################################"
cat /usr/share/grafana/grafana.ini
echo "###########################################"
echo "###########################################"

GF_PATHS_PLUGINS=${PLUGINS_PATH:-"/var/lib/grafana/plugins"}
if [ ! -z "${GF_INSTALL_PLUGINS}" ]; then
echo "Installing Grafana plugins..."
OLDIFS=$IFS
IFS=','
for plugin in ${GF_INSTALL_PLUGINS}; do
echo "Installing ${plugin} ..."
grafana-cli --pluginsDir "${GF_PATHS_PLUGINS}" plugins install ${plugin}
echo ""
echo "Done installing ${plugin}"
done
IFS=$OLDIFS
fi

set -m
echo "Starting Grafana in the background"
exec /usr/sbin/grafana-server -config /usr/share/grafana/grafana.ini -homepath /usr/share/grafana &
Expand Down

0 comments on commit 503ca0e

Please sign in to comment.