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": {
        "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"
    }
}

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 7.0(3)I7(4).

CLI Output
Switch# show snmp host
-------------------------------------------------------------------
Host                            Port Version  Level  Type   SecName
------------------------------------------------------------------- 10.157.150.137 162 v2c noauth trap public
172.22.49.19 2162 v2c noauth trap public
172.31.146.186 2162 v2c noauth trap public

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": {
        "outputs": {
            "output": {
                "body": {
                    "TABLE_snmp_trap": {
                        "ROW_snmp_trap": [
                            {
                                "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": "entity"
                            }, 
                            {
                                "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": "link"
                            }, 
                            {
                                "description": "event-notify", 
                                "isEnabled": "Yes", 
                                "trap_type": "callhome"
                            }, 
                            {
                                "description": "smtp-send-fail", 
                                "isEnabled": "Yes", 
                                "trap_type": "callhome"
                            }, 
                            {
                                "description": "state-change-notif", 
                                "isEnabled": "Yes", 
                                "trap_type": "cfs"
                            }, 
                            {
                                "description": "merge-failure", 
                                "isEnabled": "Yes", 
                                "trap_type": "cfs"
                            }, 
                            {
                                "description": "redundancy_framework", 
                                "isEnabled": "Yes", 
                                "trap_type": "rf"
                            }, 
                            {
                                "description": "server-state-change", 
                                "isEnabled": "Yes", 
                                "trap_type": "aaa"
                            }, 
                            {
                                "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": "license"
                            }, 
                            {
                                "description": "UpgradeOpNotifyOnCompletion", 
                                "isEnabled": "Yes", 
                                "trap_type": "upgrade"
                            }, 
                            {
                                "description": "UpgradeJobStatusNotify", 
                                "isEnabled": "Yes", 
                                "trap_type": "upgrade"
                            }, 
                            {
                                "description": "FeatureOpStatusChange", 
                                "isEnabled": "Yes", 
                                "trap_type": "feature-control"
                            }, 
                            {
                                "description": "cseFailSwCoreNotifyExtended", 
                                "isEnabled": "Yes", 
                                "trap_type": "sysmgr"
                            }, 
                            {
                                "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": "rmon"
                            }, 
                            {
                                "description": "ccmCLIRunningConfigChanged", 
                                "isEnabled": "Yes", 
                                "trap_type": "config"
                            }, 
                            {
                                "description": "authentication", 
                                "isEnabled": "Yes", 
                                "trap_type": "snmp"
                            }, 
                            {
                                "description": "cisco-xcvr-mon-status-chg", 
                                "isEnabled": "Yes", 
                                "trap_type": "link"
                            }, 
                            {
                                "description": "notifs", 
                                "isEnabled": "Yes", 
                                "trap_type": "vtp"
                            }, 
                            {
                                "description": "vlancreate", 
                                "isEnabled": "Yes", 
                                "trap_type": "vtp"
                            }, 
                            {
                                "description": "vlandelete", 
                                "isEnabled": "Yes", 
                                "trap_type": "vtp"
                            }, 
                            {
                                "description": "newroot", 
                                "isEnabled": "Yes", 
                                "trap_type": "bridge"
                            }, 
                            {
                                "description": "topologychange", 
                                "isEnabled": "Yes", 
                                "trap_type": "bridge"
                            }, 
                            {
                                "description": "inconsistency", 
                                "isEnabled": "Yes", 
                                "trap_type": "stpx"
                            }, 
                            {
                                "description": "root-inconsistency", 
                                "isEnabled": "Yes", 
                                "trap_type": "stpx"
                            }, 
                            {
                                "description": "loop-inconsistency", 
                                "isEnabled": "Yes", 
                                "trap_type": "stpx"
                            }, 
                            {
                                "description": "entity_sensor", 
                                "isEnabled": "Yes", 
                                "trap_type": "entity"
                            }, 
                            {
                                "description": "cefcMIBEnableStatusNotification", 
                                "isEnabled": "Yes", 
                                "trap_type": "entity"
                            }, 
                            {
                                "description": "Clock-change-notification", 
                                "isEnabled": "Yes", 
                                "trap_type": "system"
                            }, 
                            {
                                "description": "coldStart", 
                                "isEnabled": "Yes", 
                                "trap_type": "generic"
                            }, 
                            {
                                "description": "warmStart", 
                                "isEnabled": "Yes", 
                                "trap_type": "generic"
                            }, 
                            {
                                "description": "ciscoFeatOpStatusChange", 
                                "isEnabled": "Yes", 
                                "trap_type": "feature-control"
                            }, 
                            {
                                "description": "cseNormalModeChangeNotify", 
                                "isEnabled": "Yes", 
                                "trap_type": "mmode"
                            }, 
                            {
                                "description": "cseMaintModeChangeNotify", 
                                "isEnabled": "Yes", 
                                "trap_type": "mmode"
                            }, 
                            {
                                "description": "cpscEventRev1", 
                                "isEnabled": "Yes", 
                                "trap_type": "storm-control"
                            }, 
                            {
                                "description": "cErrDisableInterfaceEventRev1", 
                                "isEnabled": "Yes", 
                                "trap_type": "link"
                            }, 
                            {
                                "description": "lldpRemTablesChange", 
                                "isEnabled": "Yes", 
                                "trap_type": "lldp"
                            }, 
                            {
                                "description": "session-up", 
                                "isEnabled": "Yes", 
                                "trap_type": "bfd"
                            }, 
                            {
                                "description": "session-down", 
                                "isEnabled": "Yes", 
                                "trap_type": "bfd"
                            }, 
                            {
                                "description": "OSPF base traps", 
                                "isEnabled": "Yes", 
                                "trap_type": "ospf-2"
                            }, 
                            {
                                "description": "OSPF LSA", 
                                "isEnabled": "Yes", 
                                "trap_type": "ospf-2"
                            }, 
                            {
                                "description": "OSPF base traps", 
                                "isEnabled": "Yes", 
                                "trap_type": "ospf-csco"
                            }, 
                            {
                                "description": "OSPF LSA", 
                                "isEnabled": "Yes", 
                                "trap_type": "ospf-csco"
                            }, 
                            {
                                "description": "OSPFV3 base traps", 
                                "isEnabled": "Yes", 
                                "trap_type": "ospfv3-csco"
                            }, 
                            {
                                "description": "OSPFV3 LSA", 
                                "isEnabled": "Yes", 
                                "trap_type": "ospfv3-csco"
                            }, 
                            {
                                "description": "", 
                                "isEnabled": "No", 
                                "trap_type": "BGP-64552"
                            }
                        ]
                    }
                }, 
                "code": "200", 
                "input": "show snmp trap", 
                "msg": "Success"
            }
        }, 
        "sid": "eoc", 
        "type": "cli_show", 
        "version": "1.0"
    }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show 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 7.0(3)I7(4).

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 Yes
callhome : smtp-send-fail Yes
cfs : state-change-notif Yes
cfs : merge-failure Yes
rf : redundancy_framework Yes
aaa : server-state-change Yes
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 Yes
sysmgr : cseFailSwCoreNotifyExtended Yes
rmon : risingAlarm Yes
rmon : fallingAlarm Yes
rmon : hcRisingAlarm Yes
rmon : hcFallingAlarm Yes
config : ccmCLIRunningConfigChanged Yes
snmp : authentication Yes
link : cisco-xcvr-mon-status-chg Yes
vtp : notifs Yes
vtp : vlancreate Yes
vtp : vlandelete Yes
bridge : newroot Yes
bridge : topologychange Yes
stpx : inconsistency Yes
stpx : root-inconsistency Yes
stpx : loop-inconsistency Yes
entity : entity_sensor Yes
entity : cefcMIBEnableStatusNotification Yes
system : Clock-change-notification Yes
generic : coldStart Yes
generic : warmStart Yes
feature-control : ciscoFeatOpStatusChange Yes
mmode : cseNormalModeChangeNotify Yes
mmode : cseMaintModeChangeNotify Yes
storm-control : cpscEventRev1 Yes
link : cErrDisableInterfaceEventRev1 Yes
lldp : lldpRemTablesChange Yes
bfd : session-up Yes
bfd : session-down Yes
ospf-2 : OSPF base traps Yes
ospf-2 : OSPF LSA Yes
ospf-csco : OSPF base traps Yes
ospf-csco : OSPF LSA Yes
ospfv3-csco : OSPFV3 base traps Yes
ospfv3-csco : OSPFV3 LSA Yes
BGP-64552 : No

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

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show 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 7.0(3)I7(4).

CLI Output
Switch# show snmp user
__
    SNMP USERS 
__

User                Auth  Priv(enforce) Groups              aclfilter
__
__ __
admin md5 des(no) network-admin
dcnmuser md5 no network-admin
snmpAclUser md5 des(no) network-admin ipv4:testSnmpV3
snmpAclUser2 md5 no network-operator ipv4:testSnmpV3
__ NOTIFICATION TARGET USERS (configured for sending V3 Inform) __ User Auth Priv
__