summaryrefslogtreecommitdiff
path: root/files/plugins/xen
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
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')
-rwxr-xr-xfiles/plugins/xen11
1 files changed, 7 insertions, 4 deletions
diff --git a/files/plugins/xen b/files/plugins/xen
index 575cd3b..a9f1a1e 100755
--- a/files/plugins/xen
+++ b/files/plugins/xen
@@ -8,8 +8,6 @@
# autoconf (optinal - used by munin-config)
#
-MAXDOMAINS=16
-
if [ "$1" = "autoconf" ]; then
if which xm > /dev/null ; then
echo yes
@@ -19,6 +17,11 @@ if [ "$1" = "autoconf" ]; then
exit 1
fi
+# 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" = "config" ]; then
echo 'graph_title Xen Domain Utilerisation'
@@ -27,7 +30,7 @@ if [ "$1" = "config" ]; then
echo 'graph_vlabel mS'
echo 'graph_category xen'
echo 'graph_info This graph shows of many mS wall time where used by a domain'
- /usr/sbin/xm list | grep -v "^Name .* Console$" | \
+ cat /var/lib/munin/plugin-state/xm_list.state | \
while read name domid mem cpu state time console; do
name=`echo $name | sed -e"s/-/_/"`
echo "$name.label $name"
@@ -43,7 +46,7 @@ if [ "$1" = "config" ]; then
exit 0
fi
-/usr/sbin/xm list | grep -v "^Name" | grep -v "^Name .* Console$" | \
+cat /var/lib/munin/plugin-state/xm_list.state | \
while read name domid mem cpu state time console; do
name=`echo $name | sed -e"s/-/_/"`
time=`echo $time | sed -e "s/\.//"`