My New Project: AgentX Implementation in Python

Update: I changed the module name to ”pyagentx”, thank you Daniel for the suggestion.

During this Eid vacation I spent many hours working on AgentX implementation in Python.

You can find the project in GitHub:

https://github.com/rayed/pyagentx

What is AgentX?

AgentX is protocol to extend SNMP agents, defined in RFC 2741.

But what is SNMP? let’s say you have a Linux machine you want to monitor, you will use Simple Network Management Protocol or SNMP for short, you install an SNMP agent on the machine like Net-SNMP, and from your management station you connect to the SNMP agent and ask it for the data you want report on, for example the current state of network link.

What happen if you install new software, like PostgreSQL DB, and your SNMP agent doesn’t support it, how can you monitor it! The good news SNMP agents (e.g. Net-SNMP) can be extend with multiple options, the bad news most options are very hard.

One of the most flexible options is AgentX protocol, you will need to build an application that run AgentX protocol (AgentX SubAgent), upon startup it will contact the SNMP agent (AgentX master) and register a part of the MIB tree that your app will handle, the SNMP agent (AgentX master) will forward all queries to your app which will return the result back to the master which will forward it to the management station (Cacti, NMS).

Net-SNMP already have an API to build AgentX Sub Agent, and there are Python module that utilise it, but unfortunately it doesn’t look active, and as far as I know Net-SNMP API it self isn’t the easiest thing to work with.

This is why I started working with Pure Python implementation for AgentX protocol, it is already in a working condition and tested with Net-SNMP agent, I’ve some more issues to resolve before I can use it in production.

So please if you are interested in the field give my module a try, and let me know how can improve it, and also suggest better name.

8 thoughts on “My New Project: AgentX Implementation in Python”

  1. Hello rayed,

    im playing around with the sf python-agentx library.
    But yes, there are some problems.

    Im on a project wich takes some data via python from bsb bus (4800 baud)
    and make this accessible.
    The collection of the values takes some time,
    so in a pure python implementation i can easy start a thread
    to get the data async and copy the new values in the update callbacks 😉
    So i use your module.

    Thank’s for your module, it fits perfekt in the gap to snmp.

    Name: what about pyagentx ?

  2. Glad you like the module, I am still improving the module so if you have any suggestions please share it with me.
    Thanks for the name suggestion, hard to pronounce but searchable 🙂

  3. Thanx for lib ! already created a table with cicle.
    how about resourses usage, is there any cleaner (gc or smthg) ?
    if i run this thing once in a N seconds

  4. With resourses everything is OK (if you are not using references to other data in dicts or tupples)

    Another question, how to clean data that was set previously, for example all under the branch 1.1.1.1 ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.