[mrtg] Re: Monitoring Disk Usage In Win2k
(Verstrooid) Profke
profke at easynet.be
Mon May 19 18:43:16 MEST 2003
legend
====================
volume name
> .1.3.6.1.2.1.25.2.3.1.3.x == volume name of drive x
> .1.3.6.1.2.1.25.2.3.1.4.x == block size (byte) of drive x
> .1.3.6.1.2.1.25.2.3.1.5.x == total blocks of drive x
> .1.3.6.1.2.1.25.2.3.1.6.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
host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageAllocationUnits.$diskn
br`;
my $blocksize = $snmpoutput[1];
chop $blocksize;
$blocksize =~ s/^.*Integer32[\t ]*(\d*).*$/$1/;
my @snmpoutput = `snmputil get localhost public
host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.$disknbr`;
my $totalblocks = $snmpoutput[1];
chop $totalblocks;
$totalblocks =~ s/^.*Integer32[\t ]*(\d*).*$/$1/;
my @snmpoutput = `snmputil get localhost public
host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.$disknbr`;
my $usedblocks = $snmpoutput[1];
chop $usedblocks;
$usedblocks =~ s/^.*Integer32[\t ]*(\d*).*$/$1/;
$freeblocks=$totalblocks-$usedblocks;
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