Tuesday, October 27, 2009

/dev/mapper/VolGroup00-LogVol00 & MRTG


A little script, edited from the original which I found on the internet many years ago, in order to graph HDD used space when you are using LVM


#!/bin/sh

PATH=/bin:/usr/bin

# The available HDD space as "incoming"

## Avai
df /dev/mapper/VolGroup00-LogVol00 | tail -1 | awk '{print $3}'
## Used
df /dev/mapper/VolGroup00-LogVol00 | tail -1 | awk '{print $2}'
uptime | cut -d, -f 1 | awk '{print $3, $4}'
echo $df | awk '{print $1}'

# EoF #

And the mrtg.cfg snip using the script:

Target[df-root]: `mrtg-df-local.sh`
Options[df-root]: nopercent,nobanner,nolegend,noinfo,integer,gauge
kmg[df-root]:kB,MB,GB
Title[df-root]: Disk use for / partition
PageTop[df-root]: Disk use /
YLegend[df-root]: 1k blocks
ShortLegend[df-root]:  
LegendI[df-root]: avail 
LegendO[df-root]: used 

Labels: , ,

0 Comments:

Post a Comment

<< Home