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

feat(grafana): allow user to install plugins #177

Merged
merged 1 commit into from
Feb 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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