Configuring Prometheus OpenMetrics monitoring in Unified Agent

When you deploy the Unified Agent, you can select to enable Prometheus OpenMetrics plug-in to handle Prometheus sources.

  1. Edit the CR by running the following command:
    kubectl edit ua ua-openmetrics -n ${UA_INSTALL_NAMESPACE}
  2. Locate the section of [[inputs.openmetrics]].

  3. Change enabled: false to enabled: true.

  4. Specify the name and urls for the Prometheus OpenMetrics resources and service.
    See the following example:

      - data:
          openmetrics.conf: |-
            name = "node"
            urls = [""]
            direct = true
        enabled: true
        name: openmetrics
  5. Save the CR.

  6. Verify that the pods are restarted after you save the CR.

    kubectl get pod -n ${UA_INSTALL_NAMESPACE}

    You can get the following output:

    NAME                                READY   STATUS              RESTARTS   AGE
    ua-mgmt-ua-cloud-monitoring-987nl   0/1     ContainerCreating   0          9s
    ua-mgmt-ua-cloud-monitoring-kc5fq   1/1     Running             0          5d1h
    ua-mgmt-ua-cloud-monitoring-krp5f   1/1     Running             0          5d1h
    ua-mgmt-ua-cloud-monitoring-mdr9c   1/1     Running             0          29s
    ua-mgmt-ua-cloud-monitoring-mkq62   1/1     Running             0          5d1h
  7. Verify that the enabled plug-in is loaded:

    kubectl -n ${UA_INSTALL_NAMESPACE} logs ua-mgmt-ua-cloud-monitoring-987nl | grep "Loaded inputs"

    See the following example output:

    2020-11-24T07:15:17Z I! Loaded inputs: blockchain cpu mem disk diskio net procstat system processes lwdc nginx openmetrics zipkin jaeger redis