Install, update, or uninstall your Prometheus OpenMetrics integration

Before you install New Relic's Prometheus OpenMetrics integration, review the requirements for your environment:

Install the integration

To install the Prometheus OpenMetrics integration, follow the procedures for Docker or Kubernetes as applicable:

Docker icon Docker installation

To install the New Relic Prometheus OpenMetrics integration in a Docker environment:

  1. Create a configuration file config.yaml. Use the example configuration file, or look at the nri-prometheus-latest.yaml manifest file, which includes the nri-prometheus-cfg config map and an example configuration.

    • Required: Add your New Relic license key and a cluster name to identify your Docker container.
    • Add the endpoints to scrape; for example, add the http://localhost:8080/metrics endpoint to collect metrics about the integration itself.
    • Specify which metrics you want to ignore or include according to the prefixes for the metrics and labels. For more information, see the metrics filtering documentation.
  2. Start the integration in the background:

    docker run -d --restart unless-stopped \
        --name nri-prometheus \
        -e LICENSE_KEY="YOUR_LICENSE_KEY" \
        -v "$(pwd)/config.yaml:/config.yaml" \
        newrelic/nri-prometheus:1.5
  3. Confirm the container is running properly:

    docker ps -f "name=nri-prometheus"
  4. Confirm that the integration has been configured correctly: Wait a few minutes, then go to the New Relic UI, and run this NRQL query to see if data has been reported:

    FROM Metric SELECT count(*) WHERE clusterName = 'YOUR_CLUSTER_NAME' since 1 hour ago
img-integration-k8s@2x.png Kubernetes installation

To prevent your data from being duplicated, configure your New Relic Prometheus OpenMetrics integration only with one replica. Running two or more replicas will result in duplicated data. For more information, see the troubleshooting procedures for restarts and gaps in data.

To install the New Relic Prometheus OpenMetrics integration in a Kubernetes environment:

  1. Download the integration manifest .yaml file:

    curl -O https://download.newrelic.com/infrastructure_agent/integrations/kubernetes/nri-prometheus-latest.yaml
  2. Edit the nri-prometheus-latest.yaml manifest file:

    Required: Add your New Relic license key and a cluster name to identify your Kubernetes cluster.

    env: - name: LICENSE_KEY 
           value: "<YOUR_LICENSE_KEY>"
    [...]
    config.yaml: |
      cluster_name: "<YOUR_CLUSTER_NAME>"
  3. Specify which metrics you want to ignore or include according to the prefixes for the metrics and labels. By default, the New Relic Prometheus OpenMetrics integration uses the same labels as Prometheus to discover targets. For more information, see the metrics filtering documentation.

  4. Deploy the integration in your Kubernetes cluster:

    kubectl apply -f nri-prometheus-latest.yaml
  5. To confirm that the deployment has been created successfully, look at the CURRENT replicas in the results generated by this command:

    kubectl get deployments nri-prometheus
  6. Confirm that the integration has been configured correctly: Wait a few minutes, then go to the New Relic UI, and run this NRQL query to see if data has been reported:

    FROM Metric SELECT count(*) WHERE clusterName = 'YOUR_CLUSTER_NAME' since 1 hour ago

Update the integration

To update the Prometheus OpenMetrics integration, follow the procedures for Docker or Kubernetes as applicable:

Docker icon Docker update procedures
  1. Remove the Docker container.
  2. Follow standard installation procedures to start a new Docker container.

The integration logs its current version when it starts up. To determine the running version:

docker logs nri-prometheus 2>&1 | grep "Integration version"

Example output:

time="2019-02-26T09:21:21Z" level=info msg="Starting New Relic's Prometheus OpenMetrics Integration version 1.0.0"
img-integration-k8s@2x.png Kubernetes update procedures
  1. Follow standard installation procedures.
  2. Reapply the nri-prometheus-latest.yaml manifest file.

The integration logs its version when it starts up. To determine the running version:

kubectl logs deploy/nri-prometheus | grep "Integration version"

Example output:

time="2019-02-26T09:21:21Z" level=info msg="Starting New Relic's Prometheus OpenMetrics Integration version 1.0.0"

Uninstall

To uninstall the Prometheus OpenMetrics integration for Docker or Kubernetes, execute the following command:

Docker icon Docker:

docker rm -f nri-prometheus

img-integration-k8s@2x.png Kubernetes:

kubectl delete -f nri-prometheus-latest.yaml

For more help

Recommendations for learning more: