但是不知為什麼長久以來都沒有提供故障警示 E-mail 功能 (或是有我沒找到, 不然就是要錢 $$)
不過 HP 有提供 Cli 程式可以用 Command 來取得 RAID 狀態
(HPE Smart Storage Administrator (HPE SSA) CLI for Windows)
有 CLI 模式的程式可以用
就可以再用 PowerShell 透過這支程式來取得 RAID 狀態並判斷 State, 若異常則發出告警 Email
我另外有寫一篇 IRST (Intel Rapid Storage Technology) 在 Server Core 模式下的 RAID 監控 與這篇類似
程式如下:
$EmailFrom = "RAIDNotifier <RAIDNotifier@contoso.com>"
$EmailTo = @()
$EmailTo += "Admin <Admin@contoso.com>"
$EmailSubject = "$ENV:ComputerName RAID Warning"
$SMTPServer = "10.10.10.10"$RAIDStateInfo = .\ssacli.exe ctrl slot=0 show config | findstr drive;
$RAIDStateR = $RAIDStateInfo.Replace(" ","");
$RAIDError = 0
foreach ($RAIDStateEach in $RAIDStateR) {
if ((($RAIDStateEach.SubString(0,7) -eq "logical") -or ($RAIDStateEach.SubString(0,8) -eq "physical")) -and ($RAIDStateEach -like "*,*")) {
$RAIDStateS = $($RAIDStateEach.Replace(")","")).Split("(");
$RAIDStatusPresent = $RAIDStateS[1].Split(",")
if ($RAIDStateS[0] -like "logical*") {
if ($RAIDStatusPresent[2] -ne "OK") {
$RAIDError += 1;
};
} elseif ($RAIDStateS[0] -like "physical*") {
if ($RAIDStatusPresent[3] -ne "OK") {
$RAIDError += 1;
};
};
};
};
if ($RAIDError -ne 0) {
Foreach ($Receiver in $EmailTo) {
$EmailBody = "$($RAIDStateInfo | Out-String) $(.\ssacli.exe ctrl slot=0 show config | Out-String)"
Send-MailMessage -From $EmailFrom -To $EmailTo -Subject $EmailSubject -Body $EmailBody -Encoding Unicode -Priority High -SmtpServer $SMTPServer
};
};
沒有留言:
張貼留言