Skip to content

Commit

Permalink
prevent duplicate graphs and unify line style
Browse files Browse the repository at this point in the history
  • Loading branch information
zivillian authored and sumpfralle committed Aug 17, 2020
1 parent 113008b commit 00f8fce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions plugins/libvirt/kvm_io
Expand Up @@ -33,12 +33,11 @@ graph_args --base 1024
print "%s_read.label %s" % (vm, vm)
print "%s_read.type COUNTER" % vm
print "%s_read.min 0" % vm
print "%s_read.draw LINE1" % vm
print "%s_read.info I/O used by virtual machine %s" % (vm, vm)
print "%s_read.graph no" % vm
print "%s_write.label %s" % (vm, vm)
print "%s_write.type COUNTER" % vm
print "%s_write.min 0" % vm
print "%s_write.draw LINE1" % vm
print "%s_write.negative %s_read" % (vm, vm)
print "%s_write.info I/O used by virtual machine %s" % (vm, vm)

Expand All @@ -51,14 +50,12 @@ def clean_vm_name(vm_name):
suffix = os.getenv('vmsuffix')
if suffix:
vm_name = re.sub(suffix,'',vm_name)

parts = vm_name.split('\x00')
if (parts[0].endswith('kvm')):
try:
return parts[parts.index('-name')+1]
except ValueError:
pass

return re.sub(r"[^a-zA-Z0-9_]", "_", vm_name)

def fetch(vms):
Expand Down
5 changes: 1 addition & 4 deletions plugins/libvirt/kvm_net
Expand Up @@ -82,12 +82,11 @@ def config(vm_names):
print("%s_in.label %s" % (vm, vm))
print("%s_in.type COUNTER" % vm)
print("%s_in.min 0" % vm)
print("%s_in.draw LINE2" % vm)
print("%s_in.graph no" % vm)
print("%s_out.negative %s_in" % (vm, vm))
print("%s_out.label %s" % (vm, vm))
print("%s_out.type COUNTER" % vm)
print("%s_out.min 0" % vm)
print("%s_out.draw LINE2" % vm)


def clean_vm_name(vm_name):
Expand All @@ -100,14 +99,12 @@ def clean_vm_name(vm_name):
suffix = os.getenv("vmsuffix")
if suffix:
vm_name = re.sub(suffix, "", vm_name)

parts = vm_name.split('\x00')
if (parts[0].endswith('kvm')):
try:
return parts[parts.index('-name')+1]
except ValueError:
pass

return re.sub(r"[^a-zA-Z0-9_]", "_", vm_name)


Expand Down

0 comments on commit 00f8fce

Please sign in to comment.