• /
  • EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

Configure Prometheus OpenMetrics integrations

Unless otherwise noted, configuration options for your Prometheus OpenMetrics integration with New Relic apply to both Docker and Kubernetes environments. At a minimum, the following configuration values are required:

  • Cluster name

Recommendation: Configure your New Relic license key as an environment variable named LICENSE_KEY. This provides a more secure environment, as New Relic can load your environment variable from a mutual TLS authentication secret.

Configure nri-prometheus-latest.yaml

The nri-prometheus-latest.yaml manifest file includes the nri-prometheus-cfg map showing an example configuration. Use the manifest file to configure the following parameters.

Configure objects in target key

If you want the target key in the configuration file to contain one or more objects, use the following structure in the YAML list:

Key name

Description

description

A description for the URLs in this target.

urls

A list of strings with the URLs to be scraped.

tls_config

Authentication configuration used to send requests. It supports TLS and Mutual TLS. For more information, see the documentation about mutual TLS authentication.

Services and Endpoints scrape behaviour

By default, services are scraped directly instead of the underlying endpoints since scrape_services is set to true and scrape_endpoints to false.

In order to change this behaviour set scrape_endpoints to true configuring Prometheus OpenMetrics integrations to scrape the underlying endpoints, as Prometheus server natively does, instead of directly the services.

Please notice that depending on the number of endpoints behind the services in the cluster the load and the data ingested can increase considerably, monitor and, if needed, increase resource requirements.

Moreover, even if it is possible to set both scrape_services and scrape_endpoints to true to assure retrocompatibility, it would lead to duplicate data.

Reload the configuration

The Prometheus OpenMetrics integration does not automatically reload the configuration when you make changes to the configuration file.

Docker icon Docker

To reload the configuration, restart the container running the integration:

docker restart nri-prometheus

img-integration-k8.png Kubernetes

To reload the configuration, restart the integration. Recommendation: Scale the deployment down to zero replicas, and then scale it back to one replica:

kubectl scale deployment nri-prometheus --replicas=0
kubectl scale deployment nri-prometheus --replicas=1

Docker: Run previous config file

Docker icon Docker: To run the integration with the previous configuration file:

  1. Copy the content and save it to a config.yaml file.

  2. From within the same directory, run the command:

    docker run -d --restart unless-stopped \
    --name nri-prometheus \
    -e CLUSTER_NAME="YOUR_CLUSTER_NAME" \
    -e LICENSE_KEY="YOUR_LICENSE_KEY" \
    -v "$(pwd)/config.yaml:/config.yaml" \
    newrelic/nri-prometheus:latest --configfile=/config.yaml
Copyright © 2024 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.