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
Pingback: Cisco UCS PowerShell Configuration Script | Jeremy Waldrop's Blog
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.
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.
I just uploaded a new version here – http://developer.cisco.com/web/unifiedcomputing/forums/-/message_boards/view_message/5403479
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 ?
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
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
this is the error message description.
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
now the report is coming , but doesn’ t show any data in it. what changes have to be made for $Reportfile variable which is mentioned there
This article, “Cisco UCS PowerShell Health
Check Report | Jeremy Waldrop’s Blog” ended up being amazing. I’m producing out a clone to clearly show my pals. Thanks a lot-Gus
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.
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? 😛 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?
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
Looks like a powershell issue. Try to run the script from the UCS Powertool shortcut powershell prompt.
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!!
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…
ChetanGuru, did you ever figure out what the issue was?
I am having the same issue as ChetanGuru. Getting remove-item errors from running from multiple desktops and what have you. Strange issue.
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.
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
Please suggest
Are you authenticating with a local UCSM user? LDAP auth doesn’t work yet, I have it down as something I need to fix.
Health check report shows great info. Thanks.
I had the same issue (with connection, and paths errors). What i did was to put new entry in hosts file and then connect-ucs hostname. Of course script itself works too in this case.
Running into authentication issues.
PS C:\UCSReport> .\UCS-HealthCheck-v7.4.ps1
10.60.60.20: 10.60.60.20
C:\UCSReport\UCSReport2: ok.html
Directory: C:\UCSReport
Mode LastWriteTime Length Name
—- ————- —— —-
-a— 10/29/2014 3:59 PM 0 ok.html
Connect-Ucs : Connect-Ucs: Connection to 10.60.60.20 Failed.
At C:\UCSReport\UCS-HealthCheck-v7.4.ps1:38 char:12
+ $handle1 = Connect-Ucs $ucsmaddr -NotDefault -Credential $ucsmcreds
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-Ucs], Exception
+ FullyQualifiedErrorId : Cisco.Ucs.Cmdlets.ConnectUcs
PS C:\UCSReport> .\UCS-HealthCheck-v7.4.ps1
10.60.60.20: psuser
C:\UCSReport\UCSReport2: ok.html
Directory: C:\UCSReport
Mode LastWriteTime Length Name
—- ————- —— —-
-a— 10/29/2014 3:58 PM 0 ok.html
Connect-Ucs : Connect-Ucs: Connection to psuser Failed.
At C:\UCSReport\UCS-HealthCheck-v7.4.ps1:38 char:12
+ $handle1 = Connect-Ucs $ucsmaddr -NotDefault -Credential $ucsmcreds
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-Ucs], Exception
+ FullyQualifiedErrorId : Cisco.Ucs.Cmdlets.ConnectUcs
This is a local account that we tested. config file is as follows:
######################################
# Prompt for UCSM IP and credentials #
######################################
$ucsmaddr = Read-Host 10.60.60.20
$ucsmcreds = $Host.UI.PromptForCredential( “Cisco UCS Manager Authentication”,”Enter UCS Manager Login”,””,””)
Make sure you are using a local UCSM account, it currently doesn’t work with LDAP or other non local accounts
thank you for the time and effort you have put in to this… as for LDAP it works fine but you need to format it correctly ie. ucs-{domain}\{username}. this can be found in the ucsm\admin\users\authenticated users (not exact path but should get you there)
ok, yeah that makes since. I knew that was the format for SSH as an LDAP user but didn’t think about that for the script login to UCSM
Thank you for the reply, it is a local account. I am guessing the format I am using is wrong. Do you have an example.? thank you again!
I do have a question on setting up a scheduled task as it needs to open powershell then the ucsps my question would be does anyone know how to import the script through the task?
ps for the LDAP it is case sensitive so check your user in ucs for any capitals
Thanks Jeremy, its really great script to keep working.
Can we make it as a function and just run this as a command, so that it can be automated to fetch the report on daily basis from the task scheduler.
thanks Jeremy, I just found your blog few days back and this script working fine with my ldap account. only thing is, the tabs are not working well as your example report. when I click on the tab, it taking me to the right page, but if I need to go to another tab, I have to scroll all the way up 10,12 pages to find the TAB section. I mean, I can see all information of the 12 tabs in a single page. I’m using back button of the browser to go to tab section. not sure if anyone facing this issue,
there is no file in the link of the new version
http://developer.cisco.com/web/unifiedcomputing/forums/-/message_boards/view_message/5403479
Use Firefox or Chrome, IE doesn’t display it correctly
you can download the new version from here – https://www.dropbox.com/sh/i001giq6jx67fl2/AABD7-wO72fCEEpKpLDLv63ba?dl=0
thanks Jeremy, I had to install chrome and it works fine.
can you please update the server memory (dimm) section in script. I need to find the dimm model to see RDIMM and LRDIMM. looks like, in your script, the vendor part numbers are showing under the model. please include the bus speed (ex. PC3-12800 / PC4-17000 etc) and raking (dual rank/quad rank).
………………………………………………………..
Vender – Samsung
Vendor part number- M386B7G70DM0-YK04
Vendor serial number – 893F938GHA
Description – 32GB DDR3-1600MHz LRDIMM/PC3-12800/quad rank/x4/1.35V/Load reduced
………………………………………………………….
Vender – Hynix
Vendor part number- HMA86GR7MFR4N-TF
Vendor serial number -8RF93F938A
Description – 32GB DDR4-2133-MHz RDIMM/PC4-17000/dual rank/x4/1.2v
thanks and appreciate your afford
Irfan
Hey Irfan, not all of the details are captured with the PowerShell cmdlet “Get-UcsMemoryUnit”. Her is what is exposed via powershell
PowerTool C:\> Get-UcsMemoryUnit -Dn sys/rack-unit-1/board/memarray-1/mem-9
AdminState : policy
Array : 1
Bank : 0
Capacity : 8192
Clock : 1600
FormFactor : DIMM
Id : 9
Latency : 0.600000
Location : DIMM_E1
LocationDn :
Model : M393B1K70DH0-YK0
OperQualifier :
OperQualifierReason : N/A
OperState : operable
Operability : operable
Perf : unknown
Power : not-supported
Presence : equipped
Revision : 0
Sacl :
Serial : 13826D6B
Set : 0
Speed : unspecified
Thermal : ok
Type : DDR3
Vendor : 0xCE00
Visibility : yes
Voltage : not-supported
Width : 64
Dn : sys/rack-unit-1/board/memarray-1/mem-9
Rn : mem-9
Status :
XtraProperty : {}
Ucs : UCSLAB01
Heads up,
The module name has changed, See https://communities.cisco.com/docs/DOC-37154
Simply rename
Import-Module CiscoUcsPS
to
Import-Module Cisco.UCSManager
Massive Respect Jeremy!
Pete (www.petenetlive.com)
Hi Jeremy,
Hope you are doing well. I’ve gone through some of the Powershell scripts which were posted in your blog and found it very impressive and productive. I truly appreciate you for such an initiative.
I would need your assistance for below requirement.
Requirement:
=========
Recently, We had come across a scenario in my UCSM environment in which some of the UCS blades installed with two VIC’s in which vNIC/vHBA’s were not equally distributed across both physical VIC’s adapters Due to which whever we had an issue with one of the VIC in blade which leads to critical outage to VM’s running on that blade. Hence, I would need your assistance in constructing a powershell script to validate vCon policies on all the service profile template and also need HTML based report for all the blades in which vNIC’s/vHBA’s are not equally populated. Please let me know if you need any other information to work on this.
Thank you in Advance..!!
Regards,
Swamy Naveen
+91-9985549073 (my What”s app number)
Hey, the following cmd might work for what you want
“get-ucsvnic | select-object Dn,Name,AdaptorProfileName,SwitchID,Order,AdminVcon,AdminHostPort | Format-Table -AutoSize”
You could filter the output using the | where-object
HI Jeremy,
I would need the report in html format along with vNIC’s/vHBA’s details on each VIC card. the following column names should be available in the html report.
UCSId,ServerId,model,serial,servername,serviceprofiletemplate,vconmapping,vconassign
Get-UcsAdaptorUnit -Ucs $handleArray | Sort-Object -Property Ucs,Dn | Select-Object Ucs,ChassisId,BladeId,Rn,Model | ConvertTo-Html -Fragment | Out-File ucsadaptor-inv.html
Get-Content ucsadaptor-inv.html
ChassisId BladeId Rn Model
1 1 adaptor-1 UCSB-MLOM-40G-03
1 1 adaptor-2 UCSB-VIC-M83-8P
1 2 adaptor-1 UCSB-MLOM-40G-03
1 2 adaptor-2 UCSB-VIC-M83-8P
1 3 adaptor-1 UCSB-MLOM-40G-03
1 3 adaptor-2 UCSB-VIC-M83-8P
1 4 adaptor-1 UCSB-MLOM-40G-03
1 4 adaptor-2 UCSB-VIC-M83-8P
1 5 adaptor-1 UCSB-MLOM-40G-03
1 5 adaptor-3 UCSB-VIC-M83-8P
Great work Jeremy. I recently faced an issue when I had to delete a vlan from UCS, but that VLAN was being referenced in some of the vnic templates. Is there a script that can capture where the VLAN is referenced in UCS? – vnic template, service profile templates or service profiles?
Very nice script.
For information, I had to change the import of CiscoUcsPS by Cisco.UCSManager for the script to work with the latest “Cisco UCS PowerTool Suite – Cisco UCS Modules of Windows PowerShell”.
Otherwise, work just great (even with LDAP authenticated user).
Thanks again for your work !
I have a new version that has those fixes in it and some additional config items reported on. I just uploaded the new version here along with some UCS Central scripts with examples for 3 or 5 UCS domains managed by UCS Central – https://www.dropbox.com/sh/i001giq6jx67fl2/GYedBaqAYa
Hi Jeremy waldrop
so nice script. Thanks very much for your sharing!!!!
Is there a way to include user labels in the html output for blades (and chassis)?
Yes, ope the script with Notepad++ or equivalent editor and search for “Get UCS associated”. Add ,UsrLbl, after the ServerID object.
i updated the script to 8.1 to add the user label – https://www.dropbox.com/sh/i001giq6jx67fl2/GYedBaqAYa
Hello ,
the dropbox links seems not to be working for me, can you share the script with me please, also does the script fetch details about PSU state…
Updated dropbox URL and you want the 8.3 txt versions – https://www.dropbox.com/sh/i001giq6jx67fl2/AABD7-wO72fCEEpKpLDLv63ba?dl=0