Replies: 3 comments 1 reply
-
I don't know if you're still looking for help with this. It's not trivial but it's not all that complicated though it does require some docker & Grafana knowledge and does involve a few manual steps and might make updating a little more complex
There are downsides to that approach, mostly it's pretty manual today. I think the main one is that when Teslamate is updated, you'll need to watch what is updated and re-import the Grafana dashboards by hand every time (there probably is a better way to do this via command-line though. @adriankumpf I'd love some feedback if you see major gaps in my approach |
Beta Was this translation helpful? Give feedback.
-
New Answer (now with a script)You still need to edit the docker-compose.yml of your Grafana container (once) like this before running the script environment:
- GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=natel-discrete-panel,pr0ps-trackmap-panel,panodata-map-panel,natel-plotly-panel
command: >
sh -c "grafana-cli --pluginsDir /var/lib/grafana/plugins plugins install pr0ps-trackmap-panel 2.1.2 &&
grafana-cli --pluginsDir /var/lib/grafana/plugins plugins install natel-plotly-panel 0.0.7 &&
grafana-cli --pluginsDir /var/lib/grafana/plugins --pluginUrl https://github.com/panodata/panodata-map-panel/releases/download/0.16.0/panodata-map-panel-0.16.0.zip plugins install grafana-worldmap-panel-ng"
volumes:
- ./dashboards_config:/etc/grafana/provisioning/dashboards
- ./dashboards:/dashboards
- ./dashboards_internal:/dashboards_internal
- ./dashboards_reports:/dashboards_reports Now here's the little bash script that does everything (minus the edits to your docker-compose.yml). Simply put it anywhere and #!/bin/bash
### Variables to edit (maybe)
# Path to the docker-compose.yml of your Grafana instance
GRAFANA_PATH=~/docker_container/grafana
# Github URL of the folder containing TeslaMate's dashboards (charge-level.json, charges.json, charging-stats.json, ...)
TESLAMATE_DASHBOARDS_URL=https://github.com/adriankumpf/teslamate/tree/master/grafana/dashboards
# Github URL of the folder containing TeslaMate's dashboards.yml
TESLAMATE_DASHBOARDS_CONFIG=https://github.com/adriankumpf/teslamate/tree/master/grafana
### No more editing after this line
# Checking if subversion is installed and installing it if not
SUBVERSION_INSTALLED=$(dpkg-query -W --showformat='${Status}\n' subversion|grep "install ok installed")
echo Checking for subversion: $SUBVERSION_INSTALLED
if [ "" = "$SUBVERSION_INSTALLED" ]; then
echo "No subversion installed. Setting up subversion."
sudo apt --yes install subversion
fi
# Removing the folders if they exist
rm -rf $GRAFANA_PATH/dashboards/ $GRAFANA_PATH/dashboards_config/ $GRAFANA_PATH/dashboards_internal/ $GRAFANA_PATH/dashboards_reports/
# Creating the needed folders
mkdir -p $GRAFANA_PATH/dashboards $GRAFANA_PATH/dashboards_config $GRAFANA_PATH/dashboards_internal $GRAFANA_PATH/dashboards_reports
# Replacing tree/master with trunk in the URLs to be able to use svn export
TESLAMATE_DASHBOARDS_URL=$(sed 's!tree/master!trunk!g' <<<"$TESLAMATE_DASHBOARDS_URL")
TESLAMATE_DASHBOARDS_CONFIG=$(sed 's!tree/master!trunk!g' <<<"$TESLAMATE_DASHBOARDS_CONFIG")
# Exporting the TeslaMate dashboards to the local dashboards folder
svn export --force $TESLAMATE_DASHBOARDS_URL $GRAFANA_PATH/dashboards/
# Exporting the TeslaMate dashboards.yml to the local dashboards_config folder
svn export --force $TESLAMATE_DASHBOARDS_CONFIG/dashboards.yml $GRAFANA_PATH/dashboards_config/
# Moving the internal dashboards to dashboards_internal
mv $GRAFANA_PATH/dashboards/internal/* $GRAFANA_PATH/dashboards_internal/
# Moving the reports dashboards to dashboards_reports
mv $GRAFANA_PATH/dashboards/reports/* $GRAFANA_PATH/dashboards_reports/
# Removing the left over, empty folders
rm -rf $GRAFANA_PATH/dashboards/internal/ $GRAFANA_PATH/dashboards/reports/
# Restarting the Grafana container
docker-compose -f $GRAFANA_PATH/docker-compose.yml up -d --force-recreate If you did everything right, you should find the 3 folders (Internal, Reports, TeslaMate) with their respective dashboards in your Grafana instance. In case of a new TeslaMate version, simply run the script again. Old Answer (the manual way)So I kinda automated the process (not really) or at least made it as simple to update to a new version as possible: For the purpose of this guide, we assume that the docker-compose.yml of your Grafana stack sits in a folder called
If you did everything right, you should find the 3 folders (Internal, Reports, TeslaMate) with their respective dashboards in your Grafana instance. In case of a new TeslaMate version, simply replace the files in the folders (dashboards, dashboards_config, dashboards_internal, dashboards_reports) with the ones from the new version, edit the |
Beta Was this translation helpful? Give feedback.
-
I've stumbled upon this discussion while searching setups with an existing grafana instance. Except from the needed plugins, are there other technical limitations or reasons to not streamline the setup for existing grafana instances? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Would help to update install documents to cover scenario where there may already be a grafana container running. I've tried several tweaks to the docker compose file but my experience (or lack of) is holding me back.
Beta Was this translation helpful? Give feedback.
All reactions