diff options
author | Micah Anderson <micah@riseup.net> | 2011-03-25 00:25:28 -0400 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2011-03-25 00:25:28 -0400 |
commit | 4b0487fbea9e4fb828e618182215df0318b7ed1e (patch) | |
tree | ebc06f3da869c9ffa83b5ea929e6ddfa82245c14 /files/plugins/xen_mem | |
parent | d4ca996f8e6d28d7c8f8ad2c922d6205c6b94dcb (diff) | |
parent | 17df63f17e1aab4c15584b41fbe7fe925503e054 (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_mem')
-rw-r--r-- | files/plugins/xen_mem | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/files/plugins/xen_mem b/files/plugins/xen_mem index 5e985a5..16d91cf 100644 --- a/files/plugins/xen_mem +++ b/files/plugins/xen_mem @@ -43,7 +43,10 @@ #%# family=auto #%# capabilities=autoconf -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 @@ -60,7 +63,7 @@ if [ "$1" = "config" ]; then echo 'graph_info This graph shows affected memory for each domain.' echo 'Domain_0.label Domain-0' echo 'Domain_0.draw AREA' -$XM list | grep -v 'Mem' | grep -v 'Domain-0' | while read i; do +cat /var/lib/munin/plugin-state/xm_list.state | grep -v 'Mem' | grep -v 'Domain-0' | while read i; do name=`echo $i | awk '{ print $1 }' | sed 's/[\/.-]/_/g'` echo -n "$name.label " echo $i | awk '{ print $1 }' @@ -70,7 +73,7 @@ done exit 0 fi -$XM list | grep -v 'Mem' | while read i; do +cat /var/lib/munin/plugin-state/xm_list.state | grep -v 'Mem' | while read i; do name=`echo $i | awk '{ print $1 }' | sed 's/[\/.-]/_/g'` echo -n "$name.value " echo $i | awk '{ print $3 * 1024 * 1024 }' |