diff --git a/plugins/other/du_multidirs b/plugins/other/du_multidirs new file mode 100755 index 00000000..3c09996f --- /dev/null +++ b/plugins/other/du_multidirs @@ -0,0 +1,31 @@ +#!/bin/sh +# +# (c)2009, Christian Kujau +# Based on the 'homedirs' plugin, initially written in Perl by Philipp Gruber +# +# We still need a cronjob to update CACHEFILE once in a while, e.g.: +# 0 * * * * root [ -O /tmp/munin-du_multidirs.cache ] && du -sk /dir /dir2 dir3/* > /tmp/munin-du_multidirs.cache +# +CACHEFILE=/tmp/munin-du_multidirs.cache + +if [ "$1" = "autoconf" ]; then + echo yes + exit 0 +fi + +if [ "$1" = "config" ]; then + echo 'graph_title Directory usage (in MB)' + echo 'graph_args --base 1024 -l 1' + echo 'graph_vlabel Bytes' + echo 'graph_category disk' + echo 'graph_info This graph shows the size of several directories' + + awk '!/lost\+found/ {gsub(/\//,"_"); print $2 }' $CACHEFILE | sort | while read u; do + echo "$u".label `echo "$u" | sed 's/_/\//g'` +# echo "$u".warning 0 +# echo "$u".critical 0 + done + exit 0 +fi + +awk '!/lost\+found/ {gsub(/\//,"_"); print $2".value "$1 * 1024 }' $CACHEFILE | sort -r -n -k2