8 Replies Latest reply: Nov 10, 2011 4:43 PM by sean.martinez RSS

Windows Mount Points via SNMP – How to.

chrisstyles

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.