| | | Junior 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("CredWindows omainAndUserid") sWinPass = Context.GetProperty("CredWindows assword") 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
=========================================================== |
| | | | Junior Member
       
Group: Forum Members Last Login: 9/30/2008 8:33:41 AM Posts: 10, Visits: 139 |
| Bump... |
| | | | Forum 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.
|
| |
|
|