aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido G√ľnther <agx@sigxcpu.org>2008-11-06 12:49:39 +0100
committerGuido Guenther <agx@sigxcpu.org>2008-11-06 12:49:39 +0100
commit112825e85a5d5a56673cb93c824cff8fe12481aa (patch)
tree6e92c22111c1b19e372de1688554e1c0151b21a9
parentb586c14ef9d461003a2227639b0fa33682e847ad (diff)
parent4c1513b20fe86924f721c4b9f6d87c0bda5d98b8 (diff)
Merge branch 'master' into debian
-rw-r--r--Makefile6
-rw-r--r--libvirt-blkstat20
-rw-r--r--libvirt-cputime20
-rw-r--r--libvirt-ifstat20
-rw-r--r--libvirt-mem22
5 files changed, 69 insertions, 19 deletions
diff --git a/Makefile b/Makefile
index 64ef6b3..f972c82 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION=0.0.3
+VERSION=0.0.4
PKG=munin-libvirt-plugins
PLUGINDIR=/usr/share/munin/plugins/
@@ -23,5 +23,7 @@ check: $(PYFILES)
clean:
rm -f *.py *.pyc
-dist:
+dist: clean check
git-archive --format=tar --prefix=$(PKG)-$(VERSION)/ HEAD | gzip -c > ../$(PKG)-$(VERSION).tar.gz
+
+.PHONY: clean check dist install
diff --git a/libvirt-blkstat b/libvirt-blkstat
index c88d8a4..42ec1b4 100644
--- a/libvirt-blkstat
+++ b/libvirt-blkstat
@@ -30,8 +30,14 @@ graph_info This graph shows the block device I/O of the virtual machines"""
conn = libvirt.openReadOnly(uri)
ids = conn.listDomainsID()
for id in ids:
- dom = conn.lookupByID(id)
- name = dom.name()
+ try:
+ dom = conn.lookupByID(id)
+ name = dom.name()
+ except libvirt.libvirtError, err:
+ print >>sys.stderr, "Id: %s: %s" % (id, err)
+ continue
+ if name == "Domain-0":
+ continue
print "%s_read.label %s" % (canon(name), name)
print "%s_read.type DERIVE" % canon(name)
print "%s_read.min 0" % canon(name)
@@ -75,8 +81,14 @@ def fetch_values(uri):
for id in ids:
rd = 0
wr = 0
- dom = conn.lookupByID(id)
- name = dom.name()
+ try:
+ dom = conn.lookupByID(id)
+ name = dom.name()
+ except libvirt.libvirtError, err:
+ print >>sys.stderr, "Id: %s: %s" % (id, err)
+ continue
+ if name == "Domain-0":
+ continue
disks = get_disks(dom)
for disk in disks:
try:
diff --git a/libvirt-cputime b/libvirt-cputime
index 86394ac..9684cdc 100644
--- a/libvirt-cputime
+++ b/libvirt-cputime
@@ -40,8 +40,14 @@ total_pc.critical 95"""
conn = libvirt.openReadOnly(uri)
ids = conn.listDomainsID()
for id in ids:
- dom = conn.lookupByID(id)
- name = dom.name()
+ try:
+ dom = conn.lookupByID(id)
+ name = dom.name()
+ except libvirt.libvirtError, err:
+ print >>sys.stderr, "Id: %s: %s" % (id, err)
+ continue
+ if name == "Domain-0":
+ continue
print "%s_cputime.label %s" % (canon(name), name)
print "%s_cputime.type DERIVE" % canon(name)
print "%s_cputime.min 0" % canon(name)
@@ -56,8 +62,14 @@ def fetch_values(uri):
processors = float(conn.getInfo()[2])
for id in ids:
- dom = conn.lookupByID(id)
- name = dom.name()
+ try:
+ dom = conn.lookupByID(id)
+ name = dom.name()
+ except libvirt.libvirtError, err:
+ print >>sys.stderr, "Id: %s: %s" % (id, err)
+ continue
+ if name == "Domain-0":
+ continue
cputime = float(dom.info()[4])
cputime_percentage = 1.0e-7 * cputime / processors
total += cputime_percentage
diff --git a/libvirt-ifstat b/libvirt-ifstat
index 25ce452..4fd2f93 100644
--- a/libvirt-ifstat
+++ b/libvirt-ifstat
@@ -30,8 +30,14 @@ graph_info This graph shows the network I/O of the virtual machines"""
conn = libvirt.openReadOnly(uri)
ids = conn.listDomainsID()
for id in ids:
- dom = conn.lookupByID(id)
- name = dom.name()
+ try:
+ dom = conn.lookupByID(id)
+ name = dom.name()
+ except libvirt.libvirtError, err:
+ print >>sys.stderr, "Id: %s: %s" % (id, err)
+ continue
+ if name == "Domain-0":
+ continue
print "%s_rx.label %s" % (canon(name), name)
print "%s_rx.type DERIVE" % canon(name)
print "%s_rx.min 0" % canon(name)
@@ -75,8 +81,14 @@ def fetch_values(uri):
for id in ids:
rd = 0
wr = 0
- dom = conn.lookupByID(id)
- name = dom.name()
+ try:
+ dom = conn.lookupByID(id)
+ name = dom.name()
+ except libvirt.libvirtError, err:
+ print >>sys.stderr, "Id: %s: %s" % (id, err)
+ continue
+ if name == "Domain-0":
+ continue
ifaces = get_ifaces(dom)
for iface in ifaces:
try:
diff --git a/libvirt-mem b/libvirt-mem
index c7bf63d..0c2073c 100644
--- a/libvirt-mem
+++ b/libvirt-mem
@@ -55,8 +55,14 @@ total_pc.critical 95""" % dict(hostname=hostname)
ids = conn.listDomainsID()
draw = "AREA"
for id in ids:
- dom = conn.lookupByID(id)
- name = dom.name()
+ try:
+ dom = conn.lookupByID(id)
+ name = dom.name()
+ except libvirt.libvirtError, err:
+ print >>sys.stderr, "Id: %s: %s" % (id, err)
+ continue
+ if name == "Domain-0":
+ continue
print "%s_mem.label %s" % (canon(name), name)
print "%s_mem.type GAUGE" % canon(name)
print "%s_mem.min 0" % canon(name)
@@ -77,11 +83,17 @@ def fetch_values(uri):
hostmem = conn.getInfo()[1] * 1024 * 1024
print "host_mem.value %d" % hostmem
for id in ids:
- dom = conn.lookupByID(id)
- name = dom.name()
+ try:
+ dom = conn.lookupByID(id)
+ name = dom.name()
+ except libvirt.libvirtError, err:
+ print >>sys.stderr, "Id: %s: %s" % (id, err)
+ continue
+ if name == "Domain-0":
+ continue
mem = dom.info()[2] * 1024
- total += mem
print "%s_mem.value %d" % (canon(name), mem)
+ total += mem
print "total.value %d" % total
print "total_pc.value %.0f" % (100.0 * total / float(hostmem))
return 0