cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 7

Windows Mount Points via SNMP – How to.

If like me you are somewhat startled by the fact you cannot monitor mount point in the same way as a normal logical disk, read on.

It is possible without using an expensive APM license, by using a custom poller and a bit of freeware middleware.

This basically started when we created our new exchange environment. As the need to separate out our data across multiple LUNS increased we went past the alphabetical disk limit so had to switch to mount points. All of a sudden we are in a heap of pain as we can no longer get snmp alerting when our log drives are not cleared down or the databases run out of space. It is not that much of a problem with the log drives as the store dismounts. If the database can’t grow, mail starts to get bounced and that is a serious issue.

After spending some time on this I came up with the following and it works well.

Download SNMPtools from http://erwan.l.free.fr/snmptools/

/

Update 23-05-13

http://erwan.labalec.fr/

/


Put the correct snmptools dll in the system root of the server to be monitored. Run the reg file to install the reg keys. Ours are 64bit servers so we used the 32bit dll and the WOW6432 reg file. The reg file adds a link to snmptools under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\ExtensionAgents

It then creates its own key for the path to the dll and some of its own settings.

Note1: the debug option is extremely useful.

Note2: the wow6432 reg file has an error in it, the line..

"snmptools"="SOFTWARE\\snmptools\\CurrentVersion"

Should read

"snmptools"="SOFTWARE\\Wow6432Node\\snmptools\\CurrentVersion"

Now you need to create a vbs script file to check your mount point free space or basically anything else you want to return.. This script returns the percentage of free space to 2 decimal places.

Mountpoint.vbs

strComputer = "."

MountPoint = Wscript.Arguments(0)

Set objWMIService = GetObject("winmgmts:" _

    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colDisks = objWMIService.ExecQuery _

    ("Select name, FreeSpace, Capacity from Win32_Volume")

For Each objDisk in colDisks

    If objDisk.Name = MountPoint then

                Wscript.Echo Round(((100/objDisk.Capacity)*ObjDisk.FreeSpace),2)

End if     

Next

Now create your ini file as referenced in the registry.. Below is the first line of our file which is monitoring the mountpoint located c:\mount\Lun_ExSgJournal

Counters.ini

[1.3.6.1.4.1.15.1]

type=exec

counter=cscript C:\mountpoints.vbs C:\mount\Lun_ExSgJournal\ //nologo

Restart the SNMP service

Now create a custom poller with the OID of 1.3.6.1.4.1.15.1 using Get, and link it to your node. You can test SNMPtools are working by getting OID 1.3.6.1.4.1.15 for a test string. Don’t forget that debug setting in the registry, you need to restart SNMP service after you switch it, you will probably need it.

Lastly don’t forget to set up your alerting.

A special thanks to Erwan for his very very very useful dll.

Tags (1)
0 Kudos
9 Replies
Level 7

I can't get the vbs script working...

0 Kudos

Is their any way you can provide me with step-by-step instructions on how to accomplish this? I'm a newbie at this and I don't have a clue on how to do this. For example, in your instructions you say to use "Get" to create a new poller. I don't even know what Get or what a poller is. Thanks.

0 Kudos

Get is how the Universal Device Poller will pull the OID. 

 

This video will show you how to use the Universal Device Poller and add an OID, search MIBs, Transform a MIB result, and create a Table to show on your Website.

http://www.solarwinds.com/resources/democenter/Orion/UniversalDevicePollerIntro/index.html?CMP=ILC-T...

0 Kudos
Level 7

In the VBscript can you have a variable to pick up multiple mount points and report on.

Example:

location is

G:\mnt\Dept01

G:\mnt\Dept02

G:\mnt\Dept03

G:\mnt\Dept04

We need to report free space for each.

0 Kudos
Level 7

Thanks, it helped me a lot!

Wiht SNMPwalk it works fine.

Do you know can i graph this data using Cacti?

What do you use to poll it.

 

Thanks in advance

0 Kudos

Well we use Solarwinds an d a custom poller to retrive and graph the data.

I did a bit of googling for you and it seems it should be possible with Cacti. You need to copy the Generic OID Template and change the OID to the one you found in SNMPWalk.

It seems you can debug the output by going into Settings and selecting the log level in Debug, this should provide info in the cacti.log

Might be worth a post on the forums here..http://forums.cacti.net

Google luck, once you have the WMI to SNMP working fully you can grab almost anything from you windows servers.. If what you are after isn't available from WMI you can write a custom script, eg using powershell or vbs, to store in the registry and pull out into SNMP like in this post..

 

 

Cheers

 

Chris

0 Kudos

Thank very much Chris,

I tried using Cacti Generic OID Template, but it dosen't work. I'm still making some tests...

I publised on the Cacti's forums, but no answer yet.

 

I think that the hardest part was done with your script.

I'll just post an idea to retrieve used space im GB,  just changing the line

Wscript.Echo Round ...

to

Wscript.Echo Round(((ObjDisk.Capacity-ObjDisk.FreeSpace)/(1204*1024*1024)),2)

 

Thanks.

 

Rafael.

0 Kudos

I resolved Cacti graphs, changing the poller from cmd.php to spine and rebuilding the poller cache.

I used SNMP Generic OID Template to build the datasources.

Thank a lot Chris!

0 Kudos
Level 13

Chris--

Thanks for the information on this--very helpful.

M

0 Kudos