Cisco UCS PowerShell Health Check Report

I have been slack on my blog posts of late, mostly because of motivation but I have also been very busy with very little free time to spare.

I like being busy and I have been working on some cool projects, mostly with UCS, Nexus, vSphere and EMC storage.

A few weeks ago I finally had a few days in the lab so I decided to take a look a the Cisco UCS Powertool. I didn’t really have anything big planned I was more just curious about it.

I started going through all of the different cmdlets and realized that there were a lot of them, over 1000!!

I mostly focused on the get- cmdlets to see what reporting options I had. After a few hours I got the idea of creating a health check report. There aren’t any reporting features built in to UCSM so I thought it would be very useful for UCS admins if they could get a weekly report of their UCS clusters.

The other items I wanted to report on were things like “Which Service Profiles are bound to what templates?” and “Which vNICs/vHBAs were bound to what templates?”

For the next 2 days I hammered out about 1000 lines of code creating the report. I had the most trouble with the HTML stuff and trying to figure out the tabs. I used examples from the web and received some great help from our internal developer.

I posted a zip file with the script and an example report on the Cisco developer community. You can grab a copy of it from here – https://www.dropbox.com/sh/i001giq6jx67fl2/GYedBaqAYa

The instructions for getting the script running in your environment are at the top of the PowerShell script, just open it in a text editor to view them.

If you have some ideas on how I can make the report better or if you want to contribute to the project please do so and post your updates to the Cisco developer site so that we can all benefit from it.

Here is a screen shot of it as well

image

About these ads

23 thoughts on “Cisco UCS PowerShell Health Check Report

  1. Pingback: Cisco UCS PowerShell Configuration Script | Jeremy Waldrop's Blog

  2. This is a very impressive script, I look forward to giving it a run. If I can think of any added functionality I’ll make sure to comment on your developer thread.

  3. I couldn’t get the original script working. I had to modify the code to remove all references to $handle2. I also had to add -NoSsl switch to the Connect-UCS command. Once I did this the script appeared to run OK. I have only attempted this on one UCS though and it’s currently running 1.4.x so I will see how it goes on some other installs.

    Great script. Thank you.

  4. hey i was not able to run the script. it gave me page full of errors, any special changes need to be made apart from changing the username and password and URL’s ?

  5. Make sure you have the latest version of the UCS Power tool, Cisco changed the paths in the Program Files directory and the script assume the more recent .98/99 versions. Also make sure you have set the powershell execution policy to remotesigned. If you only have 1 UCSM then comment out the section for connecting to the second UCSM

  6. Remove-Item : Cannot find path ‘C:\Users\chetan.gurusiddappa.PACER\Desktop\ucsv
    hbasanmap.html’ because it does not exist.
    At C:\Users\chetan.gurusiddappa.PACER\Desktop\UCS-HealthCheck-v3.ps1:433 char:1
    2
    + Remove-Item <<<< ucsvhbasanmap.html
    + CategoryInfo : ObjectNotFound: (C:\Users\chetan…vhbasanmap.ht
    ml:String) [Remove-Item], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.Remov
    eItemCommand

    Remove-Item : Cannot find path 'C:\Users\chetan.gurusiddappa.PACER\Desktop\ucsc
    hassispwr.html' because it does not exist.
    At C:\Users\chetan.gurusiddappa.PACER\Desktop\UCS-HealthCheck-v3.ps1:434 char:1
    2
    + Remove-Item <<<< ucschassispwr.html
    + CategoryInfo : ObjectNotFound: (C:\Users\chetan…chassispwr.ht
    ml:String) [Remove-Item], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.Remov
    eItemCommand

    Remove-Item : Cannot find path 'C:\Users\chetan.gurusiddappa.PACER\Desktop\ucsc
    hassispwrstats.html' because it does not exist.
    At C:\Users\chetan.gurusiddappa.PACER\Desktop\UCS-HealthCheck-v3.ps1:435 char:1

  7. open a powershell window and run these commands
    “Import-Module CiscoUcsPS”
    connect-ucs ipaddressofucsm
    if you can’t do this then there is a path issue where powershell can’t find the ciscoucsps module

  8. This web site is mostly a walk-

    through for all the info you wanted about this and didn’t
    know who to ask. Glimpse here, and also you’ll

    undoubtedly discover it.1
    There may be noticeably a bundle to learn about this.
    I assume you made

    certain good points in options also.

  9. I create a comment whenever I especially enjoy a article on a site
    or if I have something to valuable to contribute to the conversation.

    Usually it’s caused by the fire communicated in the post I read. And after this post Cisco UCS PowerShell Health Check Report | Jeremy Waldrop’s Blog.
    I was actually excited enough to leave a commenta response :-) I actually do have 2 questions for you if you tend
    not to mind. Is it just me or do some of the remarks come across like they are coming from brain
    dead visitors? :-P And, if you are posting at other online social sites, I would like to follow anything new you have to post.
    Could you list all of your social pages like your twitter
    feed, Facebook page or linkedin profile?

  10. errors all over the screen :-(

    Remove-Item : Cannot find path ‘D:\ucsmemtempstats.html’ because it does not ex
    ist.
    At D:\UCS-HealthCheck-v5.6.ps1:1171 char:12
    + Remove-Item <<<< ucsmemtempstats.html
    + CategoryInfo : ObjectNotFound: (D:\ucsmemtempstats.html:String)
    [Remove-Item], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.Remov
    eItemCommand

    Remove-Item : Cannot find path 'D:\ucscputempstats.html' because it does not ex
    ist.
    At D:\UCS-HealthCheck-v5.6.ps1:1172 char:12
    + Remove-Item <<<< ucscputempstats.html
    + CategoryInfo : ObjectNotFound: (D:\ucscputempstats.html:String)
    [Remove-Item], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.Remov
    eItemCommand

    Remove-Item : Cannot find path 'D:\ucsfanstats.html' because it does not exist.
    At D:\UCS-HealthCheck-v5.6.ps1:1173 char:12
    + Remove-Item <<<< ucsfanstats.html
    + CategoryInfo : ObjectNotFound: (D:\ucsfanstats.html:String) [Re
    move-Item], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.Remov
    eItemCommand

    Remove-Item : Cannot find path 'D:\ucspsus.html' because it does not exist.
    At D:\UCS-HealthCheck-v5.6.ps1:1174 char:12
    + Remove-Item <<<< ucspsus.html
    + CategoryInfo : ObjectNotFound: (D:\ucspsus.html:String) [Remove
    -Item], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.Remov
    eItemCommand

    Remove-Item : Cannot find path 'D:\ucspsustats.html' because it does not exist.
    At D:\UCS-HealthCheck-v5.6.ps1:1175 char:12
    + Remove-Item <<<< ucspsustats.html
    + CategoryInfo : ObjectNotFound: (D:\ucspsustats.html:String) [Re
    move-Item], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.Remov
    eItemCommand

  11. Looks like a powershell issue. Try to run the script from the UCS Powertool shortcut powershell prompt.

  12. Oh my goodness! Amazing article dude! Thank you so much, However I am encountering difficulties
    with your RSS. I don’t understand the reason why I cannot join it. Is there anybody else getting identical RSS issues? Anybody who knows the answer will you kindly respond? Thanks!!

  13. Good script.
    Can you add the Chassis uplink statistics and information in the next release – Server Ports. would like to be able to see is a fabric or chassis is running much more traffic than another…

  14. I am having the same issue as ChetanGuru. Getting remove-item errors from running from multiple desktops and what have you. Strange issue.

  15. I have seen this when you try to run the UCS Powertool shortcut as a non-administrator or if your UAC is turned on. Create a folder in the root of the C: drive named UCS, copy the powershell script to this folder, launch the UCS Powertool shortcut as administrator and then change directory to the UCS folder and run the script.

  16. I like your script. Good Job! But i am getting errors when i run in my environment.

    Mode LastWriteTime Length Name
    —- ————- —— —-
    -a— 2/1/2014 8:16 PM 0 ucsm.html
    Connect-Ucs : Connect-Ucs: Connection to miaucs01 Failed.
    At line:38 char:23
    + $handle1 = Connect-Ucs <<<< $ucsmaddr -NotDefault -Credential $ucsmcreds
    + CategoryInfo : NotSpecified: (:) [Connect-Ucs], Exception
    + FullyQualifiedErrorId : Cisco.Ucs.Cmdlets.ConnectUcs

    Get-UcsNetworkElement : Cannot validate argument on parameter 'Ucs'. The argument is null. Supply a non-null argument and try the command again.
    At line:157 char:27
    + Get-UcsNetworkElement -Ucs <<<< $handleArray | Select-Object Ucs,Rn,OobIfIp,OobIfMask,OobIfGw,Operability,Model,Serial | ConvertTo-Html -Fragment | Out-File ucsfis.html
    + CategoryInfo : InvalidData: (:) [Get-UcsNetworkElement], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Cisco.Ucs.Cmdlets.GetUcsNetworkElement

    Get-Content : Cannot find path 'C:\Users\admin-vsiva\ucsfis.html' because it does not exist.
    At line:158 char:12
    + Get-Content <<<< ucsfis.html | Add-Content $ReportFile
    + CategoryInfo : ObjectNotFound: (C:\Users\admin-vsiva\ucsfis.html:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

    Get-UcsFiModule : Cannot validate argument on parameter 'Ucs'. The argument is null. Supply a non-null argument and try the command again.
    At line:164 char:21
    + Get-UcsFiModule -Ucs <<<< $handleArray | Sort-Object -Property Ucs,Dn | Select-Object Ucs,Dn,Model,Descr,OperState,State,Serial | ConvertTo-Html -Fragment | Out-File uc
    sfi-inv.html
    + CategoryInfo : InvalidData: (:) [Get-UcsFiModule], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Cisco.Ucs.Cmdlets.GetUcsFiModule

    Get-Content : Cannot find path 'C:\Users\admin-vsiva\ucsfi-inv.html' because it does not exist.
    At line:165 char:12
    + Get-Content <<<< ucsfi-inv.html | Add-Content $ReportFile
    + CategoryInfo : ObjectNotFound: (C:\Users\admin-vsiva\ucsfi-inv.html:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

    Get-UcsLicense : Cannot validate argument on parameter 'Ucs'. The argument is null. Supply a non-null argument and try the command again.
    At line:171 char:20
    + Get-UcsLicense -Ucs <<<< $handleArray | Sort-Object -Property Ucs,Scope | Select-Object Ucs,Scope,AbsQuant,UsedQuant,PeerStatus,OperState | ConvertTo-Html -Fragment | O
    ut-File ucsfilic-inv.html
    + CategoryInfo : InvalidData: (:) [Get-UcsLicense], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Cisco.Ucs.Cmdlets.GetUcsLicense

    Get-Content : Cannot find path 'C:\Users\admin-vsiva\ucsfilic-inv.html' because it does not exist.
    At line:172 char:12
    + Get-Content <<<< ucsfilic-inv.html | Add-Content $ReportFile
    + CategoryInfo : ObjectNotFound: (C:\Users\admin-vsiva\ucsfilic-inv.html:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

  17. Are you authenticating with a local UCSM user? LDAP auth doesn’t work yet, I have it down as something I need to fix.

Leave a Reply

Please log in using one of these methods to post your comment:

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