I recently had to run some monitoring commands to gather information while a backup was running. So I used Powershell.
I needed to SSH on to the FAS and run the following:
set -privilege advanced
statistics aggregate show
statistics cache flash-pool show
So why should I do that when I can get Powershell to do it.
Here is a quick bit of Powershell to SSH on to the FAS and run commands
$FASCred = Get-Credential
$Sess = New-SSHSession -ComputerName FAS01 -Credential $FASCred -AcceptKey
Invoke-SSHCommand -SSHSession $Sess -Command "set -privilege advanced"
# now we can loop/re-run the following commands as often as we like.
$SSHCommand = "statistics aggregate show"
$res = Invoke-SSHCommand -SSHSession $Sess -Command $SSHCommand
$res.Output | out-file "Aggregate.log" -Append
$SSHCommand = "statistics cache flash-pool show"
$res = Invoke-SSHCommand -SSHSession $Sess -Command $SSHCommand
$res.Output | out-file "Flash-Pool.log" -Append
I also had to run some other specific information gathering commands but that’s the process I used.
Other statistical commands are:
cluster statistics show
FAS01::*> statistics [tab]
aggregate cache catalog disk lif
lun namespace node port preset
qtree samples settings show show-periodic
start stop system top volume
vserver workload
If I issued the command “set -privilege advanced” on the SSH console I would need to confirm by entering “y”. The Powershell Invoke-SSHCommand -SSHSession $Sess -Command “set -privilege advanced” also issued the “y” confirmation.
Occasionally I find I cannot do something in the Powershell Data.ONTAP module, so a fallback is to SSH on to the FAS, invoke a console command and return the output.