超时前未收到 SNMP 响应 - 使用非常基础的示例示例
No SNMP response received before timeout-with very basics sample examples
我是 pysnmp 的新手。在阅读 snmplabs.com 的文档时,我尝试了 get_command 的代码,但我得到的输出是在超时
之前没有收到 SNMP 响应
正如在对几个类似问题的回答中提到的,我尝试在我的代码开头添加下面提到的内容。
from pysnmp import debug
debug.setLogger(debug.Debug('io', 'msgproc', 'secmod'))
完整代码如下图
from pysnmp.hlapi import *
from pysnmp import debug
debug.setLogger(debug.Debug('io', 'msgproc', 'secmod'))
def getFunc(OID):
errorIndication, errorStatus, errorIndex, varBinds = next(
getCmd(SnmpEngine(),
CommunityData('public', mpModel=0),
UdpTransportTarget(('demo.snmplabs.com', 161)),
ContextData(),
ObjectType(ObjectIdentity('SNMPv2-MIB', OID, 0)))
)
if errorIndication:
print(errorIndication)
elif errorStatus:
print('%s at %s' % (errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
else:
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
if __name__ == "__main__":
getFunc('sysName')
输出日志如下图
/usr/bin/python3.7 /home/syed/Pysnmp/manager_request.py
2019-07-22 17:40:17,572 pysnmp: running pysnmp version 4.4.9
2019-07-22 17:40:17,572 pysnmp: debug category 'io' enabled
2019-07-22 17:40:17,572 pysnmp: debug category 'msgproc' enabled
2019-07-22 17:40:17,572 pysnmp: debug category 'secmod' enabled
2019-07-22 17:40:18,394 pysnmp: prepareOutgoingMessage: PDU request-id 7462641 replaced with unique ID 2910941
2019-07-22 17:40:18,394 pysnmp: prepareOutgoingMessage: using contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:18,395 pysnmp: _sec2com: built securityName to communityName map, version 4: {(<SnmpAdminString value object at 0x7f9ce6c348d0 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6ac5198 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>, <ValueSizeConstraint object at 0x7f9ce6ac5160 consts 1, 32>> encoding utf-8 payload [s-6747094288003100596]>, <SnmpEngineID value object at 0x7f9ce6c34908 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]>, <SnmpAdminString value object at 0x7f9ce6c34978 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6ac52e8 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>, <ValueSizeConstraint object at 0x7f9ce6ac52b0 consts 0, 32>> encoding utf-8 payload []>): <OctetString value object at 0x7f9ce6c2e470 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ceb6fb1d0 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>> encoding iso-8859-1 payload [public]>}
2019-07-22 17:40:18,395 pysnmp: generateRequestMsg: using community <OctetString value object at 0x7f9ce6c2e470 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ceb6fb1d0 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>> encoding iso-8859-1 payload [public]> for securityModel <SnmpSecurityModel value object at 0x7f9ce6c34d68 tagSet <TagSet object at 0x7f9ceb8cb2b0 tags 0:0:2> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6cfaa58 consts <ValueRangeConstraint object at 0x7f9ceb9202e8 consts -2147483648, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6aaf7f0 consts 0, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6cfaa20 consts 1, 2147483647>> payload [1]>, securityName <SnmpAdminString value object at 0x7f9ce6c34dd8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf630 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>> encoding utf-8 payload [s-6747094288003100596]>, contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:18,395 pysnmp: generateRequestMsg: Message:
version=0
community=public
data=PDUs:
get-request=GetRequestPDU:
request-id=2910941
error-status=noError
error-index=0
variable-bindings=VarBindList:
VarBind:
name=1.3.6.1.2.1.1.5.0
value=ObjectSyntax:
simple=SimpleSyntax:
empty=
2019-07-22 17:40:18,395 pysnmp: sendMessage: outgoingMessage queued (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A DD 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:18,395 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7f9ce62034a8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6c34940 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6c34b38 consts 6, 6>> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('104.236.166.95', 161) outgoingMessage (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A DD 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:19,398 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut('No SNMP response received before timeout')}
2019-07-22 17:40:19,399 pysnmp: prepareOutgoingMessage: PDU request-id 7462641 replaced with unique ID 2910942
2019-07-22 17:40:19,399 pysnmp: prepareOutgoingMessage: using contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:19,400 pysnmp: generateRequestMsg: using community <OctetString value object at 0x7f9ce6c2e470 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ceb6fb1d0 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>> encoding iso-8859-1 payload [public]> for securityModel <SnmpSecurityModel value object at 0x7f9ce6c34d68 tagSet <TagSet object at 0x7f9ceb8cb2b0 tags 0:0:2> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6cfaa58 consts <ValueRangeConstraint object at 0x7f9ceb9202e8 consts -2147483648, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6aaf7f0 consts 0, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6cfaa20 consts 1, 2147483647>> payload [1]>, securityName <SnmpAdminString value object at 0x7f9ce6c34dd8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf630 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>> encoding utf-8 payload [s-6747094288003100596]>, contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:19,401 pysnmp: generateRequestMsg: Message:
version=0
community=public
data=PDUs:
get-request=GetRequestPDU:
request-id=2910942
error-status=noError
error-index=0
variable-bindings=VarBindList:
VarBind:
name=1.3.6.1.2.1.1.5.0
value=ObjectSyntax:
simple=SimpleSyntax:
empty=
2019-07-22 17:40:19,402 pysnmp: sendMessage: outgoingMessage queued (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A DE 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:19,402 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7f9ce62034a8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6c34940 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6c34b38 consts 6, 6>> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('104.236.166.95', 161) outgoingMessage (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A DE 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:20,405 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut('No SNMP response received before timeout')}
2019-07-22 17:40:20,406 pysnmp: prepareOutgoingMessage: PDU request-id 7462641 replaced with unique ID 2910943
2019-07-22 17:40:20,407 pysnmp: prepareOutgoingMessage: using contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:20,408 pysnmp: generateRequestMsg: using community <OctetString value object at 0x7f9ce6c2e470 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ceb6fb1d0 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>> encoding iso-8859-1 payload [public]> for securityModel <SnmpSecurityModel value object at 0x7f9ce6c34d68 tagSet <TagSet object at 0x7f9ceb8cb2b0 tags 0:0:2> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6cfaa58 consts <ValueRangeConstraint object at 0x7f9ceb9202e8 consts -2147483648, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6aaf7f0 consts 0, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6cfaa20 consts 1, 2147483647>> payload [1]>, securityName <SnmpAdminString value object at 0x7f9ce6c34dd8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf630 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>> encoding utf-8 payload [s-6747094288003100596]>, contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:20,408 pysnmp: generateRequestMsg: Message:
version=0
community=public
data=PDUs:
get-request=GetRequestPDU:
request-id=2910943
error-status=noError
error-index=0
variable-bindings=VarBindList:
VarBind:
name=1.3.6.1.2.1.1.5.0
value=ObjectSyntax:
simple=SimpleSyntax:
empty=
2019-07-22 17:40:20,409 pysnmp: sendMessage: outgoingMessage queued (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A DF 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:20,410 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7f9ce62034a8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6c34940 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6c34b38 consts 6, 6>> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('104.236.166.95', 161) outgoingMessage (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A DF 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:21,412 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut('No SNMP response received before timeout')}
2019-07-22 17:40:21,413 pysnmp: prepareOutgoingMessage: PDU request-id 7462641 replaced with unique ID 2910944
2019-07-22 17:40:21,414 pysnmp: prepareOutgoingMessage: using contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:21,415 pysnmp: generateRequestMsg: using community <OctetString value object at 0x7f9ce6c2e470 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ceb6fb1d0 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>> encoding iso-8859-1 payload [public]> for securityModel <SnmpSecurityModel value object at 0x7f9ce6c34d68 tagSet <TagSet object at 0x7f9ceb8cb2b0 tags 0:0:2> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6cfaa58 consts <ValueRangeConstraint object at 0x7f9ceb9202e8 consts -2147483648, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6aaf7f0 consts 0, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6cfaa20 consts 1, 2147483647>> payload [1]>, securityName <SnmpAdminString value object at 0x7f9ce6c34dd8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf630 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>> encoding utf-8 payload [s-6747094288003100596]>, contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:21,415 pysnmp: generateRequestMsg: Message:
version=0
community=public
data=PDUs:
get-request=GetRequestPDU:
request-id=2910944
error-status=noError
error-index=0
variable-bindings=VarBindList:
VarBind:
name=1.3.6.1.2.1.1.5.0
value=ObjectSyntax:
simple=SimpleSyntax:
empty=
2019-07-22 17:40:21,416 pysnmp: sendMessage: outgoingMessage queued (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A E0 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:21,417 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7f9ce62034a8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6c34940 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6c34b38 consts 6, 6>> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('104.236.166.95', 161) outgoingMessage (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A E0 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:22,419 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut('No SNMP response received before timeout')}
2019-07-22 17:40:22,420 pysnmp: prepareOutgoingMessage: PDU request-id 7462641 replaced with unique ID 2910945
2019-07-22 17:40:22,420 pysnmp: prepareOutgoingMessage: using contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:22,421 pysnmp: generateRequestMsg: using community <OctetString value object at 0x7f9ce6c2e470 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ceb6fb1d0 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>> encoding iso-8859-1 payload [public]> for securityModel <SnmpSecurityModel value object at 0x7f9ce6c34d68 tagSet <TagSet object at 0x7f9ceb8cb2b0 tags 0:0:2> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6cfaa58 consts <ValueRangeConstraint object at 0x7f9ceb9202e8 consts -2147483648, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6aaf7f0 consts 0, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6cfaa20 consts 1, 2147483647>> payload [1]>, securityName <SnmpAdminString value object at 0x7f9ce6c34dd8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf630 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>> encoding utf-8 payload [s-6747094288003100596]>, contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:22,422 pysnmp: generateRequestMsg: Message:
version=0
community=public
data=PDUs:
get-request=GetRequestPDU:
request-id=2910945
error-status=noError
error-index=0
variable-bindings=VarBindList:
VarBind:
name=1.3.6.1.2.1.1.5.0
value=ObjectSyntax:
simple=SimpleSyntax:
empty=
2019-07-22 17:40:22,423 pysnmp: sendMessage: outgoingMessage queued (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A E1 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:22,424 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7f9ce62034a8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6c34940 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6c34b38 consts 6, 6>> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('104.236.166.95', 161) outgoingMessage (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A E1 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:23,426 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut('No SNMP response received before timeout')}
2019-07-22 17:40:23,427 pysnmp: prepareOutgoingMessage: PDU request-id 7462641 replaced with unique ID 2910946
2019-07-22 17:40:23,428 pysnmp: prepareOutgoingMessage: using contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:23,429 pysnmp: generateRequestMsg: using community <OctetString value object at 0x7f9ce6c2e470 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ceb6fb1d0 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>> encoding iso-8859-1 payload [public]> for securityModel <SnmpSecurityModel value object at 0x7f9ce6c34d68 tagSet <TagSet object at 0x7f9ceb8cb2b0 tags 0:0:2> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6cfaa58 consts <ValueRangeConstraint object at 0x7f9ceb9202e8 consts -2147483648, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6aaf7f0 consts 0, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6cfaa20 consts 1, 2147483647>> payload [1]>, securityName <SnmpAdminString value object at 0x7f9ce6c34dd8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf630 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>> encoding utf-8 payload [s-6747094288003100596]>, contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:23,430 pysnmp: generateRequestMsg: Message:
version=0
community=public
data=PDUs:
get-request=GetRequestPDU:
request-id=2910946
error-status=noError
error-index=0
variable-bindings=VarBindList:
VarBind:
name=1.3.6.1.2.1.1.5.0
value=ObjectSyntax:
simple=SimpleSyntax:
empty=
2019-07-22 17:40:23,431 pysnmp: sendMessage: outgoingMessage queued (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A E2 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:23,431 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7f9ce62034a8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6c34940 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6c34b38 consts 6, 6>> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('104.236.166.95', 161) outgoingMessage (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A E2 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
No SNMP response received before timeout
2019-07-22 17:40:24,434 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut('No SNMP response received before timeout')}
Process finished with exit code 0
确实
% snmpwalk -v 1 -c public demo.snmplabs.com
Timeout: No Response from demo.snmplabs.com
免费的东西可以随时关闭。尝试
% snmpwalk -v 1 -c public snmp.live.gambitcommunications.com system
SNMPv2-MIB::sysDescr.0 = STRING: Cisco Internetwork Operating System Software ..IOS (tm) RSP Software (RSP-JSV56I-M), Version 12.1(7), RELEASE SOFTWARE (fc1)..Copyright (c) 1986-2001 by cisco Systems, Inc...Compiled Fri 23-Feb-01 05:14 by kellythw
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.9.1.46
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1086624532) 125 days, 18:24:05.32
SNMPv2-MIB::sysContact.0 = STRING: support@gambitcomm.com
SNMPv2-MIB::sysName.0 = STRING: cisco-7513
SNMPv2-MIB::sysLocation.0 = STRING:
SNMPv2-MIB::sysServices.0 = INTEGER: 78
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
service 已经上线了!感谢提醒!
我是 pysnmp 的新手。在阅读 snmplabs.com 的文档时,我尝试了 get_command 的代码,但我得到的输出是在超时
之前没有收到 SNMP 响应正如在对几个类似问题的回答中提到的,我尝试在我的代码开头添加下面提到的内容。
from pysnmp import debug
debug.setLogger(debug.Debug('io', 'msgproc', 'secmod'))
完整代码如下图
from pysnmp.hlapi import *
from pysnmp import debug
debug.setLogger(debug.Debug('io', 'msgproc', 'secmod'))
def getFunc(OID):
errorIndication, errorStatus, errorIndex, varBinds = next(
getCmd(SnmpEngine(),
CommunityData('public', mpModel=0),
UdpTransportTarget(('demo.snmplabs.com', 161)),
ContextData(),
ObjectType(ObjectIdentity('SNMPv2-MIB', OID, 0)))
)
if errorIndication:
print(errorIndication)
elif errorStatus:
print('%s at %s' % (errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
else:
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
if __name__ == "__main__":
getFunc('sysName')
输出日志如下图
/usr/bin/python3.7 /home/syed/Pysnmp/manager_request.py
2019-07-22 17:40:17,572 pysnmp: running pysnmp version 4.4.9
2019-07-22 17:40:17,572 pysnmp: debug category 'io' enabled
2019-07-22 17:40:17,572 pysnmp: debug category 'msgproc' enabled
2019-07-22 17:40:17,572 pysnmp: debug category 'secmod' enabled
2019-07-22 17:40:18,394 pysnmp: prepareOutgoingMessage: PDU request-id 7462641 replaced with unique ID 2910941
2019-07-22 17:40:18,394 pysnmp: prepareOutgoingMessage: using contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:18,395 pysnmp: _sec2com: built securityName to communityName map, version 4: {(<SnmpAdminString value object at 0x7f9ce6c348d0 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6ac5198 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>, <ValueSizeConstraint object at 0x7f9ce6ac5160 consts 1, 32>> encoding utf-8 payload [s-6747094288003100596]>, <SnmpEngineID value object at 0x7f9ce6c34908 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]>, <SnmpAdminString value object at 0x7f9ce6c34978 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6ac52e8 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>, <ValueSizeConstraint object at 0x7f9ce6ac52b0 consts 0, 32>> encoding utf-8 payload []>): <OctetString value object at 0x7f9ce6c2e470 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ceb6fb1d0 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>> encoding iso-8859-1 payload [public]>}
2019-07-22 17:40:18,395 pysnmp: generateRequestMsg: using community <OctetString value object at 0x7f9ce6c2e470 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ceb6fb1d0 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>> encoding iso-8859-1 payload [public]> for securityModel <SnmpSecurityModel value object at 0x7f9ce6c34d68 tagSet <TagSet object at 0x7f9ceb8cb2b0 tags 0:0:2> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6cfaa58 consts <ValueRangeConstraint object at 0x7f9ceb9202e8 consts -2147483648, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6aaf7f0 consts 0, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6cfaa20 consts 1, 2147483647>> payload [1]>, securityName <SnmpAdminString value object at 0x7f9ce6c34dd8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf630 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>> encoding utf-8 payload [s-6747094288003100596]>, contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:18,395 pysnmp: generateRequestMsg: Message:
version=0
community=public
data=PDUs:
get-request=GetRequestPDU:
request-id=2910941
error-status=noError
error-index=0
variable-bindings=VarBindList:
VarBind:
name=1.3.6.1.2.1.1.5.0
value=ObjectSyntax:
simple=SimpleSyntax:
empty=
2019-07-22 17:40:18,395 pysnmp: sendMessage: outgoingMessage queued (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A DD 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:18,395 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7f9ce62034a8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6c34940 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6c34b38 consts 6, 6>> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('104.236.166.95', 161) outgoingMessage (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A DD 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:19,398 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut('No SNMP response received before timeout')}
2019-07-22 17:40:19,399 pysnmp: prepareOutgoingMessage: PDU request-id 7462641 replaced with unique ID 2910942
2019-07-22 17:40:19,399 pysnmp: prepareOutgoingMessage: using contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:19,400 pysnmp: generateRequestMsg: using community <OctetString value object at 0x7f9ce6c2e470 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ceb6fb1d0 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>> encoding iso-8859-1 payload [public]> for securityModel <SnmpSecurityModel value object at 0x7f9ce6c34d68 tagSet <TagSet object at 0x7f9ceb8cb2b0 tags 0:0:2> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6cfaa58 consts <ValueRangeConstraint object at 0x7f9ceb9202e8 consts -2147483648, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6aaf7f0 consts 0, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6cfaa20 consts 1, 2147483647>> payload [1]>, securityName <SnmpAdminString value object at 0x7f9ce6c34dd8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf630 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>> encoding utf-8 payload [s-6747094288003100596]>, contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:19,401 pysnmp: generateRequestMsg: Message:
version=0
community=public
data=PDUs:
get-request=GetRequestPDU:
request-id=2910942
error-status=noError
error-index=0
variable-bindings=VarBindList:
VarBind:
name=1.3.6.1.2.1.1.5.0
value=ObjectSyntax:
simple=SimpleSyntax:
empty=
2019-07-22 17:40:19,402 pysnmp: sendMessage: outgoingMessage queued (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A DE 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:19,402 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7f9ce62034a8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6c34940 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6c34b38 consts 6, 6>> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('104.236.166.95', 161) outgoingMessage (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A DE 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:20,405 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut('No SNMP response received before timeout')}
2019-07-22 17:40:20,406 pysnmp: prepareOutgoingMessage: PDU request-id 7462641 replaced with unique ID 2910943
2019-07-22 17:40:20,407 pysnmp: prepareOutgoingMessage: using contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:20,408 pysnmp: generateRequestMsg: using community <OctetString value object at 0x7f9ce6c2e470 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ceb6fb1d0 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>> encoding iso-8859-1 payload [public]> for securityModel <SnmpSecurityModel value object at 0x7f9ce6c34d68 tagSet <TagSet object at 0x7f9ceb8cb2b0 tags 0:0:2> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6cfaa58 consts <ValueRangeConstraint object at 0x7f9ceb9202e8 consts -2147483648, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6aaf7f0 consts 0, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6cfaa20 consts 1, 2147483647>> payload [1]>, securityName <SnmpAdminString value object at 0x7f9ce6c34dd8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf630 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>> encoding utf-8 payload [s-6747094288003100596]>, contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:20,408 pysnmp: generateRequestMsg: Message:
version=0
community=public
data=PDUs:
get-request=GetRequestPDU:
request-id=2910943
error-status=noError
error-index=0
variable-bindings=VarBindList:
VarBind:
name=1.3.6.1.2.1.1.5.0
value=ObjectSyntax:
simple=SimpleSyntax:
empty=
2019-07-22 17:40:20,409 pysnmp: sendMessage: outgoingMessage queued (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A DF 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:20,410 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7f9ce62034a8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6c34940 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6c34b38 consts 6, 6>> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('104.236.166.95', 161) outgoingMessage (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A DF 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:21,412 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut('No SNMP response received before timeout')}
2019-07-22 17:40:21,413 pysnmp: prepareOutgoingMessage: PDU request-id 7462641 replaced with unique ID 2910944
2019-07-22 17:40:21,414 pysnmp: prepareOutgoingMessage: using contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:21,415 pysnmp: generateRequestMsg: using community <OctetString value object at 0x7f9ce6c2e470 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ceb6fb1d0 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>> encoding iso-8859-1 payload [public]> for securityModel <SnmpSecurityModel value object at 0x7f9ce6c34d68 tagSet <TagSet object at 0x7f9ceb8cb2b0 tags 0:0:2> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6cfaa58 consts <ValueRangeConstraint object at 0x7f9ceb9202e8 consts -2147483648, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6aaf7f0 consts 0, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6cfaa20 consts 1, 2147483647>> payload [1]>, securityName <SnmpAdminString value object at 0x7f9ce6c34dd8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf630 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>> encoding utf-8 payload [s-6747094288003100596]>, contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:21,415 pysnmp: generateRequestMsg: Message:
version=0
community=public
data=PDUs:
get-request=GetRequestPDU:
request-id=2910944
error-status=noError
error-index=0
variable-bindings=VarBindList:
VarBind:
name=1.3.6.1.2.1.1.5.0
value=ObjectSyntax:
simple=SimpleSyntax:
empty=
2019-07-22 17:40:21,416 pysnmp: sendMessage: outgoingMessage queued (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A E0 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:21,417 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7f9ce62034a8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6c34940 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6c34b38 consts 6, 6>> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('104.236.166.95', 161) outgoingMessage (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A E0 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:22,419 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut('No SNMP response received before timeout')}
2019-07-22 17:40:22,420 pysnmp: prepareOutgoingMessage: PDU request-id 7462641 replaced with unique ID 2910945
2019-07-22 17:40:22,420 pysnmp: prepareOutgoingMessage: using contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:22,421 pysnmp: generateRequestMsg: using community <OctetString value object at 0x7f9ce6c2e470 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ceb6fb1d0 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>> encoding iso-8859-1 payload [public]> for securityModel <SnmpSecurityModel value object at 0x7f9ce6c34d68 tagSet <TagSet object at 0x7f9ceb8cb2b0 tags 0:0:2> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6cfaa58 consts <ValueRangeConstraint object at 0x7f9ceb9202e8 consts -2147483648, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6aaf7f0 consts 0, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6cfaa20 consts 1, 2147483647>> payload [1]>, securityName <SnmpAdminString value object at 0x7f9ce6c34dd8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf630 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>> encoding utf-8 payload [s-6747094288003100596]>, contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:22,422 pysnmp: generateRequestMsg: Message:
version=0
community=public
data=PDUs:
get-request=GetRequestPDU:
request-id=2910945
error-status=noError
error-index=0
variable-bindings=VarBindList:
VarBind:
name=1.3.6.1.2.1.1.5.0
value=ObjectSyntax:
simple=SimpleSyntax:
empty=
2019-07-22 17:40:22,423 pysnmp: sendMessage: outgoingMessage queued (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A E1 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:22,424 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7f9ce62034a8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6c34940 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6c34b38 consts 6, 6>> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('104.236.166.95', 161) outgoingMessage (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A E1 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:23,426 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut('No SNMP response received before timeout')}
2019-07-22 17:40:23,427 pysnmp: prepareOutgoingMessage: PDU request-id 7462641 replaced with unique ID 2910946
2019-07-22 17:40:23,428 pysnmp: prepareOutgoingMessage: using contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:23,429 pysnmp: generateRequestMsg: using community <OctetString value object at 0x7f9ce6c2e470 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ceb6fb1d0 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>> encoding iso-8859-1 payload [public]> for securityModel <SnmpSecurityModel value object at 0x7f9ce6c34d68 tagSet <TagSet object at 0x7f9ceb8cb2b0 tags 0:0:2> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6cfaa58 consts <ValueRangeConstraint object at 0x7f9ceb9202e8 consts -2147483648, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6aaf7f0 consts 0, 2147483647>, <ValueRangeConstraint object at 0x7f9ce6cfaa20 consts 1, 2147483647>> payload [1]>, securityName <SnmpAdminString value object at 0x7f9ce6c34dd8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf630 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf668 consts 0, 255>> encoding utf-8 payload [s-6747094288003100596]>, contextEngineId <SnmpEngineID value object at 0x7f9ce6aaf550 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6aaf710 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6aaf6d8 consts 5, 32>> encoding iso-8859-1 payload [0x80004fb8057379...642d453478901048]> contextName b''
2019-07-22 17:40:23,430 pysnmp: generateRequestMsg: Message:
version=0
community=public
data=PDUs:
get-request=GetRequestPDU:
request-id=2910946
error-status=noError
error-index=0
variable-bindings=VarBindList:
VarBind:
name=1.3.6.1.2.1.1.5.0
value=ObjectSyntax:
simple=SimpleSyntax:
empty=
2019-07-22 17:40:23,431 pysnmp: sendMessage: outgoingMessage queued (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A E2 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
2019-07-22 17:40:23,431 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7f9ce62034a8 tagSet <TagSet object at 0x7f9ceb7ce748 tags 0:0:4> subtypeSpec <ConstraintsIntersection object at 0x7f9ce6c34940 consts <ValueSizeConstraint object at 0x7f9ceb6fb198 consts 0, 65535>, <ValueSizeConstraint object at 0x7f9ce6c34b38 consts 6, 6>> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('104.236.166.95', 161) outgoingMessage (42 octets)
00000: 30 28 02 01 00 04 06 70 75 62 6C 69 63 A0 1B 02
00016: 03 2C 6A E2 02 01 00 02 01 00 30 0E 30 0C 06 08
00032: 2B 06 01 02 01 01 05 00 05 00
No SNMP response received before timeout
2019-07-22 17:40:24,434 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut('No SNMP response received before timeout')}
Process finished with exit code 0
确实
% snmpwalk -v 1 -c public demo.snmplabs.com
Timeout: No Response from demo.snmplabs.com
免费的东西可以随时关闭。尝试
% snmpwalk -v 1 -c public snmp.live.gambitcommunications.com system
SNMPv2-MIB::sysDescr.0 = STRING: Cisco Internetwork Operating System Software ..IOS (tm) RSP Software (RSP-JSV56I-M), Version 12.1(7), RELEASE SOFTWARE (fc1)..Copyright (c) 1986-2001 by cisco Systems, Inc...Compiled Fri 23-Feb-01 05:14 by kellythw
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.9.1.46
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1086624532) 125 days, 18:24:05.32
SNMPv2-MIB::sysContact.0 = STRING: support@gambitcomm.com
SNMPv2-MIB::sysName.0 = STRING: cisco-7513
SNMPv2-MIB::sysLocation.0 = STRING:
SNMPv2-MIB::sysServices.0 = INTEGER: 78
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
service 已经上线了!感谢提醒!