Skip to main content

How to Integrate Grafana and Prometheus

All system components are now installed, but Grafana and Prometheus are not set up to interact. The remaining configuration tasks, including adding Prometheus as the data source and importing a dashboard panel, can be accomplished using the Grafana web interface.

To integrate Grafana and Prometheus, follow the steps below:

 

  1. Using a web browser, visit port 3000 of the monitoring server. For example, enter http://local_ip_addr:3000, replacing local_ip_addr with the actual IP address. Grafana displays the login page. Use the user name admin and the default password admin. Change the password to a more secure value when prompted to do so.

    Grafana Login Page

  2. After a successful password change, Grafana displays the Grafana Dashboard.

    The Grafana Dashboard

  3. To add Prometheus as a data source, click the gear symbol, standing for Configuration, then select Data Sources.

    Configuration Button for a Grafana Data Source

  4. At the next display, click the Add data source button.

    Add a Grafana Data Source Button

  5. Choose Prometheus as the data source.

    Select a Prometheus Data Source

  6. For a local Prometheus source, as described in this guide, set the URL to http://localhost:9090. Most of the other settings can remain at the default values. However, a non-default Timeout value can be added here.

    Configure the Prometheus Data Source

  7. When satisfied with the settings, select the Save & test button at the bottom of the screen.

    Save the Prometheus Data Source

  8. If all settings are correct, Grafana confirms the Data source is working.

    Confirmation Message about the Data Source

 

Import Dashboard

How to Import a Grafana Dashboard
A dashboard displays statistics for the client node using a more effective and standardized layout. It is certainly possible to create a custom dashboard. However, Prometheus has already created a dashboard to support the Node Exporter statistics. The Node Exporter Full dashboard neatly graphs most of the values collected from the client nodes. It is much less work to import this premade dashboard than to create a custom one.

 

  1. Visit the Grafana Dashboard Library. Enter Node exporter as the search term.

    Search the Grafana Library

  2. Select the entry for Node Exporter Full.

    Select Node Exporter Full

  3. Make a note of the ID number or use the button to copy the ID to the clipboard. The ID of this board is currently 1860.

    Node Exporter Full Details

  4. Return to the Grafana dashboard. Select the Dashboard icon, consisting of four squares, and choose + Import.

    Select Import Option

  5. In the Import via grafana.com box, enter the ID 1860 from the previous step. Then select the Load button.

    Import the Node Exporter Dashboard

  6. At the next screen, confirm the import details. Choose Prometheus as the data source and click the Import button.

    Importing Dashboard

  7. The Node Exporter Full dashboard takes effect immediately. It displays the performance metrics and state of the client node, including the Memory, RAM, and CPU details. Several drop-down menus at the top of the screen allow users to select the host to observe and the time period to highlight.

    The following example demonstrates how a client reacts when stressed by a demanding Python program. The CPU Busy widget indicates how the CPU is pinned near the maximum. If this occurs during normal operating conditions, it potentially indicates more CPU power is required.

    Monitoring the Client Node