Page 1 of 1

MRTG Config Files

Posted: Mon Feb 20, 2006 8:05 pm
by cheesyboofs
Done most myself, just having a bit of trouble with the free drive space ones wondered if I could pinch yours? :oops:

http://www.cheesyboofs.co.uk/mrtg-nas/

Posted: Tue Feb 21, 2006 5:31 pm
by ShALLaX
mrtg.conf:

Code: Select all

Title[hda2]: /dev/hda2 Disk Usage
Target[hda2]: `sh /bin/mrtg-disk hda2`
PageTop[hda2]: <h1>/dev/hda2 Disk Usage</h1>
MaxBytes[hda2]: 10079453184
Unscaled[hda2]: dwmy
YLegend[hda2]: Bytes
LegendI[hda2]: Used
LegendO[hda2]: Free
Options[hda2]: gauge growright noinfo nobanner
ShortLegend[hda2]: Bytes
Legend1[hda2]: Used
Legend2[hda2]: Free
/bin/mrtg-disk:

Code: Select all

#!/bin/bash

case "$1" in

hda2)
   echo `df | grep /dev/hda2 | awk '{ print $3 }'` "* 1024" | bc
   echo `df | grep /dev/hda2 | awk '{ print $4 }'` "* 1024" | bc
;;
esac

Posted: Tue Feb 21, 2006 7:25 pm
by cheesyboofs
:wink:

Posted: Tue Sep 26, 2006 10:31 am
by cheesyboofs
Wonder if you can help? I'm getting this error when I run the script.
services / # ./usr/bin/mrtg etc/mrtg/hda2-free.cfg
/bin/mrtg-disk: line 9: syntax error: unexpected end of file
WARNING: Could not get any data from external command 'sh /bin/mrtg-disk hda2'
Maybe the external command did not even start. (Illegal seek)

WARNING: Problem with External get 'sh /bin/mrtg-disk hda2':
Expected a Number for 'in' but nothing'

WARNING: Problem with External get 'sh /bin/mrtg-disk hda2':
Expected a Number for 'out' but nothing'

ERROR: Target[hda2][_IN_] ' $target->[0]{$mode} ' did not eval into defined data
ERROR: Target[hda2][_OUT_] ' $target->[0]{$mode} ' did not eval into defined data
services / # cat etc/mrtg/hda2-free.cfg

Code: Select all

WorkDir: /var/www/localhost/htdocs/mrtg
Title[hda2]: /dev/hda2 Disk Usage
Target[hda2]: `sh /bin/mrtg-disk hda2`
PageTop[hda2]: <h1>/dev/hda2 Disk Usage</h1>
MaxBytes[hda2]: 10079453184
Unscaled[hda2]: dwmy
YLegend[hda2]: Bytes
LegendI[hda2]: Used
LegendO[hda2]: Free
Options[hda2]: gauge growright noinfo nobanner
ShortLegend[hda2]: Bytes
Legend1[hda2]: Used
Legend2[hda2]: Free

services / # cat /bin/mrtg-disk

Code: Select all


#!/bin/bash

case "$1" in

hda2)
   echo `df | grep /dev/hda2 | awk '{ print $3 }'` "* 1024" | bc
   echo `df | grep /dev/hda2 | awk '{ print $4 }'` "* 1024" | bc
;;
services / #
Regards

Posted: Tue Sep 26, 2006 12:29 pm
by ShALLaX
Nice catch...

Code: Select all

echo "esac" >> /bin/mrtg-disk
Sorry! Original post updated.