datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

Retrieval of Pod Metrics from Datadog Agent

Open timduhenchanter opened this issue 7 years ago • 2 comments

Describe what happened: I am attempting to retrieve metrics exposed at a pod level where datadog-agent configuration expects a fixed URL (Prometheus integration)

I have a CNI in a DaemonSet in my Kubernetes cluster and I am trying to retrieve Prometheus metric data per pod. prometheus.yaml expects a fixed URL, however, I have cluster autoscaling configured.

Prometheus achieves this with Annotation and Prometheus-Operator achieves this by parsing the Endpoints in the Service and allows for the Service to adjust the endpoints with native event handling.

If this is not possible a potential workaround (in my scenario at least where datadog-agent is also in a DaemonSet) is to be able to use spec.hostIP at init for the node the datadog-agent pod resides in and inject this into the configuration for the CNI /metrics endpoint.

Additional environment details (Operating System, Cloud provider, etc): EKS 1.13 Datadog Agent 6.12 amazon-vpc-cni 1.5.2

timduhenchanter avatar Aug 15 '19 23:08 timduhenchanter

Hi @timduhenchanter We have the auto-discovery mechanism to overcome this use-case: https://docs.datadoghq.com/agent/autodiscovery/?tab=agent This mechanism will detect your pod running a specific image or having specific annotations on the same node as the agent, and use the IP of the pod to configure the check. Here is how you can do it with annotations on your pod exposing the prometheus payload: https://docs.datadoghq.com/getting_started/integrations/prometheus/?tab=kubernetes#pagetitle

Let me know if this covers your use-case!

Simon

Simwar avatar Aug 16 '19 11:08 Simwar

@Simwar Works like a charm. Thank you! I just blindly missed the Kubernetes tab in the docs.

timduhenchanter avatar Aug 16 '19 18:08 timduhenchanter