[mrtg] Memory Usage with Changing Instances

Nico Kadel-Garcia nkadel at gmail.com
Wed Jul 23 09:27:06 CEST 2008

Steve Shipway wrote:
>> I've been trying to graph Physical Memory usage on a Windows 2003 Server
>> and run into a problem with changing OIDs.
> I know this problem, it's why I ended up first writing a special plug-in that compares hrStorageDescr to find the correct item, and finally used the NSClient agent on the windows server to query the drive (use mrtg-pnsclient.pl to query the NSClient agent).
> I don't think this is currently possible with native MRTG.  What you really want is something like WaLK(-1)hrStorageUsed to get the LAST entry (I think WaLKx will only get the Nth entry) but Tobi hasn't implemented this (yet).
> Also, you need to be a bit careful about hrStorageAllocationUnits so you'd want to multiply by this as well in order to get bytes.
> Probably the best thing is to use a script which retrieves the whole hrStorage tree, then identifies the correct item x by comparing against hrStorageDescr.x, and finally returning hrStorageUsed.x * hrStorageAllocationUnits.x (for space used) and  hrStorageSize.x * hrStorageAllocationUnits.x for the actual object size.
> I've quickly knocked together a script to do it in Perl (since I can't find my original script), attached below.  No guarantee for it working but it seems to do what it should here.  Use:
> Target[]: `mrtg-storage -H hostname -C snmpcommunity `
> to get a list of storage objects and
> Target[]: `mrtg-storage -H hostname -C snmpcommunity -v "objectname"`
> to get the MRTG output.  Run it from the command line first to make sure you have passed the correct parameters.
> Steve
There used to be a useful scripting tool for this called 
'cfgstoragemaker'. Unfortunately, it stopped working back around the 
release of RHEL 5, and I've never gotten it to work again. It 
successfully probed the devices and produced valid looking .cfg files, 
but MRTG itself had some problem I've never solved, actually using 
hrStorage values instead of numerical OID's. And I've never spent the 
time to get numerical OID's out of it.

If anyone can get that tool working again, for example by translating 
the hrStorage values to numerical OID's in the published .cfg file, I'd 
be thrilled. It was very useful for scanning and updating storage 
setttings on a regular basis.

More information about the mrtg mailing list