如何从 Windows 应用程序监控 Intel 控制器上 RAID 阵列的状态?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3478204/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I monitor the status of a RAID array on an Intel controller from a Windows application?
提问by Helgi
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.
我需要定期从我的 Windows 应用程序检查英特尔控制器上 RAID 阵列的状态(或收到有关状态更改的通知)。具体来说,我需要的是找出 RAID 5 阵列是否健康或其中一个磁盘丢失。
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.
我尝试解析raidcfg32
(可从英特尔网站获得,请参阅此自述文件)的输出,但它仅适用于我的应用程序需要监控的服务器之一。在其他服务器上raidcfg32
报告“不受支持的硬件”错误。我也试过CmdTool2
,但完全找不到控制器。
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).
英特尔提供的唯一剩余的 RAID 阵列监控选项是一堆 GUI 应用程序(英特尔矩阵存储管理控制台、英特尔快速存储技术)。
The controllers in question are: ESB2, 631xESB/632xESB.
有问题的控制器是: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).
我相信我已经阅读了 Stack Overflow 上与我的问题相关的几篇文章,但没有一篇包含答案。在回答'我可以使用 PS 获取 Raid 磁盘状态吗?',例如,所建议的实际上允许检查控制器而不是阵列是否健康(它总是如此)。
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.
我正在寻找的是一种访问状态信息的自动化方式(具体来说,来自 .NET 应用程序)。任何选项都是好的,无论是通过 WMI、.NET 还是本机 API、控制台输出解析或其他方式。
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?
我发现监控 RAID 状态的建议方法是通过 GUI 应用程序令人困惑。在具有数十台服务器的企业部署中使用哪些方法以编程方式执行此操作?
回答by EJA
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.
我也一直在找这个。我有 ICHxxx 系列控制器,并试图与英特尔联系以回应有关公共 API 的存在,但我并不乐观。
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".
这是我为短期提出的建议。英特尔将 RAID 事件记录到“IAANTmon”下的 Windows 事件日志中。所以你可以使用 System.Diagnostics.EventLog,挂钩 EventWrittenEventHandler,然后过滤“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")
{
...
}
}
回答by NotImplementedException
I've been looking into this as well, seems like smartmontoolsis 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.
我也一直在研究这个,似乎smartmontools是最好的选择。不幸的是,我没有找到适合我的 .NET 需求的包,因为它只是一些基本的东西,我没有花几个小时来寻找合适的解决方案。
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.
我在我的应用程序 (Process.Start) 开始时启动“smartctl --scan”(smartmontools 的一部分),从输出中获取设备列表,然后定期为每个设备启动“smartctl -H device-name” .
This will return the SMART overal health test-results of the disk, as long as "PASSED" is returned, you shouldbe safe.
这将返回磁盘的 SMART 整体健康测试结果,只要返回“PASSED”,就应该是安全的。
While this is far from ideal, it does gives some indication of the health of my raid-disks.
虽然这远非理想,但它确实显示了我的 RAID 磁盘的健康状况。
回答by rw_
As of 11/16/18, Windows 10, I've run into the same issue, needing to check raid status for intel Raid 10.
截至 2018 年 11 月 16 日,Windows 10,我遇到了同样的问题,需要检查英特尔突袭 10 的突袭状态。
EJA's answer mostly worked - I did not get any logs written to source "IAANTmon", however.
EJA 的回答大多有效 - 但是,我没有将任何日志写入源“IAANTmon”。
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".
在这一点上,我使用了 EJA 的答案,但是,按源“IAStorDataMgrSvc”过滤。这是写入我的raid 事件日志的地方。此外,我检查了包含“降级”或“重建”的消息。这将排除启动事件和拉取日志,例如“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
}
}