[hobbit] software raid windows

Shea, Graeme A Shea.Graeme.A at edumail.vic.gov.au
Mon Jun 1 23:20:07 CEST 2009


You could use diskpart as the basis of a script. At a command prompt
type diskpart and then help to get a list of commands. Use the list disk
command to list your disks and then select disk <num> to select it. If
you want the status of a partition then you will have to select that as
well. The command detail will give you the disk (or partition) status
and if it is part of software raid.

To use as a basis of the scripting you could use the ping test from
deadcat or the dcdiags script I put on the shire.

There are also some scripts (I wrote some and you are welcome to them)
that query the event log. You could keep modify one of them to bring up
an alarm when ever certain events occur. 

http://www.mail-archive.com/nagios-users@lists.sourceforge.net/msg20038.
html gives an example of using Logparser to scan the event log for
Nagios.


As Raymond suggested WMI will give you some info. PrimalScript gives the
follow as an example of querying the disks, the status result may give
you what you need. 

'-----------------------------------------------------------------------
----------------------------------------
On Error Resume Next
Dim strComputer
Dim objWMIService
Dim propValue
Dim objItem
Dim SWBemlocator
Dim UserName
Dim Password
Dim colItems

strComputer = "."
UserName = ""
Password = ""
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService =
SWBemlocator.ConnectServer(strComputer,"root\CIMV2",UserName,Password)
Set colItems = objWMIService.ExecQuery("Select * from
Win32_DiskDrive",,48)
For Each objItem in colItems
	WScript.Echo "Availability: " & objItem.Availability
	WScript.Echo "BytesPerSector: " & objItem.BytesPerSector
	for each propValue in objItem.Capabilities
		WScript.Echo "Capabilities: " & propValue
	next
	for each propValue in objItem.CapabilityDescriptions
		WScript.Echo "CapabilityDescriptions: " & propValue
	next
	WScript.Echo "Caption: " & objItem.Caption
	WScript.Echo "CompressionMethod: " & objItem.CompressionMethod
	WScript.Echo "ConfigManagerErrorCode: " &
objItem.ConfigManagerErrorCode
	WScript.Echo "ConfigManagerUserConfig: " &
objItem.ConfigManagerUserConfig
	WScript.Echo "CreationClassName: " & objItem.CreationClassName
	WScript.Echo "DefaultBlockSize: " & objItem.DefaultBlockSize
	WScript.Echo "Description: " & objItem.Description
	WScript.Echo "DeviceID: " & objItem.DeviceID
	WScript.Echo "ErrorCleared: " & objItem.ErrorCleared
	WScript.Echo "ErrorDescription: " & objItem.ErrorDescription
	WScript.Echo "ErrorMethodology: " & objItem.ErrorMethodology
	WScript.Echo "FirmwareRevision: " & objItem.FirmwareRevision
	WScript.Echo "Index: " & objItem.Index
	WScript.Echo "InstallDate: " & objItem.InstallDate
	WScript.Echo "InterfaceType: " & objItem.InterfaceType
	WScript.Echo "LastErrorCode: " & objItem.LastErrorCode
	WScript.Echo "Manufacturer: " & objItem.Manufacturer
	WScript.Echo "MaxBlockSize: " & objItem.MaxBlockSize
	WScript.Echo "MaxMediaSize: " & objItem.MaxMediaSize
	WScript.Echo "MediaLoaded: " & objItem.MediaLoaded
	WScript.Echo "MediaType: " & objItem.MediaType
	WScript.Echo "MinBlockSize: " & objItem.MinBlockSize
	WScript.Echo "Model: " & objItem.Model
	WScript.Echo "Name: " & objItem.Name
	WScript.Echo "NeedsCleaning: " & objItem.NeedsCleaning
	WScript.Echo "NumberOfMediaSupported: " &
objItem.NumberOfMediaSupported
	WScript.Echo "Partitions: " & objItem.Partitions
	WScript.Echo "PNPDeviceID: " & objItem.PNPDeviceID
	for each propValue in objItem.PowerManagementCapabilities
		WScript.Echo "PowerManagementCapabilities: " & propValue
	next
	WScript.Echo "PowerManagementSupported: " &
objItem.PowerManagementSupported
	WScript.Echo "SCSIBus: " & objItem.SCSIBus
	WScript.Echo "SCSILogicalUnit: " & objItem.SCSILogicalUnit
	WScript.Echo "SCSIPort: " & objItem.SCSIPort
	WScript.Echo "SCSITargetId: " & objItem.SCSITargetId
	WScript.Echo "SectorsPerTrack: " & objItem.SectorsPerTrack
	WScript.Echo "SerialNumber: " & objItem.SerialNumber
	WScript.Echo "Signature: " & objItem.Signature
	WScript.Echo "Size: " & objItem.Size
	WScript.Echo "Status: " & objItem.Status
	WScript.Echo "StatusInfo: " & objItem.StatusInfo
	WScript.Echo "SystemCreationClassName: " &
objItem.SystemCreationClassName
	WScript.Echo "SystemName: " & objItem.SystemName
	WScript.Echo "TotalCylinders: " & objItem.TotalCylinders
	WScript.Echo "TotalHeads: " & objItem.TotalHeads
	WScript.Echo "TotalSectors: " & objItem.TotalSectors
	WScript.Echo "TotalTracks: " & objItem.TotalTracks
	WScript.Echo "TracksPerCylinder: " & objItem.TracksPerCylinder
Next

'-----------------------------------------------------------------------
---------------------------------------------

If you have just partitions mirrored then the following does the same
thing for the partitions

'-----------------------------------------------------------------------
-----------------------------------------

On Error Resume Next
Dim strComputer
Dim objWMIService
Dim propValue
Dim objItem
Dim SWBemlocator
Dim UserName
Dim Password
Dim colItems

strComputer = "."
UserName = ""
Password = ""
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService =
SWBemlocator.ConnectServer(strComputer,"root\CIMV2",UserName,Password)
Set colItems = objWMIService.ExecQuery("Select * from
Win32_DiskPartition",,48)
For Each objItem in colItems
	WScript.Echo "Access: " & objItem.Access
	WScript.Echo "Availability: " & objItem.Availability
	WScript.Echo "BlockSize: " & objItem.BlockSize
	WScript.Echo "Bootable: " & objItem.Bootable
	WScript.Echo "BootPartition: " & objItem.BootPartition
	WScript.Echo "Caption: " & objItem.Caption
	WScript.Echo "ConfigManagerErrorCode: " &
objItem.ConfigManagerErrorCode
	WScript.Echo "ConfigManagerUserConfig: " &
objItem.ConfigManagerUserConfig
	WScript.Echo "CreationClassName: " & objItem.CreationClassName
	WScript.Echo "Description: " & objItem.Description
	WScript.Echo "DeviceID: " & objItem.DeviceID
	WScript.Echo "DiskIndex: " & objItem.DiskIndex
	WScript.Echo "ErrorCleared: " & objItem.ErrorCleared
	WScript.Echo "ErrorDescription: " & objItem.ErrorDescription
	WScript.Echo "ErrorMethodology: " & objItem.ErrorMethodology
	WScript.Echo "HiddenSectors: " & objItem.HiddenSectors
	WScript.Echo "Index: " & objItem.Index
	WScript.Echo "InstallDate: " & objItem.InstallDate
	WScript.Echo "LastErrorCode: " & objItem.LastErrorCode
	WScript.Echo "Name: " & objItem.Name
	WScript.Echo "NumberOfBlocks: " & objItem.NumberOfBlocks
	WScript.Echo "PNPDeviceID: " & objItem.PNPDeviceID
	for each propValue in objItem.PowerManagementCapabilities
		WScript.Echo "PowerManagementCapabilities: " & propValue
	next
	WScript.Echo "PowerManagementSupported: " &
objItem.PowerManagementSupported
	WScript.Echo "PrimaryPartition: " & objItem.PrimaryPartition
	WScript.Echo "Purpose: " & objItem.Purpose
	WScript.Echo "RewritePartition: " & objItem.RewritePartition
	WScript.Echo "Size: " & objItem.Size
	WScript.Echo "StartingOffset: " & objItem.StartingOffset
	WScript.Echo "Status: " & objItem.Status
	WScript.Echo "StatusInfo: " & objItem.StatusInfo
	WScript.Echo "SystemCreationClassName: " &
objItem.SystemCreationClassName
	WScript.Echo "SystemName: " & objItem.SystemName
	WScript.Echo "Type: " & objItem.Type
Next

'-----------------------------------------------------------------------
------------------------------------------
Hope this helps

Regards
Graeme


-----Original Message-----
From: Gabriel Girardi Huber [mailto:gabriel at redix.com.br] 
Sent: Tuesday, 2 June 2009 6:21 AM
To: hobbit at hswn.dk
Subject: [hobbit] software raid windows

Hi,

Is there any way or script extern to monitor windows software raid?


Thanks.


To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe at hswn.dk



Important - This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments check them for viruses and defects. Regardless of any loss, damage or consequence, whether caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender, and not necessarily those of the Department of Education and Early Childhood Development.



More information about the Xymon mailing list