---
title: "Configuring Customer Metrics in Prometheus and Grafana"
canonical: "https://docs.infoblox.com/space/BloxOneInfrastructure/1816920218/Configuring%20Customer%20Metrics%20in%20Prometheus%20and%20Grafana"
format: markdown
---
Use this procedure to configure customer metrics in Prometheus and Grafana through the Infoblox API. This configuration includes creating user groups, users, roles, and access policies, generating a service API key in the Infoblox Portal, and then using those configurations in Prometheus and Grafana to collect and visualize customer metrics.

## Creating a User Group

1. Log in to the Infoblox Portal.
2. Navigate to **System** > **Administration** > **User Access** and click **Create User Group**.
3. Enter a name (for example, customer-metrics-user-group) and a description for the user group.
4. Click **Save & Close**.

For more information, see *[Creating User Groups](https://infoblox-docs.atlassian.net/wiki/spaces/BloxOneCloudDraft/pages/9535714)*. 

## Creating a User

1. Navigate to **System** > **Administration** > **User Access **and click **Create User**.
2. Fill in the form and set **Type** to **Service**.
3. From the **AVAILABLE USER GROUPS** table, select the previously created user group (for example, customer-metrics-user-group) and use the arrow to move it to the **SELECTED USER GROUPS** table.
4. Click **Save & Close**.

For more information, see *[Creating Users](https://infoblox-docs.atlassian.net/wiki/spaces/BloxOneCloudDraft/pages/9535684)*. 

## Creating a Role

1. Navigate to **System** > **Administration** > **User Access **and click **Create Role**.
2. Enter a name (for example, Customer Metrics Role) and a description for the role.
3. Under **Features**, select the **Customer Metrics **checkbox in the **Infoblox Cloud **section.
4. Click **Save & Close**.

For more information, see *[Creating Roles](https://infoblox-docs.atlassian.net/wiki/spaces/BloxOneCloudDraft/pages/9536251)*. 

## Creating an Access Policy

1. Navigate to **System **> **Administration** > **User Access **and click **Create Access Policy**.
2. Enter a name (for example, Customer Metrics Access Policy) and a description for the access policy.
3. Configure the following:
  - **Role**: Select the previously created role (for example, Customer Metrics Role) from the list.
  - **User Group**:  Select the previously created user group (for example, customer-metrics-user-group) from the list.
  - **Access View**: Select **All** from the drop-down.
4. Click **Save & Close**.

For more information, see *[Creating Access Policies](https://infoblox-docs.atlassian.net/wiki/spaces/BloxOneCloudDraft/pages/9535736)*.

## Generating a Service API Key

1. Navigate to **System** >** Administration > User Access** **> Service API Keys** and click **Create**.
2. In the **Create Service API Keys** dialog, complete the following:
  - **Name**: Enter a name (for example, customer-metrics-user).
  - **Service User**: Enter or select the previously created service user (for example, customer-metrics-user) from the list.
  - **Expires at**: Click the calendar icon to select a date and time when the service API key should expire.
3. Click **Save & Close** to generate the API key.

> 📝 Make sure to copy the generated API key. You will use this in the Prometheus configuration.

For more information, see *[Creating Service API Keys](https://infoblox-docs.atlassian.net/wiki/spaces/BloxOneCloudDraft/pages/9537306)*. 

## Installing Prometheus Locally

1. Download Prometheus.
2. Extract the files.

## Configuring Prometheus

- Navigate to the Prometheus directory.
- Edit the prometheus.yml file as needed. Example configuration:

## Running Prometheus

1. Execute the following command to start Prometheus.
2. Access the Prometheus UI at <u>http://localhost:9090</u>.
3. Navigate to **Status > Target health** to verify the target is up and metrics are being scraped.

Use the **Query** tab to run queries such as **onprem_coredns_health**, and verify that the metrics appear as expected.

## Running Grafana

1. Execute the following command to run Grafana in Docker.
2. Access the Grafana UI at http://localhost:3000, and enter the username and password as `admin`.

3. Add a new data source, name it **Local Prometheus**, and set the Prometheus server URL to http://host.docker.internal:9090.

4. Navigate to **Explore**, select **Local Prometheus** as the source, and choose the desired on-prem metrics to visualize the data in Grafana dashboards.