Hi Janice,

Thanks for this.  I will have a look at this probe, but I was planning on doing 
more than just disk space with the custom VBscript probe, this first step was 
just a test for Intermapper's VBscript functionality.

Regards,
Ben Nuttall

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Janice Losgar
Sent: Tuesday, 20 January 2009 3:34 a.m.
To: 'InterMapper Discussion'
Subject: RE: [IM-Talk] Having Trouble with VBscript Probe

Hi Ben,

Since you are new to InterMapper, I want to be sure you know that you can
use the Host Resources probe to retrieve disk space, CPU and memory stats
from a Windows machine. This is an SNMP probe, so it would require you to
install SNMP on the target machines, which is quite simple to do on Windows.
It might be easier than using a command-line probe.

Regards,

Janice Losgar
Dartware, LLC

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ben Nuttall
Sent: Sunday, January 18, 2009 4:30 PM
To: [email protected]
Subject: [IM-Talk] Having Trouble with VBscript Probe

Hi,

Fairly new to Intermapper, have written a couple of other probes but am
having trouble with this one.  Anyone's help or thoughts would be much
appreciated.

I have the probe set up for a few windows servers, which it's monitoring
fine most of the time.  The top message is from a successful probe,
following a failed probe 30 seconds earlier.  The "Response time: XXX msec"
in the "Condition:" field I found interesting - the timeout for the probe is
std 3sec so it's not timing out.

I can run the script using cscript every 30secs outside of Intermapper and
it returns a value consistently.

This failure to return a value, and as such going into the warning state,
happens every 1-4 hours.

The VB script & probe are below the messages.

Cheers,
Ben.


==================================================================
Success Message
==================================================================
01/19 08:47:56: Message from InterMapper 5.0.6

Event: OK
Name: 192.168.10.20
Document: Disk Space
Address: 192.168.10.20
Probe Type: Windows FreeSpace
Condition: C: OK (22324MB)


==================================================================
Failure Message
==================================================================
01/19 08:47:31: Message from InterMapper 5.0.6

Event: Warning
Name: 192.168.10.20
Document: Disk Space
Address: 192.168.10.20
Probe Type: Windows FreeSpace
Condition: Response time: 2219 msec


==================================================================
Probe
==================================================================

<!--
Comand Line FreeSpace probe (com.testprobe.freespace)
-->

<header>
type="cmd-line"
package="com.testprobe"
probe_name="FreeSpace"
human_name="Windows FreeSpace"
version="1.1"
address_type="IP,AT"
</header>

<description>
\GB\FreeSpace\p\

This probe lets you test the free space of a Windows Share using a custom VB
script.  It passes the IP address of the host ($ADDRESS) and the drive
letter ($DRIVELETTER), along with warning, alarm and critical values, to a
script which attempts to access the drive and check for space.

This probe loads the VB script "wmi_freespace.vbs" from the "tools" folder
under "intermapper settings".
</description>

<parameters>
NUMBER_OF_DRIVES="1"
DRIVELETTER_1="C"
WARN_MB_1="2048"
ALARM_MB_1="1024"
CRITICAL_MB_1="512"
DRIVELETTER_2="D"
WARN_MB_2="0"
ALARM_MB_2="0"
CRITICAL_MB_2="0"
DRIVELETTER_3="E"
WARN_MB_3="0"
ALARM_MB_3="0"
CRITICAL_MB_3="0"
</parameters>

<command-line>
-- Empty path forces the InterMapper Settings:Tools directory
path=""
cmd="c:\windows\system32\cscript.exe -nologo "c:\program
files\intermapper\intermapper settings\tools\wmi_FreeSpace.vbs""
arg="${ADDRESS} ${NUMBER_OF_DRIVES} ${DRIVELETTER_1} ${WARN_MB_1}
${ALARM_MB_1} ${CRITICAL_MB_1} ${DRIVELETTER_2} ${WARN_MB_2} ${ALARM_MB_2}
${CRITICAL_MB_2} ${DRIVELETTER_3} ${WARN_MB_3} ${ALARM_MB_3}
${CRITICAL_MB_3}"
</command-line>

<command-data>
-- Currently unused.
</command-data>

<command-exit>
critical:${EXIT_CODE}=3
alarm:${EXIT_CODE}=2
warn:${EXIT_CODE}=1
okay:${EXIT_CODE}=0
</command-exit>

<output>
</output>


==================================================================
VB Script (wmi_freespace.vbs)
==================================================================

Set objArgs = WScript.Arguments

Dim strComputer
Dim intNumberOfDrives
Dim strDriveLetter(99)
Dim intWarn(99)
Dim intAlarm(99)
Dim intCritical(99)
Dim intFreeMB(99)
Dim intStatus(99)
Dim strStatus(99)
Dim intProbe
Dim strProbe

intProbe = 0
strComputer = objArgs(0)
intNumberOfDrives = objArgs(1)

Dim i,k
For i = 1 To intNumberOfDrives
        k = (i * 4) - 2
        strDriveLetter(i) = objArgs(k)
        intWarn(i) =  objArgs(k+1)
        intAlarm(i) = objArgs(k+2)
        intCritical(i) =  objArgs(k+3)
Next

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"
& strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery("Select * from Win32_LogicalDisk")
For Each objDisk In colDisks
        For i = 1 To intNumberOfDrives
            If Lcase(objDisk.DeviceID) = Lcase(strDriveLetter(i)) & ":" then
                intFreeMB(i) = Round((objDisk.FreeSpace / 1024 / 1024),0)
                        If (intCritical(i) - intFreeMB(i))>0 Then
                            'strStatus(i) = strDriveLetter(i) & ": CRITICAL
(" & intFreeMB(i) & " MB free, Threshold was "  & intCritical(i) & " MB)"
                            strStatus(i) = strDriveLetter(i) & ": CRITICAL
(" & intFreeMB(i) & "MB)"
                            If intProbe < 3 Then intProbe = 3
                        ElseIf (intAlarm(i) - intFreeMB(i))>0 then
                            'strStatus(i) = strDriveLetter(i) & ": ALARM ("
& intFreeMB(i) & " MB free, Threshold was "  & intAlarm(i) & " MB)"
                            strStatus(i) = strDriveLetter(i) & ": ALARM (" &
intFreeMB(i) & "MB)"
                            If intProbe < 2 Then intProbe = 2
                        ElseIf (intWarn(i) - intFreeMB(i))>0 Then
                            'strStatus(i) = strDriveLetter(i) & ": WARN (" &
intFreeMB(i) & " MB free, Threshold was " & intWarn(i) & " MB)"
                            strStatus(i) = strDriveLetter(i) & ": WARN (" &
intFreeMB(i) & "MB)"
                            If intProbe < 1 Then intProbe = 1
                        Else
                            'strStatus(i) = strDriveLetter(i) & ": OK (" &
intFreeMB(i) & " MB free)"
                            strStatus(i) = strDriveLetter(i) & ": OK (" &
intFreeMB(i) & "MB)"
                            If intProbe < 0 Then intProbe = 0
                        End If
                        if strProbe = "" then strProbe = strStatus(i) Else
strProbe = strProbe & VbCrLf & strStatus(i)
            End If
        Next
Next

WScript.Echo(strProbe)
WScript.Quit(intProbe)

==================================================================
----
Unison uses e-mail as a fast and relatively informal means of communication.
The information transmitted in this e-mail is intended only for the person
or entity to which it is addressed, and may contain confidential and/or
privileged material.  If in doubt as to the official status of a message, or
if you want formal confirmation, please ask the sender.  We are not
responsible for any changes made to a message and/or any attachments after
sending.  If you have received this in error please contact the sender and
delete the material.
____________________________________________________________________
List archives:
http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [email protected]

____________________________________________________________________
List archives:
http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [email protected]

----
Unison uses e-mail as a fast and relatively informal means of communication.  
The information transmitted in this e-mail is intended only for the person or 
entity to which it is addressed, and may contain confidential and/or privileged 
material.  If in doubt as to the official status of a message, or if you want 
formal confirmation, please ask the sender.  We are not responsible for any 
changes made to a message and/or any attachments after sending.  If you have 
received this in error please contact the sender and delete the material.
____________________________________________________________________
List archives:
http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [email protected]

Reply via email to