Closed nschuz closed 1 year ago
Can you use the equivalent parameters (user credentials) via NET-SNMP command line utility snmpset
to modify this object on the SNMP agent? Note that not all devices allow you to modify such an object so access error can be expected.
`from pysnmp.hlapi import * def despliega(iterador): while True: try: errorIndication, errorStatus, errorIndex, varBinds = next(iterador) if not errorIndication and not errorStatus: for varBind in varBinds: print(varBind) else: print("Error:",errorStatus) except StopIteration: return ip = '192.100.200.10' puerto = 161 OID = '1.3.6.1.2.1.1.5.0' valor = OctetString('Router1')
valor = OctetString('Router1') iterador = setCmd( SnmpEngine(), UsmUserData('usuario1',authKey='password123',authProtocol=usmHMACSHAAuthPro$ UdpTransportTarget((ip,puerto)), ContextData(), ObjectType(ObjectIdentity(OID),valor)) despliega(iterador)
`