Changeset 1779
- Timestamp:
- Nov 25, 2008, 10:47:04 PM (16 years ago)
- Location:
- trunk/packages/xvm-munin-config
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/xvm-munin-config/debian/changelog
r1777 r1779 1 xvm-munin-config (0.0.5) unstable; urgency=low 2 3 * Fix typos in xen_cpu script for XenAPI code 4 * Bump theoretical CPU max to 64x 5 * Show domain CPU weight and cap if available 6 7 -- Quentin Smith <quentin@mit.edu> Tue, 25 Nov 2008 22:46:12 -0500 8 1 9 xvm-munin-config (0.0.4) unstable; urgency=low 2 10 -
trunk/packages/xvm-munin-config/host/usr/share/xvm-munin-host-config/plugins/xen_cpu
r1777 r1779 1 1 #!/usr/bin/python 2 2 3 from xen.xm.main import SERVER_LEGACY_XMLRPC, SERVER_XEN_API, parseServer 3 from xen.xm.main import SERVER_LEGACY_XMLRPC, SERVER_XEN_API, parseServer, parseAuthentication 4 4 from xen.xend import sxp 5 import atexit 5 6 6 7 serverType, serverURI = parseServer() … … 31 32 ret = {} 32 33 if serverType == SERVER_XEN_API: 33 domains = server.xenap u.VM.get_all_records()34 domains = server.xenapi.VM.get_all_records() 34 35 metrics = server.xenapi.VM_metrics.get_all_records() 35 36 for d in domains.values(): … … 38 39 'domid': d['domid'], 39 40 'uuid': d['uuid'], 41 # No equivalent 40 42 } 41 43 return ret … … 43 45 domains = server.xend.domains_with_state(True, 'all', True) 44 46 for d in domains: 45 ret[sxp.child_value(d, 'uuid', 'NONE').replace('-', '_')] = {'name': sxp.child_value(d, 'name', 'UNKNOWN'), 46 'cpu_time': sxp.child_value(d, 'cpu_time', 0.0), 47 'domid': sxp.child_value(d, 'domid', -1), 48 'uuid': sxp.child_value(d, 'uuid', 'NONE'), 49 } 47 data = {'name': sxp.child_value(d, 'name', 'UNKNOWN'), 48 'cpu_time': sxp.child_value(d, 'cpu_time', 0.0), 49 'domid': sxp.child_value(d, 'domid', -1), 50 'uuid': sxp.child_value(d, 'uuid', 'NONE'), 51 } 52 try: 53 sched = server.xend.domain.sched_credit_get(data['name']) 54 data['sched-credit'] = sched 55 except: 56 data['sched-credit'] = None 57 ret[sxp.child_value(d, 'uuid', 'NONE').replace('-', '_')] = data 50 58 return ret 51 59 … … 63 71 name = domains[d]['name'] 64 72 if name[0:2] == 'd_': 65 name = ' user domain'73 name = 'db domid %d' % domains[d]['domid'] 66 74 print "%s.label %s" % (d, name) 67 75 if domains[d]['domid'] == 0: … … 69 77 else: 70 78 print "%s.draw STACK" % d 71 print "%s.max 5000" % d79 print "%s.max 19200000000" % d # 64x 100% CPU usage 72 80 print "%s.min 0" % d 73 81 print "%s.type DERIVE" % d 74 print "%s.info %s" % (d, domains[d]['uuid']) 82 if domains[d].get('sched-credit'): 83 print "%s.info uuid %s CPU weight %d cap %d%%" % (d, domains[d]['uuid'], domains[d]['sched-credit']['weight'], domains[d]['sched-credit']['cap']) 84 else: 85 print "%s.info uuid %s" % (d, domains[d]['uuid']) 75 86 print "%s.cdef %s,10000,/" % (d, d) 76 87 sys.exit(0)
Note: See TracChangeset
for help on using the changeset viewer.