UCS (Cisco) Hardware fault/error Alerts (Using power tool)


I just want to share one script I have created recently, not quite interesting but obviously played its significance to my case.

This script report and alert any hardware issue with UCS server environment, which was quite easy to report it through UCS central or UCSM environment however it is tough to identify the real hardware issue segregated from thousands of auto alert generated from system.

Below script work in conjunction with powertool to generated inoperable or error events across all UCSM and UCS blades with in your network

You may include Import-Module “C:\Program Files (x86)\Cisco\Cisco UCS Manager PowerTool\Modules\CiscoUcsPS\CiscoUcsPS.dll” if you are not running on powertool or schedule as a job, to import the module on powershell.

$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’>
<th>Issue Server</th>
<th>Server location</th>
<th>Serial Number</th>
<th>Operational State</th>

$ucsms = @(“USCM1”, “USCM2”, “USCM3”, “USCM4”, “USCM5”)
$ucscred = get-credential
foreach ($ucsm in $ucsms){
Connect-Ucs $ucsm -Credential $ucscred
$chassiss = Get-UcsChassis

foreach ($chassis in $chassiss){
$decrucs = @()
$chassisname = $chassis.Rn
$ChassisSl = $chassis.Serial
$chassisOperState = $chassis.OperState
$chassisModel = $chassis.Model

$chassis| get-ucsfault |?{$_.Descr -like “*inoperable*” -or $_.Descr -like “*FAILED*”-and $_.Descr -notlike “*server*”}| %{
$decrucs = $_.Descr
$body += ”
$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*”} | Select Descr
$server | get-ucsfault |? {$_.Descr -like “*inoperable*”} | %{
$decr = $_.Descr
$body += ”
$body += “</table>”

$rec = “MyMail@domain.com”, “MyGroupmail@domain.com”
Send-MailMessage -Body $body -To $rec -From “UCSAlerts@domain.com” -Subject “UCS Hardware alerts” -SmtpServer Smpt@domain.com-BodyAsHtml -priority High


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s