In this Raspberry Pi Grafana tutorial, we will be walking you through all the steps of installing and setting up Grafana on the Raspbian operating system.
By the end of this tutorial you should have an idea on how to setup Grafana successfully on the Raspberry Pi and know how to access it’s web interface.
For those who do not know what Grafana is, it is an open-source metric analytics and visualization suite. Simply put, its a tool designed to help visualize time-based data.
Grafana is a fast tool as it offloads most of the demanding tasks, such as the rendering of graphs to the client. This allows the software to focus on providing the data for graphs and helps make it a perfect fit for the Raspberry Pi as there is less data to process.
The Grafana software has support for a wide way of different data inputs and even allows you to define alert rules on essential metrics so you can be automatically notified if something is not right.
One of these potential Grafana data inputs is the popular InfluxDB. InfluxDB is a popular database to accompany Grafana as it is fast and is “time series” based meaning each record comes with a timestamp.
You will often see Grafana used to monitor system metrics such as hardware temperature and system utilization. It can even be used as an easy way to plot data, such as the weather throughout a day.
If you are after a way of quickly displaying data recorded by your Raspberry Pi, then you can’t go past Grafana.
Below is all the equipment that you will need to set up Grafana on your Raspberry Pi.
Installing Grafana to the Raspberry Pi
1. Before we get started with installing Grafana to the Raspberry Pi, we should first ensure all the currently installed packages are up to date.
We can do this by running the following two commands. These commands will update the package list and then upgrade all installed packages to their latest versions.
sudo apt update sudo apt upgrade
2. To install Grafana to the Raspberry Pi, the first thing we must do is download the Grafana package from their repository.
There are two different Grafana packages we have to pay attention to. One of these is built for the original Raspberry Pi and the Raspberry Pi Zero, both of which use the older ARMv6 CPU architecture.
The other package is built for newer versions of the Raspberry Pi that make use of the newer ARMv7 architecture.
Run the two commands relevant to the Raspberry Pi that you are using to download and install the Grafana package.
Raspberry Pi 1 & Raspberry Pi Zero
wget https://dl.grafana.com/oss/release/grafana-rpi_6.6.1_armhf.deb sudo dpkg -i grafana-rpi_6.6.1_armhf.deb
Raspberry Pi 2 and later
wget https://dl.grafana.com/oss/release/grafana_6.6.1_armhf.deb sudo dpkg -i grafana_6.6.1_armhf.deb
The first command downloads the relevant Grafana Debian package file to your Raspberry Pi.
The second makes use of the “dpkg” package manager to install the package that we just downloaded to the operating system.
3. Our next step is to get Grafana to start at startup. Luckily for us, Grafana comes with a systemd service file.
To enable Grafana to start at boot, all we need to do is run the following command.
sudo systemctl enable grafana-server
This command will tell the systems service manager to enable the service file called “grafana-server.service”.
The service manager will use this file as a guide on how to deal with the Grafana server.
4. Finally, let’s start up the Grafana server software by running the command below in the Pi’s terminal.
sudo systemctl start grafana-server
Connecting to your Raspberry Pi Grafana Installation
1. Now that we have Grafana installed to your Raspberry Pi, we will now be able to access its web interface.
Before we do that though, we will first retrieve the local IP address of your Raspberry Pi. We can use this IP to access Grafana remotely within your local network.
You can get the IP address assigned to your Pi by running the following command.
If you find yourself accessing the Pi a lot you might want to consider setting up a static IP.
2. With your IP address handy, go to the following web address. Grafana’s web interface sits on port 3000 of your Raspberry Pi’s IP address.
Make sure that you replace “<IPADDRESS>” with the IP that you retrieved in the previous step.
3. The first thing you will see when loading up Grafana is a login screen.
On this screen, you will be able to login using the default admin user that was created when you first installed Grafana to your Raspberry Pi.
The username for this user is “admin” and the password is “admin“.
While the default password is super insecure, we can change it in the very next step.
4. When you first log in to the Grafana web interface you will be asked to change the user’s password.
While it is possible to skip this step, we highly recommend that you do not. The default password is incredibly insecure and should be changed immediately.
To proceed to the Grafana dashboard, go ahead and enter a new password then click the “Save” button.
5. Once you have logged in and changed the default password, you should now be greeted with the following screen.
This screen means that you are now ready to start adding data sources and setting up your Grafana dashboard on your Raspberry Pi.
At this point, you should now have Grafana up and running on your Raspberry Pi and now be able to access its web interface.
If you have run into issues with installing Grafana or have any feedback on this tutorial, then feel free to drop a comment in the comments section below.