From b531bd5797cc7251cbc648f8565fa5cc39ed7a3e Mon Sep 17 00:00:00 2001 From: Stig Sandbeck Mathisen Date: Sat, 4 Oct 2014 19:53:20 +0200 Subject: [PATCH] Convert to UNIX line breaks --- plugins/disk/du_multidirs | 66 +++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/plugins/disk/du_multidirs b/plugins/disk/du_multidirs index 61c40ac2..223bbb59 100755 --- a/plugins/disk/du_multidirs +++ b/plugins/disk/du_multidirs @@ -1,33 +1,33 @@ -#!/bin/sh -# -# (c)2009, Christian Kujau modified by dano229 -# 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' - 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/ {print $2 }' $CACHEFILE | sort | while read label; do - field=`echo "$label" | sed 's/^[^A-Za-z_]/_/' | sed 's/[^A-Za-z0-9_]/_/g'` - echo "$field".label "$label" - echo "$field".draw LINE1 -# echo "$field".warning 0 -# echo "$field".critical 0 - done - exit 0 -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 \ No newline at end of file +#!/bin/sh +# +# (c)2009, Christian Kujau modified by dano229 +# 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' + 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/ {print $2 }' $CACHEFILE | sort | while read label; do + field=`echo "$label" | sed 's/^[^A-Za-z_]/_/' | sed 's/[^A-Za-z0-9_]/_/g'` + echo "$field".label "$label" + echo "$field".draw LINE1 +# echo "$field".warning 0 +# echo "$field".critical 0 + done + exit 0 +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