Specifying Disk in Low Disk Space Alert

To the Ipswitch web site

Ipswitch Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Specifying Disk in Low Disk Space AlertExpand / Collapse
Author
Message
Posted 11/16/2007 11:06:27 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 9/30/2008 8:33:41 AM
Posts: 10, Visits: 139
Hi All,

Were using WhatsUp Gold v11. Using the following script that I got from the scrpt library, the alerts work fine, but do not specify which disk specifically is over the threshold. I don't need to really specify the amount of disk space, just which drive is low (C,D,E...)

I'm not a programming guy so I'm trying to figure out a way to either alter the script or the action/alert so that it would state in the message which drive is low on space. I would really appreciate any help you all can provide.

BTW, I can't figure out how to disable the smiley faces in the code...

===========================================================

'Created 15/08/2006
'Author: Justin Hannan
'
'Description: Disk space check for less than a specified amount of disk space. Uses device credentials so it can be deployed easily
'across numerous domains for MSP environments
'Sending log message to the WhatsUp Event Viewer
Context.LogMessage "Checking Address=" & Context.GetProperty("Address")
'Set the result code of the check (0=Success, 1=Error)
Context.SetResult 0, "No error"
'Get server credentials and server address to use in WMI authentication
sWinUser = Context.GetProperty("CredWindowsomainAndUserid")
sWinPass = Context.GetProperty("CredWindowsassword")
Address = Context.GetProperty("Address")
Const CONVERSION_FACTOR = 1048576
'Threshold is MB free, change this value to alter the threshold for alerting
Const WARNING_THRESHOLD = 100
On Error Resume Next
' Connect to target machine via WMI and query
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer(Address,"root\cimv2",sWinUser, sWinPass)
Set objDiskDrives = objWMIService.ExecQuery ("SELECT * FROM Win32_LogicalDisk where DriveType=3")
For Each objDrive in objDiskDrives
      FreeMegaBytes = objDrive.FreeSpace / CONVERSION_FACTOR
         If FreeMegaBytes > WARNING_THRESHOLD Then
            Context.LogMessage "Drive " & objDrive.deviceID & "  is OK (" & INT(objDrive.FreeSpace / CONVERSION_FACTOR) & " MB Free)"
         End If
        If FreeMegaBytes < WARNING_THRESHOLD Then
          Context.SetResult 1, "Drive " & objDrive.deviceID & " has less than "&WARNING_THRESHOLD&" MB free space"
    End If
Nextg
===========================================================
 
Post #38631
Posted 11/21/2007 10:27:57 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 9/30/2008 8:33:41 AM
Posts: 10, Visits: 139
Bump...
Post #38758
Posted 11/21/2007 12:00:41 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 5/14/2008 2:16:04 PM
Posts: 25, Visits: 262
I believe it is not possible to receive variables from the active script to use in the alert message.

You would have to create different scripts with a descriptive name like "Disk Space Low on C:", and then only check for C: in that script.

Then do other Active script monitors for the other drives and apply all the monitors to the device.

You could also let the script output the drive results to a file, and create a separate action so when sending an email alert, a string like http://wug-server/scriptouput/%device-ip%/result.html is passed in the mail.Very bad, I know, but you would would be able to quickly see what drive fails.

Post #38763
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Dave, Mark Singh, kevin r gillis, Jason Benton, Brandon Felger, Ben Henderson, Tripp Allen, Will Sansbury, Jason Williams, Hush, FTPplanet.com, Hugh Garber, George Dailey, WUP-PM, mmulryan@ipswitch.com, mswimm

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 2:25pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.109. 9 queries. Compression Enabled.