What is SNMP?
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.220.127.116.11.18.104.22.168 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:
“public” is the name of the SNMP community, 192.168.1.178 is the IP address of the NXT and iso.22.214.171.124.126.96.36.199 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:
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!