In this tutorial we will create a simple dashboard using Grafana to visualize the ping_request_count
metric that we instrumented in the previous tutorial.
If you are wondering why one should use a tool like Grafana when one can query and see the graphs using Prometheus, the answer is that the graph that we see when we run queries on Prometheus is to run ad-hoc queries. Grafana and Console Templates are two recommended ways of creating graphs.
Install and Run Grafana by following the steps from here for your operating system.
Once Grafana is installed and run, navigate to http://localhost:3000 in your browser. Use the default credentials, username as admin
and password as admin
to log in and setup new credentials.
Let's add a datasource to Grafana by clicking on the gear icon in the side bar and select Data Sources
⚙ > Data Sources
In the Data Sources screen you can see that Grafana supports multiple data sources like Graphite, PostgreSQL etc. Select Prometheus to set it up.
Enter the URL as http://localhost:9090 under the HTTP section and click on Save and Test
.
Now we have successfully added Prometheus as a data source, Next we will create our first dashboard for the ping_request_count
metric that we instrumented in the previous tutorial.
+
icon in the side bar and select Dashboard
.Add new panel
button.Query
tab type the PromQL query, in this case just type ping_request_count
.ping
endpoint few times and refresh the Graph to verify if it is working as expected.Panel Options
set the Title
as Ping Request Count
.This documentation is open-source. Please help improve it by filing issues or pull requests.