Skip to content

No SNMP GET response received before timeout in linux #469

@spot62

Description

@spot62

This method works fine on windows, but doesn't work on linux (Ubuntu 24.04)

    async def get(self, list_of_oids, snmp_engine=SnmpEngine(), snmp_context=ContextData()):

        iterator = get_cmd(
            snmp_engine,
            CommunityData(self.community, mpModel=1),
            await UdpTransportTarget.create((self.host, self.port), timeout=self.timeout, retries=self.retries, tagList=self.tag_list),
            snmp_context,
            *self.construct_object_types(list_of_oids),
            lookupMib=False,
            lexicographicMode=False
        )

        error_indication, error_status, error_index, var_binds = await iterator

        if error_indication:
            raise RuntimeError('Got SNMP error: {0}'.format(error_indication))

        elif error_status:
            raise RuntimeError(
                "{} at {}".format(
                    error_status.prettyPrint(),
                    error_index and var_binds[int(error_index) - 1][0] or "?",
                )
            )
        else:
            logger.debug(f'[{self.host}] Got {len(var_binds)} varBinds:')
            for var_bind in var_binds:
                oid, v = var_bind
                logger.debug(f'[{self.host}] {str(oid)} = {type(v)}"{v}"')

        # snmp_engine.close_dispatcher()

        return var_binds

Returns : Got SNMP error: No SNMP response received before timeout

Why?

The snmpget with this OID also works correctly.

My environment Python 3.12.3

Package Version


dotenv 0.9.9
pip 24.0
pyasn1 0.6.1
pysnmp 7.1.17
python-dotenv 1.1.0

same as windows.

What might be the problem?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions