How do I monitor the status of a RAID array on an Intel controller from a Windows application?

19,957

Solution 1

I've been looking for this also. I have ICHxxx series controllers and am trying to get a contact at Intel to respond about the existance of a public API, but I'm not optimistic.

Here's what I've come up with for the short-term. Intel records the RAID events to the Windows Event Log under "IAANTmon". So you can use System.Diagnostics.EventLog, hooking the EventWrittenEventHandler, then filtering for "IAANTmon".

        EventLog eLog = new EventLog("Application");
        eLog.EntryWritten += new EntryWrittenEventHandler(OnEntryWrittenEvent);
        eLog.EnableRaisingEvents = true;

and

    public static void OnEntryWrittenEvent(object source, EntryWrittenEventArgs e)
    {
        if (e.Entry.Source == "IAANTmon")
        {
         ...
        }
    }

Solution 2

I've been looking into this as well, seems like smartmontools is the best option. Unfortunately, I didn't find a package that suits my .NET-needs and as it is just something basic, I didn't spend hours on finding a proper solution.

I resorted to starting "smartctl --scan" (part of smartmontools) at the start of my application (Process.Start), harvesting the list of devices from the output and then periodically starting "smartctl -H device-name" for each device.

This will return the SMART overal health test-results of the disk, as long as "PASSED" is returned, you should be safe.

While this is far from ideal, it does gives some indication of the health of my raid-disks.

Solution 3

As of 11/16/18, Windows 10, I've run into the same issue, needing to check raid status for intel Raid 10.

EJA's answer mostly worked - I did not get any logs written to source "IAANTmon", however.

At this point I used EJA's answer, but, filter by source "IAStorDataMgrSvc". This is where my raid event logs are written. Furthermore, I checked the messages contain either "Degraded" or "Rebuilding". This will exclude the startup events and pull logs such as "Volume Degraded", "Volume Rebuilding in progress", "Volume Rebuilding complete".

I ended up with something like:

private static void OnEntryWrittenEvent(object source, EntryWrittenEventArgs e)
      {
         if (e.Entry.Source == "IAStorDataMgrSvc"
            && (e.Entry.Message.Contains("Degraded")
            || e.Entry.Message.Contains("Rebuilding")))
         {
            // Show status message
         }
      }

At startup I also checked logs from previous few days incase a drive was flagged degraded while my program was not running -

foreach (var entry in eLog.Entries.Cast<EventLogEntry>()
               .Where(x => x.Source == "IAStorDataMgrSvc" 
                      && (x.TimeWritten - DateTime.Today).TotalDays < 3))
            {
               if (entry.Message.Contains("Degraded")
                  || entry.Message.Contains("Rebuilding"))
               {
                  // Show status message
               }
            }
Share:
19,957
Helgi
Author by

Helgi

.NET developer by day, Python and web apps enthusiast by night. Wannabe open source contributor, and source control freak.

Updated on June 27, 2022

Comments

  • Helgi
    Helgi almost 2 years

    I need to check the status of a RAID array on an Intel controller from my Windows application periodically (or be notified about a status change). Specifically, what I need is to find out whether a RAID 5 array is healthy or one of its disks is missing.

    I tried parsing output of raidcfg32 (available from the Intel site, see this readme), but it works only with one of servers my application need to monitor. On other servers raidcfg32 reports an ‘unsupported hardware’ error. I also tried CmdTool2, but it was unable to find the controller altogether.

    The only remaining option of RAID array monitoring supplied by Intel is a bunch of GUI applications (Intel Matrix Storage Management Console, Intel Rapid Storage Technology).

    The controllers in question are: ESB2, 631xESB/632xESB.

    I believe I have read through the few posts here on Stack Overflow that are relevant to my problem, and none of them contains an answer. In an answer to the question ‘Can I get Raid disk status by using PS?’, for instance, what is suggested actually allows to check if the controller, not the array, is healthy (it always is).

    What am I looking for is an automated way of accessing the status information (from a .NET application, to be specific). Any option is good, be it via WMI, a .NET or native API, console output parsing or whatever.

    I find it confusing that the suggested way of monitoring RAID status is via a GUI application. What approaches are used in enterprise deployments with tens of servers to do this programmatically?