Microsoft Virtualization Discussions

Issue with Invoke-NcSystemApi

Jaiwaghela
2,751 Views

I am encountering a strange issue using Invoke-NcSystemApi. I am trying to get the output of ifstat <portname> using this cmdlet. So what happens that each time the script runs I get output for only some ports and others are skipped. For ex: In the below output I pasted port e0b and e0d are skipped. Please have a look at the script below. Would really appreciate if someone can help...

 

=====================================================================================

 

 

Import-Module Dataontap
$UserName ="admin"

$ControllerPassword =ConvertTo-SecureString “netapp123” -AsPlainText -Force
$ControllerCredential = New-Object System.Management.Automation.PsCredential($UserName,$ControllerPassword)
$ips=@()
$ips=("192.168.0.10")
foreach($ip in $ips)
{

Connect-NcController -Name $ip -Credential $ControllerCredential

$nodes = (Get-NcNode).Node
$portlist = Get-NcNetPort
foreach($pl in $portlist)
{
$plist = $pl.Port
$nlist = $pl.Node
$nlist
$nplist


$api = $("<system-cli><args><arg>"+("system node run -node $nlist -command ifstat $plist" -join "</arg><arg>")+"</arg></args></system-cli>")
$output = Invoke-NcSystemApi -Request $api -ErrorAction Stop
$output.results.'cli-output'
$output.results.'cli-result-value'

}
}
==========================================================================================================

 

Output :

 

PS C:\Users\jaiw> C:\Users\jaiw\Videos\scriptvvvvv.ps1

 

Name Address Vserver Version
---- ------- ------- -------
192.168.0.10 192.168.0.10 NetApp Release 9.4: Fri Jun 08 22:50:12 UTC 2018

 

cluster1-01
e0a

-- interface e0a (3 hours, 6 minutes, 32 seconds) --

RECEIVE
Total frames: 5318 | Frames/second: 0 | Total bytes: 508k
Bytes/second: 45 | Total errors: 0 | Errors/minute: 0
Total discards: 0 | Discards/minute: 0 | Multi/broadcast: 1256
Non-primary u/c: 0 | CRC errors: 0 | Runt frames: 0
Fragment: 0 | Long frames: 0 | Jabber: 0
Alignment errors: 0 | No buffer: 0 | Xon: 0
Xoff: 0 | Pause: 0 | Jumbo: 0
Noproto: 0 | Error symbol: 0 | Illegal symbol: 0
Bus overruns: 0 | Queue drops: 0 | LRO segments: 0
LRO bytes: 0 | LRO6 segments: 0 | LRO6 bytes: 0
Bad UDP cksum: 0 | Bad UDP6 cksum: 0 | Bad TCP cksum: 0
Bad TCP6 cksum: 0 | Mcast v6 solicit: 0
TRANSMIT
Total frames: 16380 | Frames/second: 1 | Total bytes: 21760k
Bytes/second: 1944 | Total errors: 0 | Errors/minute: 0
Total discards: 0 | Queue overflow: 0 | Multi/broadcast: 0
Max collisions: 0 | Single collision: 0 | Multi collisions: 0
Late collisions: 0 | Xon: 0 | Xoff: 0
Pause: 0 | Jumbo: 0 | Cfg Up to Downs: 4
TSO non-TCP drop: 0 | Split hdr drop: 0 | Timeout: 0
TSO segments: 0 | TSO bytes: 0 | TSO6 segments: 0
TSO6 bytes: 0 | HW UDP cksums: 0 | HW UDP6 cksums: 0
HW TCP cksums: 16102 | HW TCP6 cksums: 0 | Mcast v6 solicit: 0
DEVICE
Mcast addresses: 1 | Rx MBuf Sz: 0
LINK INFO
Speed: 1000m | Duplex: full | Flowcontrol: none
Media state: active | Up to downs: 5

 

1

 

cluster1-01
e0b

1

 

cluster1-01
e0c

-- interface e0c (3 hours, 12 minutes, 4 seconds) --

RECEIVE
Total frames: 20235 | Frames/second: 2 | Total bytes: 3549k
Bytes/second: 308 | Total errors: 0 | Errors/minute: 0
Total discards: 0 | Discards/minute: 0 | Multi/broadcast: 1236
Non-primary u/c: 0 | CRC errors: 0 | Runt frames: 0
Fragment: 0 | Long frames: 0 | Jabber: 0
Alignment errors: 0 | No buffer: 0 | Xon: 0
Xoff: 0 | Pause: 0 | Jumbo: 0
Noproto: 0 | Error symbol: 0 | Illegal symbol: 0
Bus overruns: 0 | Queue drops: 0 | LRO segments: 0
LRO bytes: 0 | LRO6 segments: 0 | LRO6 bytes: 0
Bad UDP cksum: 0 | Bad UDP6 cksum: 0 | Bad TCP cksum: 0
Bad TCP6 cksum: 0 | Mcast v6 solicit: 0
TRANSMIT
Total frames: 47132 | Frames/second: 4 | Total bytes: 55507k
Bytes/second: 4817 | Total errors: 0 | Errors/minute: 0
Total discards: 0 | Queue overflow: 0 | Multi/broadcast: 0
Max collisions: 0 | Single collision: 0 | Multi collisions: 0
Late collisions: 0 | Xon: 0 | Xoff: 0
Pause: 0 | Jumbo: 0 | Cfg Up to Downs: 0
TSO non-TCP drop: 0 | Split hdr drop: 0 | Timeout: 0
TSO segments: 0 | TSO bytes: 0 | TSO6 segments: 0
TSO6 bytes: 0 | HW UDP cksums: 0 | HW UDP6 cksums: 0
HW TCP cksums: 46986 | HW TCP6 cksums: 0 | Mcast v6 solicit: 0
DEVICE
Mcast addresses: 2 | Rx MBuf Sz: 0
LINK INFO
Speed: 1000m | Duplex: full | Flowcontrol: none
Media state: active | Up to downs: 2

 

1

 

cluster1-01
e0d

1

 

PS C:\Users\jaiw>

0 REPLIES 0
Public