Hi Friends, scenario where you have multiple UCSM with hundreds of blades and rack servers managed UCSM. Though UCSM alert us with all critical alerts real time, most of the time it is difficult to track the critical alerts for me due to large number of events generated from UCSM. It was tough for us to isolate the issue unless we login to each UCSM and check for the faults.
Here I created a simple script that do this function for me, currently I have created this report only inoperable devices of UCS chassis and Blades.
This script also gives us the blade location, SL#, bad parts etc.
Report will be like this and send to your mailbox
#———————- Start of Script —————————–
$body= “<p><u><b><span style=’font-size:10.0pt;font-family:Century Gothic’>UCS Server Issue reported </span></b></u> </p>
<table border=’1′ bgcolor=’#ffffff’>
<tr>
<th>UCS</th>
<th>Issue Server</th>
<th>Server location</th>
<th>Serial Number</th>
<th>Models</th>
<th>Operational State</th>
<th>Description</th>
</tr>”Import-Module “C:\Program Files (x86)\Cisco\Cisco UCS Manager PowerTool\Modules\CiscoUcsPS\CiscoUcs.dll”
$ucsms = @(“UCSM01″, ” UCSM01″, ” UCSM02″, ” UCSM03″, ” UCSM04″)
$ucscred = get-credentialforeach ($ucsm in $ucsms){
Connect-Ucs $ucsm -Credential $ucscred
$chassiss = Get-UcsChassisforeach ($chassis in $chassiss){
$decrucs = @()
$chassisname = $chassis.Rn
$ChassisSl = $chassis.Serial
$chassisOperState = $chassis.OperState
$chassisModel = $chassis.Model$chassis| get-ucsfault |?{$_.Descr -like “*inoperable*” -and $_.Descr -notlike “*server*” -and $_.Severity -ne “cleared”}| %{
$decrucs = $_.Descr$body += ”
<tr>
<td>$ucsm</td>
<td>$chassisname</td>
<td>$chassisname</td>
<td>$ChassisSl</td>
<td>$chassisModel</td>
<td>$chassisOperState</td>
<td>$decrucs</td>
</tr>”}
}
$servers = Get-UcsServer
foreach ($server in $servers)
{
$decr = @()
$ucs = $server.Ucs
$serverSl = $server.Serial
$UcsDn = $server.Dn
$serverOperState = $server.OperState
$ServerModel = $server.Model
$ServerName = $server.AssignedToDn
$ServerName = $ServerName.trim(“org-root/ls-“)$server | get-ucsfault |? {$_.Descr -like “*inoperable*” -and $_.Severity -ne “cleared”} | %{
$decr = $_.Descr
$body += ”
<tr>
<td>$ucs</td>
<td>$ServerName</td>
<td>$UcsDn</td>
<td>$serverSl</td>
<td>$ServerModel</td>
<td>$serverOperState</td>
<td>$decr</td>
</tr>”}
$decr
}
Disconnect-Ucs
}$body += “</table>”
$rec = “Vipin.vasudevan@vipinvasudevan.com”
Send-MailMessage -Body $body -To $rec -From “Vipin.vasudevan@vipinvasudevan.com” -Subject “UCS Hardware alerts” -SmtpServer smtp. vipinvasudevan.com -BodyAsHtml -priority High
#———————- End of Script —————————–
Here UCSM0x are USCM domain names where script going to check for chassis and blade health.
You may schedule it on task scheduler, not get-credential wont work here. You may save the encrypted password to run if you schedule it. Refer “https://vipinvasudevan.com/2016/12/07/passwords-and-securestring/” for saving credentials for running task schedules