08-18-2015 08:34 AM
Has anyone successfully scripted UCS 2.x NX-OS commands (such as show system uptime, and show platform software cmccrtl process meminfo | i MemFree) that can be run across multiple domains which passes credentials? Apparently cannot be done using PowerTools. It would be helpful to regularly run certain commands that do not exist in PowerTools to assess the health of memory usage and system up time.
01-06-2016 11:49 AM
I do not know how robust this solution will end up but you can run ssh commands from powershell using WMF 5 and the Posh-SSL Cmdlets.
https://www.powershellgallery.com/GettingStarted?section=Get%20Started
https://www.powershellgallery.com/packages/Posh-SSH/
##########
# Getting SSH Command Info from UCS via Powershell
# Needs:
# https://www.powershellgallery.com/packages/Posh-SSH/
# See getting started to install WMF 5.0
# 1/6/2016 - Larry Hedrick
# Begin
Write-Host "Connecting to UCSM..." -ForegroundColor Cyan
New-SSHSession -ComputerName 'dat01-clucs-003'
Write-Host "Running Commands..." -ForegroundColor Cyan
Invoke-SSHCommand -Command 'show cluster state' -SessionId '0' | select -ExpandProperty Output
Write-Host "Disconnecting." -ForegroundColor Cyan
Remove-SSHSession -SessionId 0
#end
Output
Connecting to UCSM...
cmdlet New-SSHSession at command pipeline position 1
Supply values for the following parameters:
SessionId Host Connected
--------- ---- ---------
0 dat01-clucs-003 True
Running Commands...
Cluster Id: 0xfa5cfdda8dd511e3-0xb6bc000573e36044
B: UP, PRIMARY
A: UP, SUBORDINATE
HA READY
Disconnecting.
True
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide