show inventory

show inventory
import requests
import json
 
"""
Modify these please
"""
url='http://<ip_address>:<port_number>/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 inventory",
  "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)

json_output = json.loads(output)["ins_api"]["outputs"]["output"]["body"]
print(json.dumps(json_output, indent=4, sort_keys=True))
{
    "TABLE_inv": {
        "ROW_inv": [
            {
                "desc": "MDS 9148T 48X32G FC (1 RU) Chassis",
                "name": "Chassis",
                "productid": "DS-C9148T-K9",
                "serialnum": "JPG215200BQ",
                "vendorid": "V00"
            },
            {
                "desc": "4/8/16/32 Gbps FC/Sup-4",
                "name": "Slot 1",
                "productid": "DS-C9148T-K9-SUP",
                "serialnum": "JAE2151022Y",
                "vendorid": "V00"
            },
            {
                "desc": "MDS 9148T 48X32G FC (1 RU) Chassis Power Supply",
                "name": "Slot 2",
                "productid": "DS-CAC-650W-I",
                "serialnum": "ART2132F7X2",
                "vendorid": "V00"
            },
            {
                "desc": "MDS 9148T 48X32G FC (1 RU) Chassis Power Supply",
                "name": "Slot 3",
                "productid": "DS-CAC-650W-I",
                "serialnum": "ART2132F7WS",
                "vendorid": "V00"
            },
            {
                "desc": "MDS 9148T 48X32G FC (1 RU) Chassis Fan Module",
                "name": "Slot 4",
                "productid": "DS-C32T-FAN-I",
                "serialnum": "N/A",
                "vendorid": "V00"
            },
            {
                "desc": "MDS 9148T 48X32G FC (1 RU) Chassis Fan Module",
                "name": "Slot 5",
                "productid": "DS-C32T-FAN-I",
                "serialnum": "N/A",
                "vendorid": "V00"
            },
            {
                "desc": "MDS 9148T 48X32G FC (1 RU) Chassis Fan Module",
                "name": "Slot 6",
                "productid": "DS-C32T-FAN-I",
                "serialnum": "N/A",
                "vendorid": "V00"
            },
            {
                "desc": "MDS 9148T 48X32G FC (1 RU) Chassis Fan Module",
                "name": "Slot 7",
                "productid": "DS-C32T-FAN-I",
                "serialnum": "N/A",
                "vendorid": "V00"
            }
        ]
    }
}
       <TABLE_inv>
        <ROW_inv>
         <name>Chassis</name>
         <desc>MDS 9148T 48X32G FC (1 RU) Chassis</desc>
         <productid>DS-C9148T-K9</productid>
         <vendorid>V00</vendorid>
         <serialnum>JPG215200BQ</serialnum>
        </ROW_inv>
        <ROW_inv>
         <name>Slot 1</name>
         <desc>4/8/16/32 Gbps FC/Sup-4</desc>
         <productid>DS-C9148T-K9-SUP</productid>
         <vendorid>V00</vendorid>
         <serialnum>JAE2151022Y</serialnum>
        </ROW_inv>
        <ROW_inv>
         <name>Slot 2</name>
         <desc>MDS 9148T 48X32G FC (1 RU) Chassis Power Supply</desc>
         <productid>DS-CAC-650W-I</productid>
         <vendorid>V00</vendorid>
         <serialnum>ART2132F7X2</serialnum>
        </ROW_inv>
        <ROW_inv>
         <name>Slot 3</name>
         <desc>MDS 9148T 48X32G FC (1 RU) Chassis Power Supply</desc>
         <productid>DS-CAC-650W-I</productid>
         <vendorid>V00</vendorid>
         <serialnum>ART2132F7WS</serialnum>
        </ROW_inv>
        <ROW_inv>
         <name>Slot 4</name>
         <desc>MDS 9148T 48X32G FC (1 RU) Chassis Fan Module</desc>
         <productid>DS-C32T-FAN-I</productid>
         <vendorid>V00</vendorid>
         <serialnum>N/A</serialnum>
        </ROW_inv>
        <ROW_inv>
         <name>Slot 5</name>
         <desc>MDS 9148T 48X32G FC (1 RU) Chassis Fan Module</desc>
         <productid>DS-C32T-FAN-I</productid>
         <vendorid>V00</vendorid>
         <serialnum>N/A</serialnum>
        </ROW_inv>
        <ROW_inv>
         <name>Slot 6</name>
         <desc>MDS 9148T 48X32G FC (1 RU) Chassis Fan Module</desc>
         <productid>DS-C32T-FAN-I</productid>
         <vendorid>V00</vendorid>
         <serialnum>N/A</serialnum>
        </ROW_inv>
        <ROW_inv>
         <name>Slot 7</name>
         <desc>MDS 9148T 48X32G FC (1 RU) Chassis Fan Module</desc>
         <productid>DS-C32T-FAN-I</productid>
         <vendorid>V00</vendorid>
         <serialnum>N/A</serialnum>
        </ROW_inv>
       </TABLE_inv>
      

The show inventory command displays the system hardware inventory. For command descriptions, see the Cisco MDS 9000 Series Switches Command References.

Note: This sample output is generated for Cisco MDS 9000 Series NX-OS Release 8.4(2a) or later.

CLI Output
switch# show inventory

NAME: "Chassis", DESCR: "MDS 9148T 48X32G FC (1 RU) Chassis"
PID: DS-C9148T-K9 , VID: V00 , SN: JPG215200BQ

NAME: "Slot 1", DESCR: "4/8/16/32 Gbps FC/Sup-4"
PID: DS-C9148T-K9-SUP , VID: V00 , SN: JAE2151022Y

NAME: "Slot 2", DESCR: "MDS 9148T 48X32G FC (1 RU) Chassis Power Supply"
PID: DS-CAC-650W-I , VID: V00 , SN: ART2132F7X2

NAME: "Slot 3", DESCR: "MDS 9148T 48X32G FC (1 RU) Chassis Power Supply"
PID: DS-CAC-650W-I , VID: V00 , SN: ART2132F7WS

NAME: "Slot 4", DESCR: "MDS 9148T 48X32G FC (1 RU) Chassis Fan Module"
PID: DS-C32T-FAN-I , VID: V00 , SN: N/A

NAME: "Slot 5", DESCR: "MDS 9148T 48X32G FC (1 RU) Chassis Fan Module"
PID: DS-C32T-FAN-I , VID: V00 , SN: N/A

NAME: "Slot 6", DESCR: "MDS 9148T 48X32G FC (1 RU) Chassis Fan Module"
PID: DS-C32T-FAN-I , VID: V00 , SN: N/A

NAME: "Slot 7", DESCR: "MDS 9148T 48X32G FC (1 RU) Chassis Fan Module"
PID: DS-C32T-FAN-I , VID: V00 , SN: N/A
ParameterDescriptionType
namePhysical name (text string) assigned to the Cisco entityString
productidEntity product identifierString
descDescription of entityString
vendorid Entity version identifierString
serialnumEntity serial numberString