diff options
author | mh <mh@immerda.ch> | 2010-08-11 09:59:09 +0200 |
---|---|---|
committer | mh <mh@immerda.ch> | 2010-08-11 09:59:09 +0200 |
commit | 0d5407168827cb293abd9f0b5ecd406b16783f01 (patch) | |
tree | 08be0e8abbcb8f85cf030d5f6fdbc79efe39c562 /files/plugins/xen_vm | |
parent | 3ccc8e2495a66ae9681bef64a4034a0e7828bf14 (diff) |
introduce caching for xen plugins
calls to the xen binaries such as xm are quite heavy and we
therefore cache now a lot of the data that is generated for these
plugins and use them as well for the other ones.
Diffstat (limited to 'files/plugins/xen_vm')
-rw-r--r-- | files/plugins/xen_vm | 7 |
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)) |