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:
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.
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.
If you want the target key in the configuration file to contain one or more objects, use the following structure in the YAML list:
A description for the URLs in this target.
A list of strings with the URLs to be scraped.
Authentication configuration used to send requests. It supports TLS and Mutual TLS. For more information, see the documentation about mutual TLS authentication.
By default, services are scraped directly instead of the underlying endpoints since
scrape_services is set to
In order to change this behaviour set
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_endpoints to true to assure retrocompatibility, it would lead to duplicate data.
The Prometheus OpenMetrics integration does not automatically reload the configuration when you make changes to the configuration file.
To reload the configuration, restart the container running the integration:
docker restart nri-prometheus
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=0kubectl scale deployment nri-prometheus --replicas=1
Docker: To run the integration with the previous configuration file:
Copy the content and save it to a
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