Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to get value of an object of type "Object Identifier" with null value the results is "No SNMP response received before timeout". #159

Open
leo-aguilar opened this issue Dec 19, 2024 · 1 comment
Labels
bug Something isn't working priority:low Low priority items. triage New issues that need to be sorted out.

Comments

@leo-aguilar
Copy link

leo-aguilar commented Dec 19, 2024

Expected behavior

I expected the same result that other applications as MibBrowser and snmpget returns.

Example using snmpget:
$ snmpget -v1 -On -c public 192.168.0.181 1.3.6.1.2.1.2.2.1.22.1
.1.3.6.1.2.1.2.2.1.22.1 = OID: .0

Actual behavior

Trying to get value of an object of type Object Identifier with null value results in No SNMP response received before timeout.

Detailed steps

Trying to get value of an object of type Object Identifier with null value as example:
OID: 1.3.6.1.2.1.2.2.1.22.1 --- that is ifSpecific.1 defined in RFC1213-MIB

The steps:

  1. Execute the included script base on v1-get.py example from Quick Start - PySNMP 7.1 Documentation (https://www.pysnmp.com/pysnmp/). The script tries to get value of object 1.3.6.1.2.1.2.2.1.22.1 that is ifSpecific.1 defined in RFC1213-MIB, the agent returns value in compact format (06h 00h), this means the type (06h) and null value (00h) -- no length included.
  2. Script returns: No SNMP response received before timeout

Python package information

pyasn1 0.6.1
pysmi 1.5.9
pysnmp 7.1.15

Operating system information

Linux Ubuntu 22.04

Python information

Python 3.10.12

(Optional) Contents of your test script

# based v1-get.py

"""
SNMPv1
++++++

Send SNMP GET request using the following options:

  * with SNMPv1, community 'public'
  * over IPv4/UDP
  * to an Agent at demo.snmplabs.com:161
  * for an instance of SNMPv2-MIB::sysDescr.0 MIB object
  * Based on asyncio I/O framework

Functionally similar to:

| $ snmpget -v1 -c public demo.pysnmp.com SNMPv2-MIB::sysDescr.0

"""  #
import asyncio
from pysnmp.hlapi.v3arch.asyncio import *

async def run():
    snmpEngine = SnmpEngine()

    iterator = get_cmd(
        snmpEngine,
        CommunityData("public", mpModel=0),
        await UdpTransportTarget.create(("192.168.0.181", 161)),
        ContextData(),
        ObjectType(ObjectIdentity("1.3.6.1.2.1.2.2.1.22.1")), # RFC1213-MIB, ifSpecific.1
    )

    errorIndication, errorStatus, errorIndex, varBinds = await iterator

    if errorIndication:
        print(errorIndication)

    elif errorStatus:
        print(
            "{} at {}".format(
                errorStatus.prettyPrint(),
                errorIndex and varBinds[int(errorIndex) - 1][0] or "?",
            )
        )
    else:
        for varBind in varBinds:
            print(" = ".join([x.prettyPrint() for x in varBind]))
    snmpEngine.close_dispatcher()

asyncio.run(run())

Relevant log output

-- see attached files:
fail-debug-capture.txt
null-OID-MibBrowser
null-OID-snmpget_cli
null-OID-WireShark-Capture

No response

@leo-aguilar leo-aguilar added bug Something isn't working triage New issues that need to be sorted out. labels Dec 19, 2024
@lextudio-support lextudio-support added the priority:low Low priority items. label Dec 19, 2024
@lextudio-support
Copy link

New issues are marked as low priority by default. Becoming our commercial customers, and then your reports are handled with higher priority after triage.

@leo-aguilar leo-aguilar changed the title Trying to get value of an object of type "Object Identifier" with null value results in "No SNMP response received before timeout". Trying to get value of an object of type "Object Identifier" with null value the results is "No SNMP response received before timeout". Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:low Low priority items. triage New issues that need to be sorted out.
Projects
None yet
Development

No branches or pull requests

2 participants