X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/xvm-munin-config.git/blobdiff_plain/56328c0b20eb97049d9552298ac41f316a445a47..0e3a37c0643ef2fcb17883b78881f63ca16ea459:/host/usr/share/xvm-munin-host-config/plugins/xen_cpu 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 41472db..ecb68be 100755 --- a/host/usr/share/xvm-munin-host-config/plugins/xen_cpu +++ b/host/usr/share/xvm-munin-host-config/plugins/xen_cpu @@ -33,18 +33,20 @@ def getDomains(): domains = server.xenapu.VM.get_all_records() metrics = server.xenapi.VM_metrics.get_all_records() for d in domains.values(): - ret[d['uuid']] = {'name': d['name_label'], - 'cpu_time': sum(metrics[d['metrics']]['VCPUs_utilisation'].values()), - 'domid': d['domid'], - } + ret[d['uuid'].replace('-', '_')] = {'name': d['name_label'], + 'cpu_time': sum(metrics[d['metrics']]['VCPUs_utilisation'].values()), + 'domid': d['domid'], + 'uuid': d['uuid'], + } return ret else: domains = server.xend.domains_with_state(True, 'all', True) for d in domains: - ret[sxp.child_value(d, 'uuid', 'NONE')] = {'name': sxp.child_value(d, 'name', 'UNKNOWN'), - 'cpu_time': sxp.child_value(d, 'cpu_time', 0.0), - 'domid': sxp.child_value(d, 'domid', -1), - } + ret[sxp.child_value(d, 'uuid', 'NONE').replace('-', '_')] = {'name': sxp.child_value(d, 'name', 'UNKNOWN'), + 'cpu_time': sxp.child_value(d, 'cpu_time', 0.0), + 'domid': sxp.child_value(d, 'domid', -1), + 'uuid': sxp.child_value(d, 'uuid', 'NONE'), + } return ret if cmd == 'config': @@ -69,9 +71,10 @@ graph_period second""" print "%s.max 5000" % d print "%s.min 0" % d print "%s.type DERIVE" % d - print "%s.info %s" % (d, name) + print "%s.info %s" % (d, domains[d]['uuid']) + print "%s.cdef %s,10000,/" % (d, d) sys.exit(0) domains = getDomains() for d in sorted(domains): - print "%s.value %s" % (d, domains[d]['cpu_time']) + print "%s.value %s" % (d, long(domains[d]['cpu_time']*1000000))