From f8cb26ea664391664a5e76644d5d952b0bd1ca34 Mon Sep 17 00:00:00 2001
From: Quentin Smith <quentin@mit.edu>
Date: Wed, 10 Aug 2011 09:52:17 -0400
Subject: [PATCH] Work around munin bug caused by names that start with a
 number

---
 debian/changelog                                   |    8 ++++++++
 .../share/xvm-munin-host-config/plugins/xen_cpu    |   14 +++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 4ac7abf..e384f3a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+xvm-munin-config (0.0.13) unstable; urgency=low
+
+  * Ensure that UUIDs begin with a letter and not a number, to work around
+    a Munin bug that breaks CDEFs for fields whose name begin with a
+    number.
+
+ -- Quentin Smith <quentin@mit.edu>  Wed, 10 Aug 2011 09:51:53 -0400
+
 xvm-munin-config (0.0.12) unstable; urgency=low
 
   * Use the .. perl operator to simplify the prerms.
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 2efffe4..06850cf 100755
--- a/host/usr/share/xvm-munin-host-config/plugins/xen_cpu
+++ b/host/usr/share/xvm-munin-host-config/plugins/xen_cpu
@@ -37,12 +37,12 @@ def getDomains():
         domains = server.xenapi.VM.get_all_records()
         metrics = server.xenapi.VM_metrics.get_all_records()
         for d in domains.values():
-            ret[d['uuid'].replace('-', '_')] = {'name': d['name_label'],
-                                                'cpu_time': sum(metrics[d['metrics']]['VCPUs_utilisation'].values()),
-                                                'domid': d['domid'],
-                                                'uuid': d['uuid'],
-                                                # No equivalent
-                                                }
+            ret['uuid_'+d['uuid'].replace('-', '_')] = {'name': d['name_label'],
+                                                        'cpu_time': sum(metrics[d['metrics']]['VCPUs_utilisation'].values()),
+                                                        'domid': d['domid'],
+                                                        'uuid': d['uuid'],
+                                                        # No equivalent
+                                                        }
         return ret
     else:
         domains = server.xend.domains_with_state(True, 'all', True)
@@ -57,7 +57,7 @@ def getDomains():
                 data['sched-credit'] = sched
             except:
                 data['sched-credit'] = None
-            ret[sxp.child_value(d, 'uuid', 'NONE').replace('-', '_')] = data
+            ret['uuid_'+sxp.child_value(d, 'uuid', 'NONE').replace('-', '_')] = data
         return ret
 
 if cmd == 'config':
-- 
1.7.9.5