« Back to Technical Discussions

HOWTO: Multiple UCS search/KVM launcher, blade and chassis inventory...

Combination View Flat View Tree View
Threads [ Previous | Next ]
I've attached a script to generate blade inventory for all UCS systemes in our datacenter (23 and growing).  It uses a compiled java jar that is used in the command line to do the http post to the UCS systems.

 
Extract and modify sendmulti.cmd, add your userid and password for your ucs systems, change YOURUCSPOD1 and YOURUCSPOD2 to (2) different UCS¿s (or remove the second YOURUCSPOD2 section if you only have 1 [or add others if you have many more]).  Run the BladeInventory.cmd and it should produce multi_out.xml which will be an XML Inventory of the 2 pods.  Obviously you can add as many UCS pods/systems as you want.
 
If you add the mgmtIf class and the fabricComputeSlotEp class to the AllBlades.xml you can do a few extra cool things.
 
The mgmtIf class will allow you to resolve the blades KVM IP address which you can use to inject into KVM launch page.  After many packet captures I derived how the KVM launcher worked.  All it really needs is the dn of the service profile and the kvm ip address.
 
http://UCSM-URL/ucms/kvm.jnlp?kvmIpAddr=THEKVMIP&kvmdN=org-root/org-BLAH/ServiceProfileName
 
Above shows the syntax to directly login to a server knowing the Service Profile dn and the KVM IP.  The mgmtIf class will get you the extIP (kvmIPaddr) and the computeBlade class will get you the service profile names.  I pump all this into SQL and render queries on a portal (nothing fancy just something that can render a datagrid).  I like to think of each class as a table, I get all the blade (computeBlade class) info in one table, the chassis/slot (fabricComputeSlotEp class) info in another table, and lastly the KVM details in another table (mgmtIf class).  I then join them with the field I generate (POD) in the attached files along with chassisid and slotid. 


The cool thing using the fabricComputeSlotEp is you can now tell how many open/vacant slots there are or how utilized (percent of associate blades) your UCS systems are.
 
Here is some SQL queries I use against that data:
 
SEARCHABLE KVM LAUNCHER

select '<A href="http://' + b.pod + '/ucsm/kvm.jnlp?kvmIpAddr=' + k.extip + '&kvmdN='+b.assignedtoDN +'" target=blank>' +b.pod + '</A>'as 'Pod Name', assignedtoDN as 'Server/Profile Name', serial as 'Serial Number' , b.dn as 'Chassis/Slot Location', model as 'Server Model' , '<A href="http://' + b.pod + '/ucsm/kvm.jnlp?kvmIpAddr=' + k.extip + '&kvmdN='+b.assignedtoDN +'" target=blank>' +k.extIp + '</A>'as 'KVM IP Address'
from inv_cisco_ucs_blade b, inv_cisco_ucs_kvm k
where b.pod+b.slotid+b.chassisid = k.pod+k.slotid+k.chassisid
and assignedtodn like '%[Search:Text]%'
 
POD USAGE/AVAILABILITY:
select [UCS Pod], cast(
(cast([Total Slots in Pod]as decimal(4))- cast([Open Slots in all Chassis] as decimal(4))) / cast([Total Slots in Pod] as decimal(4)) * 100
as decimal (10,0)) as 'Percent of UCS POD Used'
,
[Unassigned blades],[In use blades], [Open Slots in all Chassis], [Total Slots in POD]
from (
select c.pod as 'UCS Pod',
sum(case when b.availability = 'available' then 1 else 0 end) as [Unassigned blades],
sum(case when b.availability != 'available' then 1 else 0 end) as [In use blades],
sum(case when b.availability is null and c.presence != 'equipped-not-primary' and c.presence != 'reserved' then 1 else 0 end) as [Open Slots in all Chassis],
sum(case when b.availability != '' or b.availability is null then 1 else 0 end) as [Total Slots in POD]
from inv_cisco_ucs_chassis c left outer join
inv_cisco_ucs_blade b on (b.pod+' chassis '+b.chassisid + ' slot ' +b.slotid) = (c.pod+' chassis '+c.chassisid + ' slot ' +c.slotid)
group by c.pod
) as a
order by [UCS Pod]
 
AVAILABLE BLADES THROUGHOUT ENTIRE COMPLEX (MODEL AND LOCATION)
select pod as 'UCS Pod', model as 'Blade Model', dn as 'Chassis and Blade slot'
from inv_cisco_ucs_blade
where availability = 'available'
 
This was many weeks of work but once I started down this path it all fell in line.  I did the KVM piece in about a day.
 
I realize not everyone will be super excited to use SQL but the techniques could be used in really any language.
Attachments: