xen_cpus now detects number of cpus iannucci 0.0.16
authorPeter Iannucci <iannucci@mit.edu>
Sat, 27 Jul 2013 23:19:41 +0000 (19:19 -0400)
committerPeter Iannucci <iannucci@mit.edu>
Mon, 29 Jul 2013 21:36:58 +0000 (17:36 -0400)
debian/changelog
host/usr/share/xvm-munin-host-config/plugins/xen_cpu

index ffd9285..13c6f1f 100644 (file)
@@ -1,3 +1,9 @@
+xvm-munin-config (0.0.16) precise; urgency=low
+
+  * xen_cpu now detects the number of cpus.
+
+ -- Peter Iannucci <iannucci@mit.edu>  Sat, 27 Jul 2013 19:18:00 -0400
+
 xvm-munin-config (0.0.15) precise; urgency=low
 
   * Updating the xen API python import.
index 788333e..644c0d0 100755 (executable)
@@ -6,6 +6,7 @@ from xen.xm.main import SERVER_LEGACY_XMLRPC, SERVER_XEN_API, parseServer, parse
 from xen.xend import sxp
 import atexit
 import sys
+import os
 
 serverType, serverURI = parseServer()
 
@@ -62,15 +63,19 @@ def getDomains():
             ret['uuid_'+sxp.child_value(d, 'uuid', 'NONE').replace('-', '_')] = data
         return ret
 
+cpus = os.sysconf('SC_NPROCESSORS_CONF')
+
+upper_limit = cpus * 100
+
 if cmd == 'config':
     print """
 graph_title Xen domain CPU usage
-graph_args --base 1000 -r --lower-limit 0 --upper-limit 800
+graph_args --base 1000 -r --lower-limit 0 --upper-limit %d
 graph_vlabel %
 graph_scale no
 graph_info This graph shows how CPU time is spent by Xen domains.
 graph_category system
-graph_period second"""
+graph_period second""" % (upper_limit,)
     domains = getDomains()
     for d in sorted(domains):
         name = domains[d]['name']