Cisco Nexus 9000 Series NX-API CLI Reference, Release 7(x)
NX-OS 7(x)
- Cisco Nexus 9000 Series NX-API CLI Reference, Release 7.x
- About NX-API CLI
- Access-List Commands
- BFD Commands
- BGP Commands
- CDP Commands
- DHCP Commands
- Diagnostic Commands
- Environment Commands
- Flow Commands
- Hardware Commands
- Interface Commands
- Inventory Commands
- LLDP Commands
- Module Commands
- NVE Commands
- RADIUS Commands
- SNMP Commands
- System Commands
- TACACS Commands
- Version Commands
show snmp host
Python
Copy
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 snmp host",
"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_host": {
"ROW_host": [
{
"host": "10.157.150.137",
"level": "noauth ",
"port": "162 ",
"secname": "public ",
"type": "trap ",
"version": "v2c "
},
{
"host": "172.22.49.19",
"level": "noauth ",
"port": "2162 ",
"secname": "public ",
"type": "trap ",
"version": "v2c "
},
{
"host": "172.31.146.186",
"level": "noauth ",
"port": "2162 ",
"secname": "public ",
"type": "trap ",
"version": "v2c "
}
]
}
},
"code": "200",
"input": "show snmp host",
"msg": "Success"
}
},
"sid": "eoc",
"type": "cli_show",
"version": "1.0"
}
}