VISUALISING IN GRAFANA
The quickest way to start using Grafana is by downloading and executing its official Docker image. This means that apart from the Docker image, you won’t need to download, set up or install anything else for Grafana to work. However, you’ll still need to define the port number that
Grafana listens to as well as the local directory where Grafana will store its files in order to have data persistency.
In order to plot data, you first need to obtain that data. In the case of Grafana, data comes from one or more data sources. A Grafana Data Source is a data base, file or service that provides data to
Grafana – the program won’t work without data. Prometheus is going to act as the Grafana data source in this tutorial.
The visualisation process is described as follows: Go to http://localhost:3000 to connect to Grafana – use a different hostname if Grafana is a different machine.
The username of the administrator is “admin” whereas the password is defined in the value of GF_SECURITY_ADMIN_PASSWORD
parameter of the docker-compose.yml file.
Then select “Add your first data source”. From the list of data sources select
Prometheus, which is usually at the top of the list.
Put http://prometheus:9090 in the URL field and then press “Save & Test”. Due to the internal network that exists between the Docker images, the Grafana container knows the Prometheus container by the “prometheus” hostname. As you’re already aware, you can connect to
Prometheus from your local machine using http://localhost:9090. We’re done!
The data source’s name is Prometheus.
You now need to create a new Grafana Dashboard that keeps the panels with the visualisations of the metrics. The screenshot shows the Grafana Dashboard with the visualisations from this tutorial.