Home / Sensors / SNMP on an NXT

SNMP on an NXT

What is SNMP?

snmp_msgs [Converted]When I got my NXT2WIFI sensor from Daniele I was quite sure what I wanted to make with it:  an SNMP agent.  What is an SNMP agent, you say?  SNMP, short for Simple Network Management Protocol, is a protocol that, as you may have guessed by now, a protocol that can be used for monitoring and configuring networked devices.  It is often used in enterprises to keep track of load metrics on routers, switches, etc.  It can also be used as a means to send alerts by devices to a central point when something’s wrong or if a special event has happened.  There are many versions of SNMP, v1 being the simplest of them all.  There are two parties with SNMP, the agent, which is the networked device we’re interested in monitoring, and the manager, which is the device that listens for incoming alerts and polls the agents.  You can read a LOT more about SNMP here: [LINK].

What have I made?

What I have done is implement a very simple SNMP agent in ROBOTC that returns the string “Mindstorms” when the iso.3.6.1.2.1.1.5.0 Object ID (OID) is queried.  To be fair, my current code doesn’t check the OID yet, it’s hardcoded.  However, the way the SNMP reply is created, is not, this will come in handy when I extend this agent. It should be fairly trivial to add additional queries that the agent responds to.

What does it look like?

Using the snmpget utility under Linux, I can execute the following:

image

“public” is the name of the SNMP community, 192.168.1.178 is the IP address of the NXT and iso.3.6.1.2.1.1.5.0 is the OID we’re interested in. The second line is the response from the NXT over Wi-Fi: “Mindstorms”.  I’ve made some screenshots of Wireshark running and capturing the data:

SNMP requestSNMP reply

This was all part of writing an example to use with the driver I am currently writing for the NXT2WIFI.  The source code will be part of the driver suite when I add support for this sensor.

Stay tuned as I expand this example with more interesting metrics to read from the NXT!

About Xander

Xander Soldaat is a Software Engineer and former Infrastructure Architect. He loves building and programming robots. He recently had the opportunity to turn his robotics hobby into his profession and has started working for Robomatter, the makers of ROBOTC and Robot Virtual Words.