Tweak xen_net per comments from achernya
authorQuentin Smith <quentin@mit.edu>
Mon, 6 Jan 2014 07:12:40 +0000 (02:12 -0500)
committerQuentin Smith <quentin@mit.edu>
Mon, 6 Jan 2014 07:12:40 +0000 (02:12 -0500)
host/usr/share/xvm-munin-host-config/plugins/xen_net

index 822b3e0..96e2929 100755 (executable)
@@ -25,8 +25,9 @@ def live_vms():
 def get_dom(domid):
     data = dict(domid=domid)
     data['name'] = xsc.read('', '/local/domain/%d/name' % domid)
+    # /vm contains a path like "/vm/UUID"; strip the "/vm/"
     data['uuid'] = xsc.read('', '/local/domain/%d/vm' % domid)[4:]
-    if data['name'][0:2] == 'd_':
+    if data['name'].startswith('d_'):
         data['munin_name'] = 'db domid %d' % domid
     else:
         data['munin_name'] = data['name']
@@ -77,12 +78,12 @@ if __name__ == '__main__':
 
     if cmd == 'config':
         print """
-    graph_title Xen domain network usage
-    graph_args --base 1000
-    graph_vlabel bits in (-) / out (+) per ${graph_period}
-    graph_info This graph shows how network is utilized by Xen domains.
-    graph_category network
-    graph_period second"""
+        graph_title Xen domain network usage
+        graph_args --base 1000
+        graph_vlabel bits in (-) / out (+) per ${graph_period}
+        graph_info This graph shows how network is utilized by Xen domains.
+        graph_category network
+        graph_period second"""
         for d in sorted(domains):
             for direction in ('down', 'up'):
                 key = "%s_%s" % (d, direction)