1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-25 18:38:30 +00:00

Convert to UNIX line breaks

This commit is contained in:
Stig Sandbeck Mathisen 2014-10-04 19:53:20 +02:00
parent c04671c43a
commit b531bd5797

View file

@ -1,33 +1,33 @@
#!/bin/sh #!/bin/sh
# #
# (c)2009, Christian Kujau <lists@nerdbynature.de> modified by dano229 # (c)2009, Christian Kujau <lists@nerdbynature.de> modified by dano229
# Based on the 'homedirs' plugin, initially written in Perl by Philipp Gruber <pg@flupps.net> # Based on the 'homedirs' plugin, initially written in Perl by Philipp Gruber <pg@flupps.net>
# #
# We still need a cronjob to update CACHEFILE once in a while, e.g.: # 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 # 0 * * * * root [ -O /tmp/munin-du_multidirs.cache ] && du -sk /dir /dir2 dir3/* > /tmp/munin-du_multidirs.cache
# #
CACHEFILE=/tmp/munin-du_multidirs.cache CACHEFILE=/tmp/munin-du_multidirs.cache
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
echo yes echo yes
exit 0 exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title Directory usage' echo 'graph_title Directory usage'
echo 'graph_args --base 1024 -l 1' echo 'graph_args --base 1024 -l 1'
echo 'graph_vlabel Bytes' echo 'graph_vlabel Bytes'
echo 'graph_category disk' echo 'graph_category disk'
echo 'graph_info This graph shows the size of several directories' echo 'graph_info This graph shows the size of several directories'
awk '!/lost\+found/ {print $2 }' $CACHEFILE | sort | while read label; do awk '!/lost\+found/ {print $2 }' $CACHEFILE | sort | while read label; do
field=`echo "$label" | sed 's/^[^A-Za-z_]/_/' | sed 's/[^A-Za-z0-9_]/_/g'` field=`echo "$label" | sed 's/^[^A-Za-z_]/_/' | sed 's/[^A-Za-z0-9_]/_/g'`
echo "$field".label "$label" echo "$field".label "$label"
echo "$field".draw LINE1 echo "$field".draw LINE1
# echo "$field".warning 0 # echo "$field".warning 0
# echo "$field".critical 0 # echo "$field".critical 0
done done
exit 0 exit 0
fi fi
awk '!/lost\+found/ { sub(/[^a-zA-Z_]/,"_",$2); gsub(/[^a-zA-Z0-9_]/,"_",$2); print $2".value "$1 * 1024 }' $CACHEFILE | sort -r -n -k2 awk '!/lost\+found/ { sub(/[^a-zA-Z_]/,"_",$2); gsub(/[^a-zA-Z0-9_]/,"_",$2); print $2".value "$1 * 1024 }' $CACHEFILE | sort -r -n -k2