show port-channel summary

show port-channel summary

import json

"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'

myheaders={'content-type':'application/json'}
payload={
  "ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show port-channel summary ",
  "output_format": "json"
}

response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)


{

    "ins_api": {
        "outputs": {
            "output": {
                "body": {
                    "TABLE_channel": {
                        "ROW_channel": {
                            "TABLE_member": {
                                "ROW_member": [
                                    {
                                        "port": "Ethernet1/47", 
                                        "port-status": "P"
                                    }, 
                                    {
                                        "port": "Ethernet1/48", 
                                        "port-status": "P"
                                    }
                                ]
                            }, 
                            "group": "47", 
                            "layer": "S", 
                            "port-channel": "port-channel47", 
                            "prtcl": "LACP", 
                            "status": "U", 
                            "type": "Eth"
                        }
                    }
                }, 
                "code": "200", 
                "input": "show port-channel summary ", 
                "msg": "Success"
            }
        }, 
        "sid": "eoc", 
        "type": "cli_show", 
        "version": "1.0"
    }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show port-channel summary command, see the CLI command reference:

http//www.cisco.com/c/en/us/support/switches/nexus-3000-series-switches/products-command-reference-list.html

CLI Output
Switch# show port-channel summary 
Flags:  D - Down        P - Up in port-channel (members)
        I - Individual  H - Hot-standby (LACP only)
        s - Suspended   r - Module-removed
        b - BFD Session Wait
        S - Switched    R - Routed
        U - Up (port-channel)
        p - Up in delay-lacp mode (member)
        M - Not in use. Min-links not met
--------------------------------------------------------------------------------
Group Port-       Type     Protocol  Member Ports
      Channel
--------------------------------------------------------------------------------
47    Po47(SU)    Eth      LACP      Eth1/47(P)   Eth1/48(P)

show port-channel traffic

show port-channel traffic

import json

"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'

myheaders={'content-type':'application/json'}
payload={
  "ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show port-channel traffic ",
  "output_format": "json"
}

response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)


{

    "ins_api": {
        "outputs": {
            "output": {
                "body": {
                    "TABLE_channel": {
                        "ROW_channel": [
                            {
                                "chanId": "47", 
                                "port": "Ethernet1/47", 
                                "rx-bcst": "0.0", 
                                "rx-mcst": "49.62", 
                                "rx-ucst": "0.02", 
                                "tx-bcst": "0.0", 
                                "tx-mcst": "19.09", 
                                "tx-ucst": "50.01"
                            }, 
                            {
                                "chanId": "47", 
                                "port": "Ethernet1/48", 
                                "rx-bcst": "100.00", 
                                "rx-mcst": "50.37", 
                                "rx-ucst": "99.97", 
                                "tx-bcst": "0.0", 
                                "tx-mcst": "80.90", 
                                "tx-ucst": "49.98"
                            }
                        ]
                    }
                }, 
                "code": "200", 
                "input": "show port-channel traffic ", 
                "msg": "Success"
            }
        }, 
        "sid": "eoc", 
        "type": "cli_show", 
        "version": "1.0"
    }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show port-channel traffic command, see the CLI command reference:

http//www.cisco.com/c/en/us/support/switches/nexus-3000-series-switches/products-command-reference-list.html

CLI Output
Switch# show port-channel traffic 
NOTE: Clear the port-channel member counters to get accurate statistics

ChanId      Port Rx-Ucst Tx-Ucst Rx-Mcst Tx-Mcst Rx-Bcst Tx-Bcst
------ --------- ------- ------- ------- ------- ------- -------
    47   Eth1/47   0.02%  50.01%  49.62%  19.09%    0.0%    0.0%
    47   Eth1/48  99.97%  49.98%  50.37%  80.90% 100.00%    0.0%