Windows Cluster - Determine disk usage with Win32_LogicalDisk

I need to monitor the disk usage in a Active/Passive Win 2003/SQL server cluster; 2 boxes one is active and one is passive.  I have an executeable that uses "SELECT * From Win32_LogicalDisk" to get disk information. This works just fine on other Win 2003 Servers and XP boxes.  However, when running this in the cluster, no disk information is returned.

Each cluster box has a C: and a D: drive, then it shares some Powervault drives.  I know very little about how the cluster works, but I would expect to at least get info on the C: and D: drives.

Does anyone have any ideas?  Thanks.
hexvaderAsked:
Who is Participating?
 
hexvaderConnect With a Mentor Author Commented:
Thanks for all the hints.  I finally figured things out. The "Win32_LogicalDisk" select works just fine. The code had to know which box was active and which was passive, then handle the results properly.
0
 
mass2612Commented:
Hi,

Here is a script that monitors local disk space from a list of servers from a file called input.txt and writes the info out to a CSV file DiskReport.csv.




Const HARD_DISK = 3
InputFile = "Input.txt" ' defines name and path of file
OutPutFile = "DiskReport.csv"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objInputFile = objFSO.OpenTextFile(InputFile) ' opens text file object
Set objOutputFile = objFSO.CreateTextFile(OutputFile)
objOutputFile.WriteLine "Computer Name," & "Device," & "Free Disk Space"
 
Do Until objInputFile.AtEndOfStream          ' sets beginning of loop to process all servers listed in input file
 
strComputer = (objInputFile.Readline)
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
Set colDisks = objWMIService.ExecQuery _
    ("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK & "")
 
For Each objDisk in colDisks
    WScript.Echo "Computer Name: " & vbtab & strComputer
    Wscript.Echo "DeviceID: "& vbTab &  objDisk.DeviceID       
    Wscript.Echo "Free Disk Space: "& vbTab & objDisk.FreeSpace/1024/1024/1024
    objOutputFile.Writeline strComputer & "," & objDisk.DeviceID & "," & objDisk.FreeSpace/1024/1024/1024
Next
Loop

Open in new window

0
 
hexvaderAuthor Commented:
I essentially have this, except i am using an executable (C#.NET, .NET 1.1) and do not specifily the drive type.  I write this to an XML file.

What I am looking for is more information on a windows cluster such as how it manages disk drives and why the "Select * from Win32_LogicalDisk" does not return any information. I am able to get memory and CPU information;  "SELECT * From Win32_OperatingSystem" and "SELECT * From Win32_Processor" respectively. I find it odd not to get the disk info.

Any other ideas?

Thanks.
0
 
Ted BouskillSenior Software DeveloperCommented:
Clusters use a shared virtual drive.  What that means is that both servers are connected to the drive with the Active server having full control.  When the passive server becomes 'Active' it takes ownership of the drive.
0
All Courses

From novice to tech pro — start learning today.