Docker - Grafana Container Setup
Here I describe my setup of the Docker Grafana container. With Grafana you can create beautiful dashboards. For example, I use it to show interesting stocks but also to visualize data from Home Assistant sensors. Within Grafana I configured data sources for MariaDB (MySQL) and InfluxDB.
I run this Docker container on a Ubuntu VM that runs via [[ Proxmox VE ]]. I perform the following on the CLI.
Docker pull command:
docker pull grafana/grafana
Within my home folder I have created a Docker folder where I create a subfolder for each container:
cd ~
mkdir -p docker/grafana
cd docker/grafana
Also create a folder where the Grafana data files can be stored:
mkdir data
I use the Nano text editor to create a shell script:
sudo nano grafana_run.sh
With this shell script we are going to create the container.
Copy the following into grafana_run.sh
:
IDu=$(id -u $(logname)) # Saves the logged in user id in the IDu variable
docker run -d \
--user $IDu \
--name=grafana \
--hostname=grafana \
-p 3000:3000 \
-v $PWD/data:/var/lib/grafana \
-e TZ=Europe/Amsterdam \
-e "GF_ANALYTICS_REPORTING_ENABLED=false" \
-e "GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource,grafana-googlesheets-datasource" \
--restart unless-stopped \
grafana/grafana
If necessary, adjust the following:
-p 3000:3000
Choose a port that is still available. Check this with netstat
-v $PWD/data:/var/lib/grafana
Choose the location for the Grafana data. In this example it is the data map we created
-e TZ=Europe/Amsterdam
Pick the right timezone
-e “GF_ANALYTICS_REPORTING_ENABLED=false”
With this environment variable you can override the default configuration. This setting will disable the sending of anonymous usage statistics
-e “GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource,grafana-googlesheets-datasource”
Replace with the plugins you want to install. Some examples are the Clock Panel, Simple JSON Datasource and the Google Sheets Datasource
Exit Nano (CTRL-X) and save the changes.
Now create the container:
sudo sh grafana_run.sh
Check if the container is running properly.
See also my notes about updating containers with Portainer or via the CLI. With Synology’s Docker Application, updating a container is also very easy.
Using Grafana
Grafana can now be accessed via the following URL:
http://<IP DOCKER HOST>:3000/
Log in with the default username and password:
- Username:
admin
- Password:
admin
Then you can change the password.
Now start configuring your data sources under Configuration
!
Read other notes
Tags
Notes mentioning this note
- Docker - MariaDB Container Setup
Here I describe my setup of the Docker MariaDB container.
- Docker - Budibase Low-code Platform Container Setup
When I heard that my employer was using the no-code platform Betty Blocks my interest was piqued. Although I like...
- Docker - InfluxDB 2.x Container Setup
InfluxDB is a time series database.
- P1 reader - Save Data From Smartmeter2mqtt with n8n to QuestDB
Here I describe how to create a n8n flow that receives parsed P1 reader data from Smartmeter2mqtt and then how...
- MariaDB - NixOS Container Setup
MariaDB is a fork of the MySQL database. I use this database, among other things, to store data from [[Docker...
Comments
No comments found for this note.
Join the discussion for this note on this ticket. Comments appear on this page instantly.