Cisco UCS Central – getting free slots from connected domains

Quick powershell snippet time ! When you have a UCS Central instance with a number of domains, knowing what free slots you have available is quite useful – especially when you’ve got a smart hands service and won’t be racking new servers but instead having to communicate instructions.

In my time I’ve seen UCS Central used to manage geographically separate domains and a large number of domains across a small number of sites. When you get a new blade it needs to be put into a free slot, the question is where ?

The script below uses domain groups to separate out domains, but the code is formatted so it can be removed if they aren’t used.

Get-UCSCentralOrgDomainGroup -Filter { Level -ceq 1 } | % {
	$group = $_;
	Get-UCSCentralComputeSystem | ? { $_.OperGroupDn.StartsWith($group.Dn); } | % {
		$compute = $_;
		Get-UCSCentralChassis -ComputeSystem $_ | sort Id | select @{L='Group';E={$}}, @{L='Domain';E={$compute.Name}}, @{L='Chassis';E={ $_.Id}}, @{L='Blade Count';E={(Get-UCSCentralBlade -Chassis $_).Count}}

Apologies I don’t currently have any domains available to run this against to show you some sample output so I appreciate you’ll be trying this out blind. I hope that it meets your expectations !

I’ve uploaded this to my github in a script file so it can be run as you need it ๐Ÿ™‚

Finding a UCS Service Profile from the MAC Address

Quick snippet on how to find the name of a service profile given the MAC address.

I found this useful as when troubleshooting ESXi locks, the MAC address of the locking host is shown and sadly not the name. Once I had the name I was able to continue debugging my problem ๐Ÿ™‚

Get-UCSCentralServiceProfile | % { $h = $_.Name; $res = $_ | Get-UcsCentralVnic | ? { $_.Addr -eq "<MAC address here>" }; if ($res -ne $null) { Write-Host $h; } }

This will work with UCS domains not joined to Central (and having global service profiles) – change the code by removing the word “Central” from the cmdlets.

PowerTool – Getting UCS Blades with SD Cards

This is a quick snippet that allows you to retrieve UCS Blades that have SD cards – this might be useful in determining if your blades are ready to have an OS installed on them. These scripts assume you’ve already connected to your UCS Central or UCS Domain.

This will get the blades if you’re using UCS Central:

Get-UCSCentralBlade | ? { $blade = $_; $cards = Get-UcsCentralStorageFlexFlashCard | ? { $_.Dn.StartsWith($blade.Dn); }; return ($cards.Count -gt 0); } | select @{L='Domain';E={ (Get-UcsCentralComputeSystem -Dn $_.Dn.Substring(0, 16)).Name }}, ServerId, ChassisId, SlotId, Name, @{l="Cards";e={$cards.Count}}, OperState, Association,Discovery, Model, TotalMemory, LsDn | Sort Domain, ServerId

If you’re not using UCS Central, we modify the commandlets by removing the “Central” from them, and remove resolving the domain (because you’ll know what domain you’re running it against). The following (currently untested) should work:

Get-UCSBlade | ? { $blade = $_; $cards = Get-UcsStorageFlexFlashCard | ? { $_.Dn.StartsWith($blade.Dn); }; return ($cards.Count -gt 0); } | select ServerId, ChassisId, SlotId, Name, @{l="Cards";e={$cards.Count}}, OperState, Association,Discovery, Model, TotalMemory, LsDn | Sort ChassisId, ServerId

Creating a Cisco UCS Profile using PowerTool

Creating a Cisco UCS Profile using PowerTool

This post is going to walk through creating a powershell function to create a Service Profile on a Cisco UCS domain. Later posts in this series will look at how to assign it to a server, configure shared storage on a NetApp filer, and configure the zoning on Fiber Channel switches – essentially all the work we’d need to do to automate the creation of a physical server.

There are a few ways to create Service Profiles on a Cisco UCS domain, but if you’re looking for consistency, best practice and the possibility to automate then you’ll need to use templates – not just a Service Profile template, but templates within the Service Profile template – for vNICs, vHBAs and for any other policies. I have assumed that templates have been set up and are being used.

We are going to be using Cisco UCS PowerTool for this, so ensure you’ve got this installed on your system. You can get it from , but you’ll need a login.

Importing UCS VLANs

I’ve had to deal with two UCS systems recently, ensuring that the configuration matches on them both, most of which I was happy to go through by hand. But the long list of VLANs was another story. I could see that they can be exported, but I couldn’t find an import ability. So, a quick search later, I found this webpage: butย is very nearly what I’m after, but we need to make a little modification.

UCS Default Keyring Certificate Regeneration

Recently our manually generated UCS certificate expired. Checking the manual (here) we needed to regenerate it with the following procedure:

UCS-A# scope security
UCS-A /security # scope keyring default
UCS-A /security/keyring* # set regenerate yes
UCS-A /security/keyring* # commit-buffer
UCS-A /security/keyring #

Piece of cake.

What isn’t said is that this will boot everyone using UCS Manager out of it and they have to reconnect. Might be useful to know in the future for scheduling purposes ๐Ÿ˜‰