#!/bin/sh

#%# family=manual

DF=/usr/sbin/df
TAIL=/usr/bin/tail 

if [ "$1" = "config" ]; then

        echo 'graph_title Filesystem usage (in %)'
        echo 'graph_args --upper-limit 100'
		echo 'graph_category disk'
        $DF -k -l | $TAIL +2 | while read i; do
                name=`echo $i | sed 's/[\/.]/_/g' | awk '{ print $6 }' | $TAIL -15c`
                printf "$name.label "
                echo $i | awk '{ print $6 }'
                printf "$name.warn "
                echo 95
        done
        exit 0
fi

$DF -k -l | $TAIL +2 | while read i; do
        name=`echo $i | sed 's/[\/.]/_/g' | awk '{ print $6 }' | $TAIL -15c`
        printf "$name.value "
        echo $i | awk '{ print $5 }' | cut -f1 -d% 
done
