WMI Disk Queue Monitor

WMI Disk Queue Monitor

Hi,

I have a working WMI disk queue monitor. Here's the files and changes to opmanager conf files you need to make:

Script (goes in conf\application\scripts):

' Check command line parameters

On Error Goto 0
Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
'On Error Resume Next
Select Case WScript.Arguments.Count
Case 1
strComputer = Wscript.Arguments(0)
Set wbemServices = objWbemLocator.ConnectServer(strComputer,"Root\CIMV2")

Case 3
strComputer = Wscript.Arguments(0)
strUsername = Wscript.Arguments(1)
strPassword = Wscript.Arguments(2)
Set wbemServices = objWbemLocator.ConnectServer(strComputer,"Root\CIMV2",strUsername,strPassword)

Case Else
strMsg = "Error # in parameters passed"
WScript.Echo strMsg
WScript.Quit(0)

End Select

if Err.Number Then
WScript.Echo vbCrLf & "Error # " & _
" " & Err.Description
End If
On Error GoTo 0

'On Error Resume Next
Set colItems = wbemServices.ExecQuery("Select * from Win32_PerfFormattedData_PerfDisk_PhysicalDisk",,48)
if Err.Number Then
WScript.Echo vbCrLf & "Error # " & _
" " & Err.Description
End If
On Error GoTo 0

For Each objItem in colItems
strMsg = RemoveWhiteSpace(objItem.Name) & vbTab
If (objItem.Name <> "_Total") Then
strMsg = Mid(strMsg, 2)
End If
strMsg = strMsg & objItem.CurrentDiskQueueLength

WScript.Echo strMsg
Next

Function RemoveWhiteSpace(strText)
Dim RegEx
Set RegEx = New RegExp
RegEx.Pattern = "\s+"
RegEx.Multiline = True
RegEx.Global = True
strText = RegEx.Replace(strText,"")
RemoveWhiteSpace = strText
End Function


























































opmanager_graphinfo.xml:

<DEFAULTGRAPH Name="DiskQueueLength">
<YAXISTEXT>Queue Length</YAXISTEXT>
<DISPLAYNAME>WMI Disk Queue Length</DISPLAYNAME>
<name>DiskQueueLength</name>
<Vendor>WMI</Vendor>
<Description>Monitors Disk Queue Length</Description>
<oid>DiskQueueLength</oid>
<Provider>WMI</Provider>
<Monitor>Resource</Monitor>
<type>multiple</type>
<interval>300</interval>
<THRESHOLDENABLED>false</THRESHOLDENABLED>
</DEFAULTGRAPH>















HostResource.xml (put in each OS section, only tested with 2003 and 2000):

<CATEGORY ID="DiskQueueLength" command="diskqlen.vbs" parseAll="true" ignoreLines="2" description="WMI Disk Queue Length">
<ENTITY ID="CurrentQueueLength" storeValue="curValue" storeHistory="true" units="length">
<PARSE token="2" name="curValue"/>
</ENTITY>
</CATEGORY>







I haven't decided on how often to check these stats, currently it is every 5 minutes, and since i don't mind if there are spikes in the disk queue length, but would want to know if there was a trend of prolonged disk queue lengths that might work.

I have some questions for OpManager Tech Support:

1. How often do you think a monitor of this nature should be checked? Is there any danger of overloading either the target machine or the opmanager server if you set the checking interval too low? Is 1 minute the lowest you can go?

2. Currently the graphs for every "node" of this monitor shows on one graph. Is there any way to get it to display on seperate graphs? See the picture below for an illustration of what it looks like.


















                  New to ADSelfService Plus?