Skip to content

Instantly share code, notes, and snippets.

@alq666
Created June 18, 2012 16:06
Show Gist options
  • Save alq666/2949133 to your computer and use it in GitHub Desktop.
Save alq666/2949133 to your computer and use it in GitHub Desktop.
warmsys patch
Changes in HEAD
Modified checks/system.py
diff --git a/checks/system.py b/checks/system.py
index ba1828f..535aa13 100644
--- a/checks/system.py
+++ b/checks/system.py
@@ -574,6 +574,7 @@ class Cpu(object):
if sys.platform == 'linux2':
mpstat = subprocess.Popen(['mpstat', '1', '3'], stdout=subprocess.PIPE, close_fds=True).communicate()[0]
+ logger.debug('getCPUStats: mpstat ran => %s' % mpstat)
# topdog@ip:~$ mpstat 1 3
# Linux 2.6.32-341-ec2 (ip) 01/19/2012 _x86_64_ (2 CPU)
#
Modified tests/test_system.py
@alq666
Copy link
Author

alq666 commented Jun 18, 2012

Run this to increase logging when gather CPU stats

cd /usr/share/datadog/agent/
curl -L https://gist.github.com/raw/2949133/73d7d3f6f8b178e247e5a074bd01e2c7afde6dfa/system.py.diff | sudo patch -p1
sudo /etc/init.d/datadog-agent restart

@alq666
Copy link
Author

alq666 commented Jun 18, 2012

You should see something like this in /tmp/dd-agent.log

2012-06-18 16:20:17,185 - checks - DEBUG - getCPUStats: mpstat ran => Linux 2.6.32-41-server (dogdev0)  06/18/2012      _x86_64_        (4 CPU)

04:20:14 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
04:20:15 PM  all    4.79    9.32    0.50    0.00    0.00    0.25    0.00    0.00   85.14
04:20:16 PM  all    0.50    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.50
04:20:17 PM  all    0.75    0.00    0.00    0.00    0.00    0.25    0.00    0.00   98.99
Average:     all    2.01    3.10    0.17    0.00    0.00    0.17    0.00    0.00   94.56

2012-06-18 16:20:17,185 - checks - DEBUG - Cannot extract cpu value %user from ['Average:', 'all', '2.01', '3.10', '0.17', '0.00', '0.00', '0.17', '0.00', '0.00', '94.56'] (['04:20:14', 'CPU', '%usr', '%nice', '%sys', '%iowait', '%irq', '%soft', '%steal', '%guest', '%idle'])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment