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 |
---|
|
Parameter | Description | Type |
---|---|---|
name | Physical name (text string) assigned to the Cisco entity | String |
productid | Entity product identifier | String |
desc | Description of entity | String |
vendorid | Entity version identifier | String |
serialnum | Entity serial number | String |