[mrtg] Re: Disk Free Space on Volume

Justin Shore listuser at vinnie.ksu.ksu.edu
Tue Feb 15 21:23:25 MET 2000


I just finished a working setup last night to do just this.  I setup 
mine to monitor disk usage in megabytes (which is actually useful). 
Here's one of the output pages:

http://ipgate.sktc.net/stats/sktc/du-var-server1.html

Depending on your setup, this graph may be a little boring.  Here's 
the relevant part of my config:

Target[du-home-server1]: `rsh server.somewhere ~/scripts/home-used.pl`
Title[du-home-server1]:  	Server1 /home Disk Usage
MaxBytes[du-home-server1]: 	2865
Unscaled[du-home-server1]:	dwmy
PageTop[du-home-server1]:
LegendI[du-home-server1]:  		MBs used
LegendO[du-home-server1]:
#Legend1[du-home-server1]:  		MBs used
Legend2[du-home-server1]:
YLegend[du-home-server1]: 		Megabytes used
ShortLegend[du-home-server1]: 	of 2865
Options[du-home-server1]: 		gauge


And finally, here's the perl script I used:

#!/usr/bin/perl

foreach $_ (`df -k | grep "/home"`)
{
   ($device, $size, $used, $free, $percent, $mount) = split(/\s+/);
   $value = ($used / 1024);
   chomp($value);
   printf ("%.0f\n", "$value");
   printf ("0\n");
   $uptime = `uptime`;
   $uptime =~ /up (.*?),/;
   $up = $1;
   print "$up\n";
   print "server.somewhere\n";
}

This returns the value in megabytes.  MRTG can graph anything as long 
as it returns 4 lines, in/out/uptime/hostname, correct?  Using that 
logic, I have MRTG graphing 1 number which happens to be my disk 
usage in megabytes.  I'm sure there a prettier ways to do this but 
this is how I did it.  Feel free to do whatever you wish to it.  BTW, 
use SSH if you can.  I didn't have time to get it functioning without 
a passwd last night when I did this so I used rsh with tcp_wrappers. 
How you do this in Novell?  Beats me but those steps above should 
help you out.  What type of box is MRTG running on?  If its Linux it 
will be a breeze to do.

Good luck!
  Justin

At 1:59 PM -0500 2/15/00, Christian Terek wrote:
>That isn't correct, Maxbytes is a measurement in bytes so the vvalue you
>have would give a max value of 33.8 megs (as I understand it).
>
>The max value you can use is around 2146000000 which is 2.15 gigs.
>Unfortunately the code doesn't support more than this (I wish it did I don't
>know of any hack though).  I think what you can do is set it up as the value
>you have and then divide the output by something to scale it down.
>
>
>-----Original Message-----
>From: Sarah Woerdeman <swoerdeman at fbfs.com>
>To: mrtg at list.ee.ethz.ch <mrtg at list.ee.ethz.ch>
>Date: Tuesday, February 15, 2000 1:40 PM
>Subject: [mrtg] Disk Free Space on Volume
>
>
>  >
>  >
>  >I am monitoring the free space using Novell's mib
>1.3.6.1.4.1.23.2.28.2.14.1.4.1
>  >and am getting data. However, the data I am getting is not being reported
>  >correctly. I have my maxbytes setup as the max on the volume, and am not
>sure if
>  >this is correct.
>  >Volume space is 33.8 GB.
>  >MaxBytes set at 33800000. Is this correct?
>  >
>  >Thank you
>  >Sarah W


--
Justin Shore
K-State Linux Distro Mirror, Sysadmin
macdaddy at vinnie.ksu.ksu.edu
<http://vinnie.ksu.ksu.edu/mirror/rpm2html>
<ftp://vinnie.ksu.ksu.edu/pub/mirror/linux>

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:mrtg-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/mrtg



More information about the mrtg mailing list