[mrtg] Re: Monitoring Disk Usage In Win2k

(Verstrooid) Profke profke at easynet.be
Mon May 19 18:43:16 MEST 2003

volume name
> .  == volume name of drive x

> . == block size  (byte) of drive x

> . == total blocks of drive x

> . == used blocks of drive x

bytes = blocksize*number of blocks.

I use this script.
it returns the used, and free space on a drive, with index number $disknbr

(you can modify it for your own purposes)
my @snmpoutput = `snmputil get localhost public
my $blocksize = $snmpoutput[1];
chop $blocksize;
$blocksize =~ s/^.*Integer32[\t ]*(\d*).*$/$1/;

my @snmpoutput = `snmputil get localhost public
my $totalblocks = $snmpoutput[1];
chop $totalblocks;
$totalblocks =~ s/^.*Integer32[\t ]*(\d*).*$/$1/;

my @snmpoutput = `snmputil get localhost public
my $usedblocks = $snmpoutput[1];
chop $usedblocks;
$usedblocks =~ s/^.*Integer32[\t ]*(\d*).*$/$1/;

print $usedblocks*$blocksize . "\n";
print $freeblocks*$blocksize . "\n";
print localtime();
print "\ndiskspace\n";

Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the mrtg mailing list