Agentuino - A lightweight SNMP Agent

HI all, I have just started playing with Arduino's and decided to build a rain water tank level as a beginners project which I was able to do. To make the tank level useful I wanted to be able to graph the level over time. After toying with many different options I stumbled across the lightweight SNMP Agent and used it interface it to a zenoss SNMP virtual server to graph the water level. I would like to use the lightweight SNMP Agent as an API as such to to read and set data on to my arduino devices (i.e set default values, change the sysLocation details and sysName details) . At present I am can create custom OIDs and read them from various sensors, however when I try to set a value using ' snmpset -v 1 -r 1 -c public MYIP sysName.0 s NewNamesnmpset -v 1 -r 1 -c public MYIP sysName.0 s NewName ' I get a "Timeout: No Response from 192.168.2.X" .

When I use snmpget -v 1 -r 1 -c public 192.168.2.X sysName.0 i get a response of ' SNMPv2-MIB::sysName.0 = STRING: Agentuino '.

The sketch I used was the example one provided from Google Code Archive - Long-term storage for Google Code Project Hosting.. I used Wireshark to inspect the snmpset packet and it appeared to be formed correctly and the data I wanted to set was there. I noticed that the Has anyone else had any trouble setting values using the lightweight SNMP Agent.

any help would be appreciated.

thanks

Darren

where MYIP is the IP address of my arduino project

aimmediately realized its potential for other applications around my house for various other projects

Hi all, I finally figured out what the issue was. In order to write values using snmpset I needed to use the community string of private and not public.

cheers

Hey guys

I just wanted to ask if there are any changes that need to be made, if using the agentuino library on Arduino-1.0 .
I have checked the code and all my settings.. I am not sure why agentuino is not working for me. When I run the agent.pde (after making ip, mac etc changes), this is what I see on the serial monitor.


SNMP Agent Initalized...
UDP n?ent ý


I used cmd line to check the connection to port 161 (using telnet) and it failed to connect.
Please help........I am not able to figure out the problem!!

oh yayee..It is working..nxt step setup cacti :smiley:

Hi Spandy19,

sorry, I've not had time to reply to your PM yet. But good to see that you've made progress. :wink:

My weather station was my first ever Arduino project, so unfortunately I have not documented it well. I guess I was just glad it was working at all. I'm planning to make a schematic diagram the next time I have to take it apart. I have a half-finished diagram with the pin numbers I remembered or was able to derive from the sketch. What I can offer for now is the latest version of my sketch, if you want.

Chris

Hey Chris

Thanks for the reply..yes plz that would be great :slight_smile:
I have run into another problem.. I have been trying to graph the sensor results on cacti.

 Running data query [20].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/usr/share/cacti/site/resource/snmp_queries/interface.xml'
+ XML file parsed ok.
+ [i][b][b][b][b]Executing SNMP walk for list of indexes @ '.1.3.6.1.2.1.2.2.1.1'
+ No SNMP data returned[/b][/b][/b][/b][/i]
+ Found data query XML file at '/usr/share/cacti/site/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/usr/share/cacti/site/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/usr/share/cacti/site/resource/snmp_queries/interface.xml'

I have been using MIB Browser to check if snmp is enabled and running, the "get" command gives me the values from the sensor, but when I try to use the "walk" command it times out..
Please advice on the cacti settings (data queries, graph settings). I have posted my code below (which is actually very similar to your code with some changes)

Cheers :slight_smile:

P.S. My code (was too big to post it, I have attached it) :slight_smile:

graph27.ino (16.9 KB)

I think Agentuino does not support SNMP Walk. There simply isn't enough memory for that in an Arduino. So you would need to know the OIDs and configure them manually in Cacti.

I'll see if I can take a few screenshots of how I configured graphs in Cacti. I'll also post my latest sketch as soon as I get home.

OK, here is how I configured this in Cacti. It's been a while, so I hope I haven't forgotten anything.

First create a host/device for the weather station:

Most important here is the SNMP time-out and max OIDs per request. The defaults did NOT work for me. I had to increase the timeout to 1500 (1.5sec) because the Arduino takes quite a while to reply (roughly one second in my case). It also only supports one OID per request, so enter 1 in that field.

Then you need to configure one data source per value. Here is an example:

Select the host you just created and then enter the OID for that specific value.

Then you need a graph template. You can use an existing one to start with and modify it (or leave as is for the beginning)

I have also created a CDEF entry that divides all received data by 100. That is because I'm sending the temperature values from the weather station in 100th of a degree. So a returned value of 1 means 0.01 degree. That is because SNMP only knows integer numbers.
Here is the CDEF I added:

The CDEF is then applied to every item in the graph template:

Clicking on each of the items will show this screen:

Then it's time to create the actual graph:

Here everything comes together. Select the graph template that you created/want to use, select the host and then the data source.

OK, that's it. You should now get some graphs. Cacti only sends SNMP requests every 5 minutes. So give it some time to collect some data. Graphs will not appear until at least one value has been recorded.

I hope that helps a little. Just ask if you have any questions....

I will post the sketch when I get home. I have no access to that file here at work.. :wink:

Silly me... I do have access to my network hard drive that has the backup of my sketches...
So here it is, the currently latest version of my weather station sketch.

Weather_Station.pde (20.5 KB)

Hey Chris

Thanks heaps for the detailed explanation :slight_smile:
I am configuring my device now..I think I should be able to get my results graphed.I will post it, when I get it working..

Cheers

Hey Chris

I followed your instructions, still I am getting the below error..
any tips on how to solve the error..:frowning: plz advice..

RRDTool Command:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title='MCR Sensor - Temperature' \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label='' \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/var/lib/cacti/rra/28/1020.rrd":snmp_oid:AVERAGE \
GPRINT:a:LAST:"Current\:%8.2lf %s"  \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:a:MIN:"Minimum%8.2lf %s" 
RRDTool Says:
ERROR: opening '/var/lib/cacti/rra/28/1020.rrd': No such file or directory

and also "Graph Item" (average) under "Graph Template" its "GPRINT type " is it load average or and be normal ??
Did you create your own Gprint type ??
hope I dint confuse you with all the "G"z ..thank you for ur help :slight_smile:

itz working ..it is working :smiley:
thankz heaps chris

Well It wont draw the points on graph.. It is receiving the info as seen below in the image..
Can't figure out why :s plz help!!

Well, that's progress...
Not sure why the graphs don't show...

Can you please post a few screenshots of your cacti config? Specifically a screenshot of the page shown on the 5th picture in my post (the one with all the screenshots). Then, on that same page click on the first item in the list on the top (should be the graph item) and post another screenshot of that page.

I not really sure how to post screen shots..I am posting images..
Graph template screen shots (image graph1 and graph2)
Item #1 current reading (image graph3)
Humidity graph setting (image graph 5, graph6)
Temperature graph setting (image graph7,graph8)

graph3.JPG

and the rest of the images

I really appreciate your help Chris :slight_smile:

latest update..Y axis limits are realistic now! (0 to 100)

I think the problem is shown on the first screenshot. You only have GPRINT items in your graph template. These are text prints. You need to add an AREA item (filled graph). See the 2nd and 3rd (from bottom) of my screenshots...