Skip to main content

snmp-agent

SNMP Server

import asyncio
import snmp_agent

async def handler(req: snmp_agent.SNMPRequest) -> snmp_agent.SNMPResponse:
    vbs = [
        snmp_agent.VariableBinding(
            '1.3.6.1.2.1.1.1.0', snmp_agent.OctetString('System')),
        snmp_agent.VariableBinding(
            '1.3.6.1.2.1.1.3.0', snmp_agent.TimeTicks(100)),
        snmp_agent.VariableBinding(
            '1.3.6.1.2.1.2.2.1.1.1', snmp_agent.Integer(1)),
        snmp_agent.VariableBinding(
            '1.3.6.1.2.1.2.2.1.2.1', snmp_agent.OctetString('fxp0')),
        snmp_agent.VariableBinding(
            '1.3.6.1.2.1.2.2.1.5.1', snmp_agent.Gauge32(0)),
        snmp_agent.VariableBinding(
            '1.3.6.1.2.1.2.2.1.10.1', snmp_agent.Counter32(1000)),
        snmp_agent.VariableBinding(
            '1.3.6.1.2.1.2.2.1.16.1', snmp_agent.Counter32(1000)),
        snmp_agent.VariableBinding(
            '1.3.6.1.2.1.31.1.1.1.6.1', snmp_agent.Counter64(1000)),
        snmp_agent.VariableBinding(
            '1.3.6.1.2.1.31.1.1.1.10.1', snmp_agent.Counter64(1000)),
        snmp_agent.VariableBinding(
            '1.3.6.1.2.1.4.20.1.1.10.0.0.1', snmp_agent.IPAddress('10.0.0.1')),
    ]
    res_vbs = snmp_agent.utils.handle_request(req=req, vbs=vbs)
    res = req.create_response(res_vbs)
    return res

async def main():
    sv = snmp_agent.Server(handler=handler, host='0.0.0.0', port=161)
    await sv.start()
    while True:
        await asyncio.sleep(3600)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Requirements

  • Python >= 3.8
  • asn1

Installation

pip install snmp-agent

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snmp-agent-0.2.3.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snmp_agent-0.2.3-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file snmp-agent-0.2.3.tar.gz.

File metadata

  • Download URL: snmp-agent-0.2.3.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.3 Windows/10

File hashes

Hashes for snmp-agent-0.2.3.tar.gz
Algorithm Hash digest
SHA256 d053ceb3475c11750fe7317328a084de68f7f4caa74f8a7273aeb1bba5b2764b
MD5 4b90111cae102be1966af8b48fdc2353
BLAKE2b-256 82d8ec4176ff969819b6fa15730e5f892c52b795b4f513391ad74c30128cc09a

See more details on using hashes here.

File details

Details for the file snmp_agent-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: snmp_agent-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.3 Windows/10

File hashes

Hashes for snmp_agent-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6337fe133540e47752dabe0c32f2461e9c887185ff368c285493f95157576f59
MD5 e7e24c3b39139872cded57e6892dd9f6
BLAKE2b-256 7778a1aa8c3b9f02f7a6173e2c575102749b955ecebdb5688153b8ce11c87c10

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page