This is my first time in the forum so HI and here is my question:

I´m trying to develop an RMU (Remote Monitoring Unit) with the Duemilanove Arduino module. I have to read the data of different sensors using the Arduino microprocessor (ATmega328 in my case) and then i have to comunicate this data to the central computer through Ethernet (using the Arduinos Ethernet Shield). The point is, the software in the central computer works with SNMP protocol so my remote module must understand that protocol. Meaning that: when the central computer sends an SNMP packet, that packet goes in the TCP/IP packet, when it gets to my remote module (trought Ethernet) the Ethernet Shield takes the data(SNMP packet) out of the TCP/IP packet, and sends it to the Arduino microprocesor, so the microprocessor MUST UNDERSTAND SNMP PROTOCOL TO MAKE THE PROCESS EASY AND DECODE THE PACKET!!!...

And I can´t find ANY SNMP LIBRARY FOR ARDUINO!!!.. SO i would REALLY apreciate some help with this..

Thanks for the helP!! :)

SNMP relies on UDP/IP and not TCP/IP.

SNMP is Simple Network Mail Protocol. Your computer is sending e-mail to your Arduino? I hope it's not expecting a reply in real time.

If youd search youd see my previous reply to this issue.
There is no snmp arduino lib yet.

Someone located a Microchip eth kit that has snmp.
But it has to:

  1. be ported to arduino. (and license checked, it may be for pics only)
  2. be easily configurable by users.
  3. interface - you want a interface to do other things, so this has to be added.
  4. data - snmp sends out discretes, tables, and traps(msgs). These all have to be configured/handled and interfaced. traps are broadcast, but discretes are requested.
  5. encryption - v3 uses various encryption, I do not know how much would be needed to handle v3 msgs. v2 is plaintext.

Is this all going to fit into 32kb?
IIRC Microchip says it takes 32kb for all of their network stuff.

I would love to work on this and be famous, but I’d rather have money ya know.? In the words of Les Grossman - Loooottttss of money, and a G5.

Another approach would be to have a trap receiver get → repackage → resend using a custom client/server, a trap relay if you will.
A simple client/server anyone could write for arduino.

SNMP == Simple Network MESSAGING Protocol.

The 'Simple' is a misnomer.

The tool uses UDP packets to send and receive data. A host will listen for broadcast messages from clients, and collate the data. Tools exist to setup a host to monitor many hundreds of clients and collate data.

A client may also offer up specific user defined datas upon request. Messages/data types are defined in a text file, in a heirarchial manner with each vender buying a unique ID in the tree (the MIB file).

The first 2 incarnations passed msgs as plaintext, SNMPv3 offers encryption along woth even more complexity.

This tool originated "Joe's Rule of Thumb #1" : Any codebase that went thru >2 Universities is to be avoided at all costs...

Net-SNMP isn't too bad compared to the older codebases.

PaulS may have mistaken SNMP for SMTP.

SNMP is simple as per it's definition compared to other RPC (Remote Procedure Call - Get/Set) messaging protocols. For example MODBUS/TCP. It's simple because there is no CRC or Checksum, etc., packet creation and parsing is pretty straight forward provided you fully understand the protocol. Since it is a standardized protocol SNMP RFC documentation is available on-line (

I am in the process of writing a lightweight SNMP Agent incorporating SNMP V1 for the ardiuno, using the latest Ethernet library, using a wrapper around the ASocket library (basically porting some of my old SNMP Agent code written in another language). I'll upload it to the arduino playground once a beta version is available. The more who wish to test it and help out the merrier.

A client may also offer up specific user defined datas upon request. Messages/data types are defined in a text file, in a heirarchial manner with each vender buying a unique ID in the tree (the MIB file).

For clarification to others; you don't have to buy a unique node id. A manufacturer simply creates one outside of the predefined nodes. An example will be provided with my SNMP Agent.

Net-SNMP isn't too bad compared to the older codebases.

NET-SNMP is huge since it incorporates all version e.g. 1 to 3 amongst allot of other great features. Not to be sarcastic but please keep in mind that the Arduino platform is an MCU with limited ROM/RAM and not a CPU. So there will certainly be a sacrifice e.g. features vs minimum requirements to minimize the library's footprint.


I know net-snmp will never fit.

Have you thought about using uIP as a base?

I'm interested in SNMP on the Arduino. Details are in my next post, since the forum software doesn't allow me to place URLs in my first post!


I'm using Arduino for an application that requires an SNMP v2c agent. Right now, I'm doing the background reading, in preparation for implementation. Rather than DIY, I'd prefer to use an existing library, or work with others to put one in place. Is there any scope for cooperation?

One plan might be for me to wait until you upload your SNMP v1 code. I can then grab it and help debug it. In time, I might also be able to contribute by assisting with extending the v1 code to do SNMP v2c?

What is your expected time scale for uploading v1 code? If necessary, I can help you get there. I'm new to Arduino, but am experienced with microcontrollers in general. (I'm an Elec. Eng.) I'd encourage you to release early, so others can help!

Who else is interested in SNMP on the Arduino? It has been mentioned several times before on this forum, but no code has appeared. Maybe this is the time and place for all of us to get together and make it happen?

Regards John

SNMP == Simple Network Management Protocol

Most SNMP implementations are designed to offer access to a very large set of information (typically in a router or network host), called a "Management Information Base" (MIB) There are standard MIBs to cover the usual items of interest to Network Management, but typically the standard data for a single interface would exceed the 32K total available in an Arduino.

It should be possible to implement a "tiny" SNMP to serve up a very limited amount of information, but it may not be able to offer enough info about itself to actually conform to the standard (and an SNMP client is likely to want a bunch of data), and it's not clear what the advantage of using SNMP would be compared to some trivial exchange of UDP or TCP packets (like "finger.")

SNMP is only "Simple" compared to its competitors from the same timeframe (CMIP and CMOT, IIRC. From ISO. The ISO protocols are all pretty much dead now; they were essentially too complex to implement, and the complexity didn't DO anything useful.)

Granted, a full blown SNMP implementation might be big, but that is not what I have in mind for my case.

The application I have in mind is managing components in low data rate radio networks in remote locations. This is an area where there is a call for a very lightweight SNMP agent with a custom MIB, even if it is lightweight to the point of non-conformance with the standard.

Most of the common SNMP parameters don't have meaning for some of the gear being monitored and managed. For example, an RF power amplifier might support queries about temperature and voltages, allow gain to be set and send a trap on an abnormal condition. The value of SNMP, over an arbitrary protocol, is that it allows the unit to be handled by the same software that is managing the components containing full blown SNMP agents.

I am willing to colloborate on a small snmp system.

Someone want to start a google.code area, or a private subversion or something?

Great to see so many people interested in an Arduino SNMP Agent and to all other responses; correct, SNMP Agents can serve up a large number of MIB objects. However, in theory and in practice, if the object doesn’t exist we would respond with a friendly SNMP error - Object Not Found. As per standard this is totally acceptable.

Presently I am writing it directly in a sketch and will then create an object orientated approach once the base concepts work. Packet parsing and construction are the tricky parts, well for me anyway, since I haven’t seriously touched C in years. I am porting C# code that I have written for other projects. It would be pretty cool to use a similar object architecture as Net-SNMP since it’s quite popular (i’ve used this package for many years with no problems) but a very stripped down version. But memory being used is what I am watching. I’m able to parse an incoming get-request packet and in the process of working on the outgoing response. Parsing the OID string back to a byte array is where I am at.

I am going to create a new thread called Agentuino - Lightweight SNMP Agent for Arduino. And yes, some help would be great.

The arduino can handle the basic RFC1213 objects (e.g. sysName, sysUpTime, etc.) along with a limited number of user defined objects.

* Agentuino SNMP Agent Library Prototyping...
* Copyright 2010 Eric C. Gionet <>

// SNMP Agent - basic credentials
char getCommName[] PROGMEM   = "public";
char setCommName[] PROGMEM   = "private";
// RFC1213-MIB OIDs
char sysDescr[] PROGMEM      = "";  // read-only  (DisplayString)
char sysObjectID[] PROGMEM   = "";  // read-only  (ObjectIdentifier)
char sysUpTime[] PROGMEM     = "";  // read-only  (TimeTicks)
char sysContact[] PROGMEM    = "";  // read-write (DisplayString)
char sysName[] PROGMEM       = "";  // read-write (DisplayString)
char sysLocation[] PROGMEM   = "";  // read-write (DisplayString)
char sysServices[] PROGMEM   = "";  // read-only  (Integer)
/* RFC1213 local values */
char locDescr[] PROGMEM      = "Agentuino, a light-weight SNMP Agent.";  // read-only (static)
char locObjectID[] PROGMEM   = "";                       // read-only (static)
long locUpTime               = 0;                                        // RTC is needed for this unless the NTP Time library is used
char locContact[20]          = "Eric Gionet";
char locName[20]             = "Agentuino";
char locLocation[20]         = "Nova Scotia, CA";
short locServices PROGMEM    = 7;                                        // read-only (static)

Flash library doesn’t have a strcmp function that works (by all means correct me if I am wrong).

void loop()
  packetSize = socket.available();
  if ( packetSize > 0 && packetSize <= SNMP_MAX_PACKET_LEN ) {
    Serial << "UDP Packet Received Start.." << packetSize << " RAM:" << freeMemory() << endl;
    packet = (byte *)malloc(sizeof(byte)*packetSize);
    //, packetSize);
    //for (int i = 0; i <= packetSize; i++) {
      //Serial << _HEX(packet[i]) << ":" << _DEC(packet[i]) << " " << packet[i] << "(" << i << ")" << endl;
      //Serial << _HEX(packet[i]) << ":" << _DEC(packet[i]) << "(" << i << ")" << endl;
    char comm[SNMP_MAX_NAME_LEN]; // need dynamic mem alloc
    byte pduType;
    short version;
    long requestId;
    long error;
    long errorIndex;
    char oid[SNMP_MAX_OID_LEN]; // need dynamic mem alloc
    byte valueType;
    byte valueSize;
    byte value[SNMP_MAX_VALUE_LEN]; // length - need dynamic mem alloc
    parsePacket(&version, comm, &pduType, &requestId, &error, &errorIndex, oid, &valueType, &valueSize, value);
    Serial << "Version:" << version << " Community:" << comm << " PDUType:" << _HEX(pduType) << " RequestID:" << requestId << " Error:" << error << " ErrorIndex:" << errorIndex << " OID:" << oid << endl;
    Serial << "Value-Type: " << _HEX(valueType) << " Value-Size: " << _HEX(valueSize) << endl;
   // get-request
    if ( strcmp_P(oid, sysName) == 0 ) {
      Serial << "sysName..." << locName << endl;
      // response packet - locName
    } else {
      // oid does not exist
      // response packet - object not found
    packetSize = 0;
    Serial << "UDP Packet Received End..RAM:" << freeMemory() << endl;
  } else if ( packetSize > SNMP_MAX_PACKET_LEN ) {
    Serial << "Invalid SNMP Packet" << endl;

Standard SNMP definitions and enums

#define SNMP_MIN_OID_LEN      2
#define SNMP_MAX_OID_LEN      128
#define SNMP_MAX_NAME_LEN      32
#define SNMP_MAX_VALUE_LEN      128  //??? should limit this
typedef enum ASN_BER_BASE_TYPES {
      //   ASN/BER base types
      ASN_BER_BASE_UNIVERSAL        = 0x0,
      ASN_BER_BASE_CONTEXT        = 0x80,
      ASN_BER_BASE_PUBLIC        = 0xC0,
      ASN_BER_BASE_PRIMITIVE        = 0x0,
typedef enum SNMP_PDU_TYPES {
      // PDU choices
typedef enum SNMP_TRAP_TYPES {
      //   Trap generic types:
      SNMP_TRAP_COLD_START             = 0,
      SNMP_TRAP_WARM_START             = 1,
      SNMP_TRAP_LINK_DOWN             = 2,
      SNMP_TRAP_LINK_UP             = 3,
typedef enum SNMP_ERR_STS_CODES {
      SNMP_ERR_STS_NO_ERROR         = 0,
      SNMP_ERR_STS_TOO_BIG         = 1,
      SNMP_ERR_STS_BAD_VALUE         = 3,
      SNMP_ERR_STS_READ_ONLY         = 4,
      SNMP_ERR_STS_GEN_ERROR         = 5
typedef enum SNMP_SYNTAXES {
      //   SNMP ObjectSyntax values
      //   These values are used in the "syntax" member of VALUEs
      SNMP_SYNTAX_INT32              = SNMP_SYNTAX_INT,
typedef struct SNMP_PDU {
      ASN_BER_BASE_TYPES type;
      long requestID;
      long errorStatus;
      long errorIndex;
      char oid[SNMP_MAX_OID_LEN];
      byte value[SNMP_MAX_VALUE_LEN];
        SNMP_SYNTAXES valueSyntax;
      // need pointers and callbacks to free varBindList and value memory