From: Peter Iannucci Date: Sat, 27 Jul 2013 23:19:41 +0000 (-0400) Subject: xen_cpus now detects number of cpus X-Git-Tag: 0.0.16^0 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/xvm-munin-config.git/commitdiff_plain/3a0177be29e10ed17cb283ff856173f5c7532868?ds=inline xen_cpus now detects number of cpus --- diff --git a/debian/changelog b/debian/changelog index ffd9285..13c6f1f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +xvm-munin-config (0.0.16) precise; urgency=low + + * xen_cpu now detects the number of cpus. + + -- Peter Iannucci Sat, 27 Jul 2013 19:18:00 -0400 + xvm-munin-config (0.0.15) precise; urgency=low * Updating the xen API python import. diff --git a/host/usr/share/xvm-munin-host-config/plugins/xen_cpu b/host/usr/share/xvm-munin-host-config/plugins/xen_cpu index 788333e..644c0d0 100755 --- a/host/usr/share/xvm-munin-host-config/plugins/xen_cpu +++ b/host/usr/share/xvm-munin-host-config/plugins/xen_cpu @@ -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']