Grafana supports querying Prometheus. Prometheus was available as its data source from Grafana 2.5.0 (2015-10-28).

The following shows an example Grafana dashboard that queries data from Prometheus:

Grafana installation

For the complete Grafana installation tutorial, see the Official Grafana documentation

Two, use method

By default, Grafana listens on http://localhost:3000. The default user name and password are admin and admin.

2.1 Create a Prometheus data source

Create a Prometheus Data source:

  1. Click on the Grafana logo to open the toolbar.
  2. In the toolbar, click on the “Data Source” menu.
  3. Click “Add New”.
  4. Set Data source Type to Prometheus.
  5. Set the Prometheus service access address (for example:http://localhost:9090).
  6. Adjust other desired Settings (for example, turn off proxy access).
  7. Click the “Add” button to save the new data source.

An example of a Prometheus data source configuration is shown below:

2.2 Creating a Prometheus Graph

Follow the standard way of adding a new Grafana graph. And then:

  1. Click on the title of Graph, which is in the middle of the top of the Graph. Then click “Edit”.
  2. Under the “Metrics” TAB, select your Prometheus data source (bottom right).
  3. Enter the Prometheus expression you want to Query for in the “Query” field, and use the “Metrics” field to find Metrics through auto-completion.
  4. To format the Legend name of the time series, enter the Legend format. For example, to just display this label asmethodandstatusQuery results, you can use legend format{{method{} - {{status}}.
  5. Adjust the other Graph Settings until you have a working Graph.

An example of a Prometheus diagram configuration is shown below:

2.3 Import a pre-built Dashboard from Grafana.net

Grafana.com maintains a set of shared dashboards that can be downloaded and used with standalone instances of Grafana. Browse only the dashboard for the “Prometheus” data source using the Grafana.com Filter option.

You must currently manually edit the downloaded JSON file and correct the datasource: entry to reflect the Grafana datasource name that you selected for the Prometheus server. Use the Dashboard → Home → Import options to import the edited dashboard files into the Grafana installation.

Iii. Links:

Prometheus website: Prometheus. IO/my Github: github.com/Alrights/pr…