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
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 succesfully 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
Add new panelbutton.
Querytab type the PromQL query, in this case just type
pingendpoint few times and refresh the Graph to verify if it is working as expected.
Panel Optionsset the
Ping Request Count.
This documentation is open-source. Please help improve it by filing issues or pull requests.