MRTG - DISKSPACE script

#!/bin/sh
# Get diskspace and inode consumption for MRTG.
# by Jeff Liebermann 04/15/98
#
# usage: script_name Filesystem
# i.e. script_name /dev/root
#
# The format belched by df -v -i
# Mount Dir Filesystem blocks used free %used iused ifree %iused
# / /dev/root 1050000 972132 77868 93% 59872 71384 46%
# /stand /dev/boot 30000 16414 13586 55% 14 3746 1%
# /u /dev/u 600000 252560 347440 43% 4259 70741 6%
# /usr/spool /dev/news 184492 5830 178662 4% 8 23056 1%
#
# Grab last line of df -v -i and remove percent signs
drivel=`df -v -i $1 | tail -1 | tr -d %` # just one Filesystem
# Break apart into fields using IFS seperators
set $drivel
# Print % diskspace used, percent % used, filler, filler.
# The $6 and $9 are the 6th and 9th fields of the df output.
echo "$6\n$9\n0\n0"

-----

# Part of mrtg.cfg
Target[rdf.1]: `dff.sh /dev/root`
Title[rdf.1]: Comix Disk Useage /dev/root
PageTop[rdf.1]: <H1>Comix Disk Useage /dev/root</H1>
Options[rdf.1]: growright, gauge, nopercent
MaxBytes[rdf.1]:100
Unscaled[rdf.1]: dwmy
YLegend[rdf.1]: % Used
ShortLegend[rdf.1]: %
Legend1[rdf.1]: Avg Percent Diskspace Used
Legend2[rdf.1]: Avg Percent Inodes Used
LegendI[rdf.1]: Diskspace
LegendO[rdf.1]: Inodes

computer2know :: thank you for your visit :: have a nice day :: © 2018