summaryrefslogtreecommitdiff
path: root/files/plugins/xen_vm
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2011-03-25 00:25:28 -0400
committerMicah Anderson <micah@riseup.net>2011-03-25 00:25:28 -0400
commit4b0487fbea9e4fb828e618182215df0318b7ed1e (patch)
treeebc06f3da869c9ffa83b5ea929e6ddfa82245c14 /files/plugins/xen_vm
parentd4ca996f8e6d28d7c8f8ad2c922d6205c6b94dcb (diff)
parent17df63f17e1aab4c15584b41fbe7fe925503e054 (diff)
Merge remote-tracking branch 'immerda/master'
Conflicts: manifests/host.pp manifests/host/cgi.pp manifests/plugin.pp manifests/plugin/deploy.pp manifests/plugins/apache.pp manifests/plugins/base.pp manifests/plugins/dom0.pp manifests/plugins/gentoo.pp manifests/plugins/interfaces.pp manifests/plugins/linux.pp manifests/plugins/openbsd.pp manifests/plugins/physical.pp manifests/plugins/selinux.pp manifests/plugins/vserver.pp
Diffstat (limited to 'files/plugins/xen_vm')
-rw-r--r--files/plugins/xen_vm7
1 files changed, 6 insertions, 1 deletions
diff --git a/files/plugins/xen_vm b/files/plugins/xen_vm
index a0dc0b7..a69b5fe 100644
--- a/files/plugins/xen_vm
+++ b/files/plugins/xen_vm
@@ -45,6 +45,11 @@
XM="/usr/sbin/xm"
+# we cache xm list for 5 min for perfomance reasons
+((find /var/lib/munin/plugin-state/xm_list.state -mmin -5 2>&1 | grep -qE '^\/var\/lib\/munin\/plugin-state\/xm_list\.state$') && \
+ [ `cat /var/lib/munin/plugin-state/xm_list.state | wc -l` -gt 1 ]) || \
+ /usr/sbin/xm list | grep -v "^Name .* Console$" > /var/lib/munin/plugin-state/xm_list.state
+
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
@@ -61,7 +66,7 @@ if [ "$1" = "config" ]; then
exit 0
fi
-domains=`$XM list | wc -l`
+domains=`cat /var/lib/munin/plugin-state/xm_list.state | wc -l`
echo -n "domains.value "
echo $(($domains-2))