From 3a0177be29e10ed17cb283ff856173f5c7532868 Mon Sep 17 00:00:00 2001 From: Peter Iannucci Date: Sat, 27 Jul 2013 19:19:41 -0400 Subject: [PATCH] xen_cpus now detects number of cpus --- debian/changelog | 6 ++++++ .../share/xvm-munin-host-config/plugins/xen_cpu | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) 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'] -- 1.7.9.5