High CPU use by datadog agent
Kubernetes Datadog agent pod running dogstatsd is using more CPU resources than processes/pods that it is monitoring on the host worker node. I am seeing consistent spikes of 380m cpu for the datadog agent daemon running on one of our worker nodes. I kill the pod and the new agent that spawns on this node has the same high resource use.
Normal cpu behavior seems to be around 53m cpu for other datadog agent daemons on our other worker nodes.
Output from the high CPU datadog agent: (It is running version 6.12.1)
root@ip-192-168-174-0:/# s6-svstat /var/run/s6/services/agent/
up (pid 331) 1165 seconds
root@ip-192-168-174-0:/#
root@ip-192-168-174-0:/# agent status
Getting the status from the agent.
===============
Agent (v6.12.1)
===============
Status date: 2019-07-02 15:22:31.048236 UTC
Agent start: 2019-07-02 15:02:10.961954 UTC
Pid: 331
Python Version: 2.7.16
Check Runners: 4
Log Level: INFO
Paths
=====
Config File: /etc/datadog-agent/datadog.yaml
conf.d: /etc/datadog-agent/conf.d
checks.d: /etc/datadog-agent/checks.d
Clocks
======
NTP offset: -10.237ms
System UTC time: 2019-07-02 15:22:31.048236 UTC
Host Info
=========
bootTime: 2019-06-26 16:17:48.000000 UTC
kernelVersion: 4.14.106-97.85.amzn2.x86_64
os: linux
platform: debian
platformFamily: debian
platformVersion: 10.0
procs: 67
uptime: 142h44m45s
virtualizationRole: guest
virtualizationSystem: xen
Hostnames
=========
ec2-hostname: ip-192-168-174-0.us-west-2.compute.internal
host_aliases: [ip-192-168-174-0.us-west-2.compute.internal-DEV]
hostname: i-0bd1fdb97dde19ced
instance-id: i-0bd1fdb97dde19ced
socket-fqdn: ip-192-168-174-0.us-west-2.compute.internal.
socket-hostname: ip-192-168-174-0.us-west-2.compute.internal
host tags:
DEV
hostname provider: aws
unused hostname providers:
configuration/environment: hostname is empty
gce: unable to retrieve hostname from GCE: status code 404 trying to GET http://169.254.169.254/computeMetadata/v1/instance/hostname
=========
Collector
=========
Running Checks
==============
cpu
---
Instance ID: cpu [OK]
Total Runs: 80
Metric Samples: Last Run: 6, Total: 474
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 0, Total: 0
Average Execution Time : 0s
disk (2.2.0)
------------
Instance ID: disk:e5dffb8bef24336f [OK]
Total Runs: 79
Metric Samples: Last Run: 194, Total: 15,326
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 0, Total: 0
Average Execution Time : 1.64s
docker
------
Instance ID: docker [OK]
Total Runs: 80
Metric Samples: Last Run: 815, Total: 65,722
Events: Last Run: 0, Total: 4
Service Checks: Last Run: 1, Total: 80
Average Execution Time : 239ms
elastic (1.12.0)
----------------
Instance ID: elastic:3ced01c83a90f9cc [OK]
Total Runs: 80
Metric Samples: Last Run: 192, Total: 15,360
Events: Last Run: 0, Total: 1
Service Checks: Last Run: 2, Total: 160
Average Execution Time : 314ms
file_handle
-----------
Instance ID: file_handle [OK]
Total Runs: 79
Metric Samples: Last Run: 5, Total: 395
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 0, Total: 0
Average Execution Time : 0s
io
--
Instance ID: io [OK]
Total Runs: 80
Metric Samples: Last Run: 65, Total: 5,155
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 0, Total: 0
Average Execution Time : 4ms
kubelet (3.2.1)
---------------
Instance ID: kubelet:d884b5186b651429 [OK]
Total Runs: 79
Metric Samples: Last Run: 813, Total: 64,969
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 4, Total: 316
Average Execution Time : 2.926s
kubernetes_state (4.4.0)
------------------------
Instance ID: kubernetes_state:eb37b157b3acc891 [OK]
Total Runs: 80
Metric Samples: Last Run: 4,716, Total: 379,882
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 39, Total: 3,221
Average Execution Time : 2.605s
load
----
Instance ID: load [OK]
Total Runs: 80
Metric Samples: Last Run: 6, Total: 480
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 0, Total: 0
Average Execution Time : 0s
memory
------
Instance ID: memory [OK]
Total Runs: 80
Metric Samples: Last Run: 17, Total: 1,360
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 0, Total: 0
Average Execution Time : 0s
network (1.11.0)
----------------
Instance ID: network:e0204ad63d43c949 [OK]
Total Runs: 80
Metric Samples: Last Run: 188, Total: 15,148
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 0, Total: 0
Average Execution Time : 20ms
ntp
---
Instance ID: ntp:b4579e02d1981c12 [OK]
Total Runs: 80
Metric Samples: Last Run: 1, Total: 80
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 1, Total: 80
Average Execution Time : 12ms
redisdb (1.12.0)
----------------
Instance ID: redisdb:43418dba289c2b1b [OK]
Total Runs: 79
Metric Samples: Last Run: 166, Total: 7,870
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 1, Total: 79
Average Execution Time : 193ms
uptime
------
Instance ID: uptime [OK]
Total Runs: 80
Metric Samples: Last Run: 1, Total: 80
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 0, Total: 0
Average Execution Time : 0s
========
JMXFetch
========
Initialized checks
==================
no checks
Failed checks
=============
no checks
=========
Forwarder
=========
Transactions
============
CheckRunsV1: 80
Dropped: 0
DroppedOnInput: 0
Events: 0
HostMetadata: 0
IntakeV1: 8
Metadata: 0
Requeued: 0
Retried: 0
RetryQueueSize: 0
Series: 0
ServiceChecks: 0
SketchSeries: 0
Success: 192
TimeseriesV1: 80
API Keys status
===============
API key ending with 5c695: API Key valid
==========
Endpoints
==========
https://app.datadoghq.com - API Key ending with:
- 5c695
==========
Logs Agent
==========
Logs Agent is not running
=========
Aggregator
=========
Checks Metric Sample: 575,189
Dogstatsd Metric Sample: 4.1 M
Event: 6
Events Flushed: 6
Number Of Flushes: 80
Series Flushed: 564,400
Service Check: 4,978
Service Checks Flushed: 4,999
=========
DogStatsD
=========
Event Packets: 0
Event Parse Errors: 0
Metric Packets: 4.1 M
Metric Parse Errors: 0
Service Check Packets: 0
Service Check Parse Errors: 0
Udp Packet Reading Errors: 0
Udp Packets: 4.1 M
Uds Origin Detection Errors: 0
Uds Packet Reading Errors: 0
Uds Packets: 0
=====================
Datadog Cluster Agent
=====================
- Could not detect the Datadog Cluster Agent's endpoint: permanent failure in clusterAgentClient: retry number exceeded
- Could not retrieve the version of the Datadog Cluster Agent.
root@ip-192-168-174-0:/#
Hey @texasbones11 - Thanks for opening this. My bet is that the kube-state-metrics check is responsible for this higher footprint. Because we need to collect over 4000 metrics every 15 seconds it might impact the CPU on this node.
kubernetes_state (4.4.0)
------------------------
Instance ID: kubernetes_state:eb37b157b3acc891 [OK]
Total Runs: 80
Metric Samples: Last Run: 4,716, Total: 379,882
Now, this is just an hypothesis, could you open a ticket with our solutions team so we can get to the bottom of this ?
Thanks for your patience. Best, .C
Thank you for your reply @CharlyF
I have ticket request 236080 open with datadog support.
Ticket has been closed on the support side. Feel free to re-open it if the issue persists/re-appears.
Closing this.
What came of this? I'm having the same issue with k8s 1.22.15 and datadog agent v7.36.0 and chart v3.3.2