show snmp

show snmp

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",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show snmp",
        "msg": "Success",
        "code": "200",
        "body": {
          "sys_contact": "",
          "sys_location": "",
          "snmp_input_packets": "3 SNMP packets input",
          "bad_snmp_version": "        0 Bad SNMP versions",
          "unknown_community_name": "  0 Unknown community name",
          "illegal_community_name": "  0 Illegal operation for community name supplied",
          "encoding_Err": "    0 Encoding errors",
          "req_var_nums": "    3 Number of requested variables",
          "alt_var_nums": "    0 Number of altered variables",
          "get_req_in": "      0 Get-request PDUs",
          "getnext_req_in": "  2 Get-next PDUs",
          "set_req_in": "      0 Set-request PDUs",
          "noname_pdu_in": "   0 No such name PDU",
          "badval_pdu_in": "   0 Bad value PDU",
          "ro_pdu_in": "       0 Read Only PDU",
          "genral_err_in": "   0 General errors",
          "get_resp_in": "     0 Get Responses",
          "unknown_ctx": "     0 Unknown Context name",
          "snmp_output_packets": "155 SNMP packets output",
          "trap_pdu": "        152 Trap PDU",
          "toobig_err": "      0 Too big errors (Maximum packet size 1500)",
          "noname_pdu_out": "  0 No such name errors",
          "badval_pdu_out": "  0 Bad values errors",
          "genral_err_out": "  0 General errors",
          "get_req_out": "     0 Get Requests",
          "getnext_req_out": " 0 Get Next Requests",
          "set_req_out": "     0 Set Requests",
          "get_resp_out": "    3 Get Responses",
          "silent_drops": "    0 Silent drops",
          "max_pkt_size": "Max packetsize: 1500",
          "tcp_auth_status": "SNMP Tcp Authentication Flag : Enabled.",
          "protocol_status": "SNMP protocol : Enabled",
          "TABLE_snmp_users": {
            "ROW_snmp_users": [
              {
                "user": "test                ",
                "auth": "md5   ",
                "priv": "des(no)       ",
                "TABLE_groups": {
                  "ROW_groups": {
                    "group": "network-operator    "
                  }
                }
              },
              {
                "user": "admin               ",
                "auth": "md5   ",
                "priv": "des(no)       ",
                "TABLE_groups": {
                  "ROW_groups": {
                    "group": "network-admin       "
                  }
                }
              }
            ]
          },
          "TABLE_snmp_community": {
            "ROW_snmp_community": {
              "community_name": "public",
              "grouporaccess": "network-operator    ",
              "context": "",
              "aclfilter": ""
            }
          },
          "TABLE_snmp_contexts": {
            "ROW_snmp_contexts": [
              {
                "context_name": "1",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "1"
              },
              {
                "context_name": "2",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "2"
              },
              {
                "context_name": "3",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "3"
              },
              {
                "context_name": "4",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "4"
              },
              {
                "context_name": "5",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "5"
              },
              {
                "context_name": "6",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "6"
              },
              {
                "context_name": "7",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "7"
              },
              {
                "context_name": "8",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "8"
              },
              {
                "context_name": "9",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "9"
              },
              {
                "context_name": "10",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "10"
              },
              {
                "context_name": "vlan-1",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "1"
              },
              {
                "context_name": "vlan-2",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "2"
              },
              {
                "context_name": "vlan-3",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "3"
              },
              {
                "context_name": "vlan-4",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "4"
              },
              {
                "context_name": "vlan-5",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "5"
              },
              {
                "context_name": "vlan-6",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "6"
              },
              {
                "context_name": "vlan-7",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "7"
              },
              {
                "context_name": "vlan-8",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "8"
              },
              {
                "context_name": "vlan-9",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "9"
              },
              {
                "context_name": "vlan-10",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "10"
              }
            ]
          }
        }
      }
    }
  }
}

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

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

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show snmp
sys contact:
sys location:

3 SNMP packets input
        0 Bad SNMP versions
        0 Unknown community name
        0 Illegal operation for community name supplied
        0 Encoding errors
        3 Number of requested variables
        0 Number of altered variables
        0 Get-request PDUs
        2 Get-next PDUs
        0 Set-request PDUs
        0 No such name PDU
        0 Bad value PDU
        0 Read Only PDU
        0 General errors
        0 Get Responses
        0 Unknown Context name
155 SNMP packets output
        152 Trap PDU
        0 Too big errors (Maximum packet size 1500)
        0 No such name errors
        0 Bad values errors
        0 General errors
        0 Get Requests
        0 Get Next Requests
        0 Set Requests
        3 Get Responses
        0 Silent drops

Max packetsize: 1500


Community             Group / Access      context    aclfilter
__             __      ___    __
public                network-operator


__
                  SNMP USERS
__

User                Auth  Priv(enforce) Groups              aclfilter
                  __ __              __
test                md5   des(no)       network-operator
admin               md5   des(no)       network-admin
__
 NOTIFICATION TARGET USERS (configured  for sending V3 Inform)
__

User                          Auth  Priv
                            __


SNMP Tcp Authentication Flag : Enabled.


SNMP protocol : Enabled


--------------------------------------------------------------------
Context                          [Protocol instance, VRF, Topology,]
                                 [vlan, MST]
--------------------------------------------------------------------
1                                ,
                                ,
                                ,
                                ,
                                 1,

-------------------------------------------------------------------
2                                ,
                                ,
                                ,
                                ,
                                 2,

-------------------------------------------------------------------
3                                ,
                                ,
                                ,
                                ,
                                 3,

-------------------------------------------------------------------
4                                ,
                                ,
                                ,
                                ,
                                 4,

-------------------------------------------------------------------
5                                ,
                                ,
                                ,
                                ,
                                 5,

-------------------------------------------------------------------
6                                ,
                                ,
                                ,
                                ,
                                 6,

-------------------------------------------------------------------
7                                ,
                                ,
                                ,
                                ,
                                 7,

-------------------------------------------------------------------
8                                ,
                                ,
                                ,
                                ,
                                 8,

-------------------------------------------------------------------
9                                ,
                                ,
                                ,
                                ,
                                 9,

-------------------------------------------------------------------
10                                ,
                                ,
                                ,
                                ,
                                 10,

-------------------------------------------------------------------
vlan-1                                ,
                                ,
                                ,
                                ,
                                 1,

-------------------------------------------------------------------
vlan-2                                ,
                                ,
                                ,
                                ,
                                 2,

-------------------------------------------------------------------
vlan-3                                ,
                                ,
                                ,
                                ,
                                 3,

-------------------------------------------------------------------
vlan-4                                ,
                                ,
                                ,
                                ,
                                 4,

-------------------------------------------------------------------
vlan-5                                ,
                                ,
                                ,
                                ,
                                 5,

-------------------------------------------------------------------
vlan-6                                ,
                                ,
                                ,
                                ,
                                 6,

-------------------------------------------------------------------
vlan-7                                ,
                                ,
                                ,
                                ,
                                 7,

-------------------------------------------------------------------
vlan-8                                ,
                                ,
                                ,
                                ,
                                 8,

-------------------------------------------------------------------
vlan-9                                ,
                                ,
                                ,
                                ,
                                 9,

-------------------------------------------------------------------
vlan-10                                ,
                                ,
                                ,
                                ,
                                 10,

-------------------------------------------------------------------



show snmp community

show snmp community

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 community",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show snmp community",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_snmp_community": {
            "ROW_snmp_community": {
              "community_name": "public",
              "grouporaccess": "network-operator    ",
              "context": "",
              "aclfilter": ""
            }
          }
        }
      }
    }
  }
}

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

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

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show snmp community
Community             Group / Access      context    aclfilter
__             __      ___    __
public                network-operator



show snmp context

show snmp context

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 context",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show snmp context",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_snmp_contexts": {
            "ROW_snmp_contexts": [
              {
                "context_name": "1",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "1"
              },
              {
                "context_name": "2",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "2"
              },
              {
                "context_name": "3",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "3"
              },
              {
                "context_name": "4",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "4"
              },
              {
                "context_name": "5",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "5"
              },
              {
                "context_name": "6",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "6"
              },
              {
                "context_name": "7",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "7"
              },
              {
                "context_name": "8",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "8"
              },
              {
                "context_name": "9",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "9"
              },
              {
                "context_name": "10",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "10"
              },
              {
                "context_name": "vlan-1",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "1"
              },
              {
                "context_name": "vlan-2",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "2"
              },
              {
                "context_name": "vlan-3",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "3"
              },
              {
                "context_name": "vlan-4",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "4"
              },
              {
                "context_name": "vlan-5",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "5"
              },
              {
                "context_name": "vlan-6",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "6"
              },
              {
                "context_name": "vlan-7",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "7"
              },
              {
                "context_name": "vlan-8",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "8"
              },
              {
                "context_name": "vlan-9",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "9"
              },
              {
                "context_name": "vlan-10",
                "proto_instanceid": "",
                "vrf": "",
                "topology": "",
                "vlan": "10"
              }
            ]
          }
        }
      }
    }
  }
}

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

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

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show snmp context
--------------------------------------------------------------------
Context                          [Protocol instance, VRF, Topology,]
                                 [vlan, MST]
--------------------------------------------------------------------
1                                ,
                                ,
                                ,
                                ,
                                 1,

-------------------------------------------------------------------
2                                ,
                                ,
                                ,
                                ,
                                 2,

-------------------------------------------------------------------
3                                ,
                                ,
                                ,
                                ,
                                 3,

-------------------------------------------------------------------
4                                ,
                                ,
                                ,
                                ,
                                 4,

-------------------------------------------------------------------
5                                ,
                                ,
                                ,
                                ,
                                 5,

-------------------------------------------------------------------
6                                ,
                                ,
                                ,
                                ,
                                 6,

-------------------------------------------------------------------
7                                ,
                                ,
                                ,
                                ,
                                 7,

-------------------------------------------------------------------
8                                ,
                                ,
                                ,
                                ,
                                 8,

-------------------------------------------------------------------
9                                ,
                                ,
                                ,
                                ,
                                 9,

-------------------------------------------------------------------
10                                ,
                                ,
                                ,
                                ,
                                 10,

-------------------------------------------------------------------
vlan-1                                ,
                                ,
                                ,
                                ,
                                 1,

-------------------------------------------------------------------
vlan-2                                ,
                                ,
                                ,
                                ,
                                 2,

-------------------------------------------------------------------
vlan-3                                ,
                                ,
                                ,
                                ,
                                 3,

-------------------------------------------------------------------
vlan-4                                ,
                                ,
                                ,
                                ,
                                 4,

-------------------------------------------------------------------
vlan-5                                ,
                                ,
                                ,
                                ,
                                 5,

-------------------------------------------------------------------
vlan-6                                ,
                                ,
                                ,
                                ,
                                 6,

-------------------------------------------------------------------
vlan-7                                ,
                                ,
                                ,
                                ,
                                 7,

-------------------------------------------------------------------
vlan-8                                ,
                                ,
                                ,
                                ,
                                 8,

-------------------------------------------------------------------
vlan-9                                ,
                                ,
                                ,
                                ,
                                 9,

-------------------------------------------------------------------
vlan-10                                ,
                                ,
                                ,
                                ,
                                 10,

-------------------------------------------------------------------



show snmp engineID

show snmp engineID

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 engineID",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show snmp engineID",
        "msg": "Success",
        "code": "200",
        "body": {
          "engineIDHex": "800000090300F28B7A96E6",
          "engineIDDec": "128:000:000:009:003:000:242:139:122:150:230"
        }
      }
    }
  }
}

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

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

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show snmp engineID
Local SNMP engineID: [Hex] 800000090300F28B7A96E6
                     [Dec] 128:000:000:009:003:000:242:139:122:150:230


show snmp group

show snmp group

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 group",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show snmp group",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_role": {
            "ROW_role": [
              {
                "role_name": "aaa-db-admin",
                "role_description": "Predefined AAA DB admin, has no cli permissions. Allows RESTful API",
                "TABLE_rule": {
                  "ROW_rule": {
                    "rule_num": 1,
                    "rule_action": "permit",
                    "rule_permission": "read-write"
                  }
                }
              },
              {
                "role_name": "aaa-db-operator",
                "role_description": "Predefined AAA DB operator, has no cli permissions. Allows RESTful API",
                "TABLE_rule": {
                  "ROW_rule": {
                    "rule_num": 1,
                    "rule_action": "permit",
                    "rule_permission": "read"
                  }
                }
              },
              {
                "role_name": "l3-db-admin",
                "role_description": "Predefined L3 DB admin, has no cli permissions. Allows RESTful API",
                "TABLE_rule": {
                  "ROW_rule": {
                    "rule_num": 1,
                    "rule_action": "permit",
                    "rule_permission": "read-write"
                  }
                }
              },
              {
                "role_name": "l3-db-operator",
                "role_description": "Predefined L3 DB operator, has no cli permissions. Allows RESTful API",
                "TABLE_rule": {
                  "ROW_rule": {
                    "rule_num": 1,
                    "rule_action": "permit",
                    "rule_permission": "read"
                  }
                }
              },
              {
                "role_name": "network-admin",
                "role_description": "Predefined network admin role has access to all commands\n  on the switch",
                "TABLE_rule": {
                  "ROW_rule": {
                    "rule_num": 1,
                    "rule_action": "permit",
                    "rule_permission": "read-write"
                  }
                }
              },
              {
                "role_name": "network-operator",
                "role_description": "Predefined network operator role has access to all read\n  commands on the switch",
                "TABLE_rule": {
                  "ROW_rule": {
                    "rule_num": 1,
                    "rule_action": "permit",
                    "rule_permission": "read"
                  }
                }
              },
              {
                "role_name": "nxdb-admin",
                "role_description": "Predefined nxdb-admin role has no cli permissions.\n  Allows json-rpc get and set.",
                "TABLE_rule": {
                  "ROW_rule": {
                    "rule_num": 1,
                    "rule_action": "deny",
                    "rule_permission": "command",
                    "rule_entity": ""
                  }
                }
              },
              {
                "role_name": "nxdb-operator",
                "role_description": "Predefined nxdb-operator role has no cli permissions.\n  Allows json-rpc get.",
                "TABLE_rule": {
                  "ROW_rule": {
                    "rule_num": 1,
                    "rule_action": "deny",
                    "rule_permission": "command",
                    "rule_entity": ""
                  }
                }
              },
              {
                "role_name": "vdc-admin",
                "role_description": "Predefined vdc admin role has access to all commands within\n  a VDC instance",
                "TABLE_rule": {
                  "ROW_rule": {
                    "rule_num": 1,
                    "rule_action": "permit",
                    "rule_permission": "read-write"
                  }
                }
              },
              {
                "role_name": "vdc-operator",
                "role_description": "Predefined vdc operator role has access to all read commands\n  within a VDC instance",
                "TABLE_rule": {
                  "ROW_rule": {
                    "rule_num": 1,
                    "rule_action": "permit",
                    "rule_permission": "read"
                  }
                }
              },
              {
                "role_name": "dev-ops",
                "role_description": "Predefined system role for devops access. This role\n  cannot be modified.",
                "TABLE_rule": {
                  "ROW_rule": [
                    {
                      "rule_num": 6,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "conf t ; username *"
                    },
                    {
                      "rule_num": 5,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "attach module *"
                    },
                    {
                      "rule_num": 4,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "slot *"
                    },
                    {
                      "rule_num": 3,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "bcm module *"
                    },
                    {
                      "rule_num": 2,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "run bash *"
                    },
                    {
                      "rule_num": 1,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "python *"
                    }
                  ]
                }
              },
              {
                "role_name": "priv-15",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)",
                "TABLE_rule": {
                  "ROW_rule": {
                    "rule_num": 1,
                    "rule_action": "permit",
                    "rule_permission": "read-write"
                  }
                }
              },
              {
                "role_name": "priv-14",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)",
                "TABLE_rule": {
                  "ROW_rule": {
                    "rule_num": 1,
                    "rule_action": "permit",
                    "rule_permission": "read-write"
                  }
                }
              },
              {
                "role_name": "priv-13",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)"
              },
              {
                "role_name": "priv-12",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)"
              },
              {
                "role_name": "priv-11",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)"
              },
              {
                "role_name": "priv-10",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)"
              },
              {
                "role_name": "priv-9",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)"
              },
              {
                "role_name": "priv-8",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)"
              },
              {
                "role_name": "priv-7",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)"
              },
              {
                "role_name": "priv-6",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)"
              },
              {
                "role_name": "priv-5",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)"
              },
              {
                "role_name": "priv-4",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)"
              },
              {
                "role_name": "priv-3",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)"
              },
              {
                "role_name": "priv-2",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)"
              },
              {
                "role_name": "priv-1",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)"
              },
              {
                "role_name": "priv-0",
                "role_description": "This is a system defined privilege role.",
                "permit_vlan": "permit (default)",
                "permit_interface": "permit (default)",
                "permit_vrf": "permit (default)",
                "TABLE_rule": {
                  "ROW_rule": [
                    {
                      "rule_num": 10,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "traceroute6 *"
                    },
                    {
                      "rule_num": 9,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "traceroute *"
                    },
                    {
                      "rule_num": 8,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "telnet6 *"
                    },
                    {
                      "rule_num": 7,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "telnet *"
                    },
                    {
                      "rule_num": 6,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "ping6 *"
                    },
                    {
                      "rule_num": 5,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "ping *"
                    },
                    {
                      "rule_num": 4,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "ssh6 *"
                    },
                    {
                      "rule_num": 3,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "ssh *"
                    },
                    {
                      "rule_num": 2,
                      "rule_action": "permit",
                      "rule_permission": "command",
                      "rule_entity": "enable *"
                    },
                    {
                      "rule_num": 1,
                      "rule_action": "permit",
                      "rule_permission": "read"
                    }
                  ]
                }
              }
            ]
          }
        }
      }
    }
  }
}

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

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

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show snmp group

Role: aaa-db-admin
  Description: Predefined AAA DB admin, has no cli permissions. Allows RESTful API
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read-write

Role: aaa-db-operator
  Description: Predefined AAA DB operator, has no cli permissions. Allows RESTful API
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read

Role: l3-db-admin
  Description: Predefined L3 DB admin, has no cli permissions. Allows RESTful API
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read-write

Role: l3-db-operator
  Description: Predefined L3 DB operator, has no cli permissions. Allows RESTful API
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read

Role: network-admin
  Description: Predefined network admin role has access to all commands
  on the switch
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read-write

Role: network-operator
  Description: Predefined network operator role has access to all read
  commands on the switch
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read

Role: nxdb-admin
  Description: Predefined nxdb-admin role has no cli permissions.
  Allows json-rpc get and set.
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       deny    command

Role: nxdb-operator
  Description: Predefined nxdb-operator role has no cli permissions.
  Allows json-rpc get.
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       deny    command

Role: vdc-admin
  Description: Predefined vdc admin role has access to all commands within
  a VDC instance
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read-write

Role: vdc-operator
  Description: Predefined vdc operator role has access to all read commands
  within a VDC instance
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read

Role: dev-ops
  Description: Predefined system role for devops access. This role
  cannot be modified.
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  6       permit  command                         conf t ; username 
  5       permit  command                         attach module 
  4       permit  command                         slot 
  3       permit  command                         bcm module 
  2       permit  command                         run bash 
  1       permit  command                         python 

Role: priv-15
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read-write

Role: priv-14
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read-write

Role: priv-13
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-12
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-11
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-10
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-9
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-8
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-7
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-6
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-5
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-4
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-3
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-2
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-1
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-0
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  10      permit  command                         traceroute6 
  9       permit  command                         traceroute 
  8       permit  command                         telnet6 
  7       permit  command                         telnet 
  6       permit  command                         ping6 
  5       permit  command                         ping 
  4       permit  command                         ssh6 
  3       permit  command                         ssh 
  2       permit  command                         enable 
  1       permit  readshow snmp group

Role: aaa-db-admin
  Description: Predefined AAA DB admin, has no cli permissions. Allows RESTful API
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read-write

Role: aaa-db-operator
  Description: Predefined AAA DB operator, has no cli permissions. Allows RESTful API
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read

Role: l3-db-admin
  Description: Predefined L3 DB admin, has no cli permissions. Allows RESTful API
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read-write

Role: l3-db-operator
  Description: Predefined L3 DB operator, has no cli permissions. Allows RESTful API
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read

Role: network-admin
  Description: Predefined network admin role has access to all commands
  on the switch
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read-write

Role: network-operator
  Description: Predefined network operator role has access to all read
  commands on the switch
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read

Role: nxdb-admin
  Description: Predefined nxdb-admin role has no cli permissions.
  Allows json-rpc get and set.
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       deny    command

Role: nxdb-operator
  Description: Predefined nxdb-operator role has no cli permissions.
  Allows json-rpc get.
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       deny    command

Role: vdc-admin
  Description: Predefined vdc admin role has access to all commands within
  a VDC instance
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read-write

Role: vdc-operator
  Description: Predefined vdc operator role has access to all read commands
  within a VDC instance
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read

Role: dev-ops
  Description: Predefined system role for devops access. This role
  cannot be modified.
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  6       permit  command                         conf t ; username 
  5       permit  command                         attach module 
  4       permit  command                         slot 
  3       permit  command                         bcm module 
  2       permit  command                         run bash 
  1       permit  command                         python 

Role: priv-15
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read-write

Role: priv-14
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  1       permit  read-write

Role: priv-13
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-12
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-11
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-10
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-9
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-8
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-7
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-6
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-5
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-4
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-3
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-2
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-1
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)

Role: priv-0
  Description: This is a system defined privilege role.
  Vlan policy: permit (default)
  Interface policy: permit (default)
  Vrf policy: permit (default)
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity
  -------------------------------------------------------------------
  10      permit  command                         traceroute6 
  9       permit  command                         traceroute 
  8       permit  command                         telnet6 
  7       permit  command                         telnet 
  6       permit  command                         ping6 
  5       permit  command                         ping 
  4       permit  command                         ssh6 
  3       permit  command                         ssh 
  2       permit  command                         enable 
  1       permit  read

show snmp host

show snmp host

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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show snmp host",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_host": {
            "ROW_host": {
              "host": "3.3.3.3",
              "port": "162  ",
              "version": "v2c      ",
              "level": "noauth ",
              "type": "trap   ",
              "secname": "public                          ",
              "vrf": "\nUse VRF: management",
              "src_intf": "\nSource interface: loopback1"
            }
          }
        }
      }
    }
  }
}

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

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

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show snmp host
-------------------------------------------------------------------
Host                            Port Version  Level  Type   SecName
-------------------------------------------------------------------
3.3.3.3                         162  v2c      noauth trap   public
Use VRF: management
Source interface: loopback1



show snmp nms-statistics

show snmp nms-statistics

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 nms-statistics",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show snmp nms-statistics",
        "msg": "Success",
        "code": "200",
        "body": {
          "header": "- SNMP NMS OID Stats -\n",
          "nms_stats": "\nNMS IP Address                              GET    GET    GET    SET                First Poll                 Last Poll\n                                                  NEXT   BULK\n------------------------------------------------------------------------------------------------------------------------\n10.77.143.230                                 0      2      0      0  20:21:37:239 Jul 29 2018  20:21:38:241 Jul 29 2018\n"
        }
      }
    }
  }
}

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

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

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show snmp nms-statistics
- SNMP NMS OID Stats -

NMS IP Address                              GET    GET    GET    SET                First Poll                 Last Poll
                                                  NEXT   BULK
------------------------------------------------------------------------------------------------------------------------
10.77.143.230                                 0      2      0      0  20:21:37:239 Jul 29 2018  20:21:38:241 Jul 29 2018


show snmp oid-statistics last-access

show snmp oid-statistics last-access

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 oid-statistics last-access",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show snmp oid-statistics last-access",
        "msg": "Success",
        "code": "200",
        "body": {
          "header": "-  SNMP Latest OID Stats -\n",
          "TABLE_snmp_la": {
            "ROW_snmp_la": [
              {
                "oid_last_access_stats": "\nObject ID                                           Last Access TS   Last Access                          Last-polled NMS\n                                                                        Rsp Time\n-------------------------------------------------------------------------------------------------------------------------\n"
              },
              {
                "oid_last_access_stats": "iso.3.6.1.2.1.1.5                         20:21:37:239 Jul 29 2018            <1                            10.77.143.230\n"
              },
              {
                "oid_last_access_stats": "iso.3.6.1.2.1.1.6                         20:21:38:241 Jul 29 2018            <1                            10.77.143.230\n"
              }
            ]
          }
        }
      }
    }
  }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show snmp oid-statistics last-access command, see the CLI command reference:

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

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show snmp oid-statistics last-access
-  SNMP Latest OID Stats -

Object ID                                           Last Access TS   Last Access                          Last-polled NMS
                                                                        Rsp Time
-------------------------------------------------------------------------------------------------------------------------
iso.3.6.1.2.1.1.5                         20:21:37:239 Jul 29 2018            <1                            10.77.143.230
iso.3.6.1.2.1.1.6                         20:21:38:241 Jul 29 2018            <1                            10.77.143.230




show snmp sessions

show snmp sessions

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 sessions",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show snmp sessions",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_session": {
            "ROW_session": {
              "dest": "3.3.3.3"
            }
          }
        }
      }
    }
  }
}

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

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

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show snmp sessions
Destination: 3.3.3.3




show snmp trap

show snmp trap

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 trap",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show snmp trap",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_snmp_trap": {
            "ROW_snmp_trap": [
              {
                "trap_type": "entity",
                "description": "entity_mib_change",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "entity",
                "description": "entity_module_status_change",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "entity",
                "description": "entity_power_status_change",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "entity",
                "description": "entity_module_inserted",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "entity",
                "description": "entity_module_removed",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "entity",
                "description": "entity_unrecognised_module",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "entity",
                "description": "entity_fan_status_change",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "entity",
                "description": "entity_power_out_change",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "link",
                "description": "linkDown",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "link",
                "description": "linkUp",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "link",
                "description": "extended-linkDown",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "link",
                "description": "extended-linkUp",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "link",
                "description": "cieLinkDown",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "link",
                "description": "cieLinkUp",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "link",
                "description": "delayed-link-state-change",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "callhome",
                "description": "event-notify",
                "isEnabled": "No"
              },
              {
                "trap_type": "callhome",
                "description": "smtp-send-fail",
                "isEnabled": "No"
              },
              {
                "trap_type": "cfs",
                "description": "state-change-notif",
                "isEnabled": "No"
              },
              {
                "trap_type": "cfs",
                "description": "merge-failure",
                "isEnabled": "No"
              },
              {
                "trap_type": "rf",
                "description": "redundancy_framework",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "aaa",
                "description": "server-state-change",
                "isEnabled": "No"
              },
              {
                "trap_type": "license",
                "description": "notify-license-expiry",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "license",
                "description": "notify-no-license-for-feature",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "license",
                "description": "notify-licensefile-missing",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "license",
                "description": "notify-license-expiry-warning",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "upgrade",
                "description": "UpgradeOpNotifyOnCompletion",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "upgrade",
                "description": "UpgradeJobStatusNotify",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "feature-control",
                "description": "FeatureOpStatusChange",
                "isEnabled": "No"
              },
              {
                "trap_type": "sysmgr",
                "description": "cseFailSwCoreNotifyExtended",
                "isEnabled": "No"
              },
              {
                "trap_type": "rmon",
                "description": "risingAlarm",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "rmon",
                "description": "fallingAlarm",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "rmon",
                "description": "hcRisingAlarm",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "rmon",
                "description": "hcFallingAlarm",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "config",
                "description": "ccmCLIRunningConfigChanged",
                "isEnabled": "No"
              },
              {
                "trap_type": "snmp",
                "description": "authentication",
                "isEnabled": "No"
              },
              {
                "trap_type": "link",
                "description": "cisco-xcvr-mon-status-chg",
                "isEnabled": "No"
              },
              {
                "trap_type": "vtp",
                "description": "notifs",
                "isEnabled": "No"
              },
              {
                "trap_type": "vtp",
                "description": "vlancreate",
                "isEnabled": "No"
              },
              {
                "trap_type": "vtp",
                "description": "vlandelete",
                "isEnabled": "No"
              },
              {
                "trap_type": "bridge",
                "description": "newroot",
                "isEnabled": "No"
              },
              {
                "trap_type": "bridge",
                "description": "topologychange",
                "isEnabled": "No"
              },
              {
                "trap_type": "stpx",
                "description": "inconsistency",
                "isEnabled": "No"
              },
              {
                "trap_type": "stpx",
                "description": "root-inconsistency",
                "isEnabled": "No"
              },
              {
                "trap_type": "stpx",
                "description": "loop-inconsistency",
                "isEnabled": "No"
              },
              {
                "trap_type": "entity",
                "description": "entity_sensor",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "entity",
                "description": "cefcMIBEnableStatusNotification",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "system",
                "description": "Clock-change-notification",
                "isEnabled": "No"
              },
              {
                "trap_type": "generic",
                "description": "coldStart",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "generic",
                "description": "warmStart",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "feature-control",
                "description": "ciscoFeatOpStatusChange",
                "isEnabled": "No"
              },
              {
                "trap_type": "mmode",
                "description": "cseNormalModeChangeNotify",
                "isEnabled": "No"
              },
              {
                "trap_type": "mmode",
                "description": "cseMaintModeChangeNotify",
                "isEnabled": "No"
              },
              {
                "trap_type": "storm-control",
                "description": "cpscEventRev1",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "link",
                "description": "cErrDisableInterfaceEventRev1",
                "isEnabled": "Yes"
              },
              {
                "trap_type": "link",
                "description": "cmn-mac-move-notification",
                "isEnabled": "Yes"
              }
            ]
          }
        }
      }
    }
  }
}

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

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

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show snmp trap
--------------------------------------------------------------------------------
Trap type                       Description                   Enabled
--------------------------------------------------------------------------------
entity               : entity_mib_change               Yes
entity               : entity_module_status_change     Yes
entity               : entity_power_status_change      Yes
entity               : entity_module_inserted          Yes
entity               : entity_module_removed           Yes
entity               : entity_unrecognised_module      Yes
entity               : entity_fan_status_change        Yes
entity               : entity_power_out_change         Yes
link                 : linkDown                        Yes
link                 : linkUp                          Yes
link                 : extended-linkDown               Yes
link                 : extended-linkUp                 Yes
link                 : cieLinkDown                     Yes
link                 : cieLinkUp                       Yes
link                 : delayed-link-state-change       Yes
callhome             : event-notify                    No
callhome             : smtp-send-fail                  No
cfs                  : state-change-notif              No
cfs                  : merge-failure                   No
rf                   : redundancy_framework            Yes
aaa                  : server-state-change             No
license              : notify-license-expiry           Yes
license              : notify-no-license-for-feature   Yes
license              : notify-licensefile-missing      Yes
license              : notify-license-expiry-warning   Yes
upgrade              : UpgradeOpNotifyOnCompletion     Yes
upgrade              : UpgradeJobStatusNotify          Yes
feature-control      : FeatureOpStatusChange           No
sysmgr               : cseFailSwCoreNotifyExtended     No
rmon                 : risingAlarm                     Yes
rmon                 : fallingAlarm                    Yes
rmon                 : hcRisingAlarm                   Yes
rmon                 : hcFallingAlarm                  Yes
config               : ccmCLIRunningConfigChanged      No
snmp                 : authentication                  No
link                 : cisco-xcvr-mon-status-chg       No
vtp                  : notifs                          No
vtp                  : vlancreate                      No
vtp                  : vlandelete                      No
bridge               : newroot                         No
bridge               : topologychange                  No
stpx                 : inconsistency                   No
stpx                 : root-inconsistency              No
stpx                 : loop-inconsistency              No
entity               : entity_sensor                   Yes
entity               : cefcMIBEnableStatusNotification Yes
system               : Clock-change-notification       No
generic              : coldStart                       Yes
generic              : warmStart                       Yes
feature-control      : ciscoFeatOpStatusChange         No
mmode                : cseNormalModeChangeNotify       No
mmode                : cseMaintModeChangeNotify        No
storm-control        : cpscEventRev1                   Yes
link                 : cErrDisableInterfaceEventRev1   Yes
link                 : cmn-mac-move-notification       Yes

show snmp user

show snmp user

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 user",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show snmp user",
        "msg": "Success",
        "code": "200",
        "body": {
        "TABLE_snmp_users": {
            "ROW_snmp_users": [
                {
                    "user": "u1", 
                    "auth": "md5", 
                    "priv": "no", 
                    "group": [
                        "network-operator", 
                        "priv-5", 
                        "priv-8", 
                        "priv-9", 
                        "network-admin"
                    ]
                }, 
                {
                    "user": "admin", 
                    "auth": "md5", 
                    "priv": "des(no)", 
                    "group": "network-admin"
            }
        ]
    }
}

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

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

Note: This example was added in Cisco NX-OS Release 9.2(3).

CLI Output
Switch# show snmp user
User                Auth  Priv(enforce) Groups              aclfilter
                  __ __              __
u1                  md5   no            network-operator   network-admin             priv-5              priv-8              priv-9
admin               md5   des(no)       network-admin


show snmp user test

show snmp user test

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 user test",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show snmp user test",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_snmp_users": {
            "ROW_snmp_users": {
              "user": "test                ",
              "auth": "md5   ",
              "priv": "des(no)       ",
              "TABLE_groups": {
                "ROW_groups": {
                  "group": "network-operator    "
                }
              }
            }
          }
        }
      }
    }
  }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show snmp user test command, see the CLI command reference:

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

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show snmp user test
User                Auth  Priv(enforce) Groups              aclfilter
                  __ __              __
test                md5   des(no)       network-operator


show snmp source-interface

show snmp source-interface

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 source-interface",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show snmp source-interface",
        "msg": "Success",
        "code": "200",
        "body": {
          "trap_srcintf": "",
          "informs_srcintf": ""
        }
      }
    }
  }
}

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

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

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show snmp source-interface
-------------------------------------------------------------------
Notification                     source-interface
-------------------------------------------------------------------
trap                             -
inform                           -
-------------------------------------------------------------------