Using command-line tools with WhatsUp Active and Performance monitors

Sometimes you just can’t get the information you’re looking for from SNMP or WMI and need to use proprietary command-line tools.

Here’s a way using VBScript to run those command line tools and get the information from them into WhatsUp.

This script uses the “exec” method to launch navicli to collect the utilization on a Clariion storage processor.

'The command-line will run on the local server
strComputer = ""

strOptions="getcache -busy"

'This is the address of the EMC SAN device
strEMCAddress = Context.GetProperty("Address")

'This is the path to the navi CLI on the monitoring server
strNaviCLIbin="""C:\Program Files\EMC\Navisphere CLI\NaviSECCli.exe"""

' Use the Windows credentials for the command line from within WhatsUp
strUsername = Context.GetProperty("CredWindows:DomainAndUserid")
strPassword = Context.GetProperty("CredWindows:Password")

'Chop off the domain from the username

'The command to send
strCommand= strNaviCLIbin & " -t " & intCommandTimeoutinSecs & " -User " & strUsername & " -Password " & strPassword & " -Scope 0 -Address " & strEMCAddress & " " & strOptions

'Timestamp before starting the script
startTime = Timer()

'Run the command to collect

'Create an array from the data returned so we can pick out the value
arrRawOutput=split(strRawOutput," ")

'Pick out the value from the text returned (chomping off the carriage return)

context.logmessage "Value=" & strResult

'Timestamp at the end of the script
endTime = Timer()

' Work out how long it took
Duration = Int((endTime-startTime)*1000)

context.logmessage "Got value " & strResult & " (script took=" & Duration & "ms)"

'Set the result to graph
Context.SetValue strResult

function runCommand(strCommand)

	Set objShell = CreateObject("wscript.Shell")
	context.logmessage strCommand
	Set objExec = objShell.Exec (strCommand)

	Do Until objExec.Status
		 sleep 1

	'context.logmessage objExec.StdOut.ReadAll()
end function

function sleep(intseconds)
	intstarttime = timer()
	while timer() < intstarttime+intseconds
end function

We’ve had to parse the output a little to get the value from the text that the command-line returned.

Tagged , , , ,

One thought on “Using command-line tools with WhatsUp Active and Performance monitors

  1. Tim Weiland says:

    Thanks for the script. With a little modification I was able to use the option “faults -list” along with a search for “The array is operating normally.” to replace the lost ability to poll status via SNMP on the new VNX line.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: