Pages: 1 [2] 3 4   Go Down
Author Topic: Agentuino - A lightweight SNMP Agent  (Read 16784 times)
0 Members and 1 Guest are viewing this topic.
Berkshire, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 120
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
1. The device does not respond if I connect the power (wall wart or usb).  Only after pressing reset does everything start working.

Yes, I noticed that too. It seems the Ethernet shield doesn't bring the link up on first power on, only after a reset. No idea if there is a way to fix that. I would be rather interested in a solution to this.

Quote
2. After a few hours the device hangs up and the SNMP stops responding.  I can still ping the device but no SNMP until I do a reset.

This sounds like the issue I was describing in my previous post. There seems to be a non-SNMP packet stuck in the buffer that gets processed over and over again. Still looking for a solution but I have a workaround using a watchdog timer (see below).

Quote
By comparing the first Weather Station code that I found initially in a previous post and the code in the post above I saw that you added a watchdog timer to the setup routine.  I don't know what a watchdog timer is but I added it and will be testing for stability.  Any tips would be greatly appreciated.

That relates to a hardware watchdog timer I built. It's based on a NE555 timer (but of course! smiley-grin ). It triggers a reset pulse if it did not get a timer pulse for 3 seconds. Let me know if you want the circuit diagram. In the loop() function I pulse the watchdog timer input once every loop if bool reset is false. Then, when a non-SNMP packet is received, I set bool reset to true. This causes the loop not to pulse the watchdog and 3 seconds later the Arduino resets. Bit of a dirty workaround but it works for now.

Quote
Also, I noticed that this line is commented out //    Agentuino.responsePdu(&pdu);

I take it that is the line in the SNMP function that handles non-SNMP packets? I did put that in at some point hoping that replying to the non-SNMP packet would get it out of the buffer. It didn't work, so I commented it out (but leaving it there, just in case).

Quote
Have had any luck troubleshooting your issues?

Nothing more that what is mentioned above. Too many other projects going on at the moment. The weather station works as it is now, so finding better fixes has low priority. ;-)

Quote
The Agentuino library seems to be such a useful tool if it could be polished just a little more.  I wonder if anyone would work on it for a bounty?

Agreed. Though I'm not sure whether the issues are in the Agentuino library or the underlying Ethernet and UDP libraries.. I wonder if LAVco is still working on it?

Logged

Chris

Location: Berkshire, UK
My Astro and DIY projects website: http://yesyes.info/

San Jose, Costa Rica
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It would be great if you could send me your 555 watchdog circuit.  BTW, thank you so much for sharing your code.  Your example really helped.
Logged

Berkshire, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 120
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, will post the circuit when I get home (still at work now).

I'm glad my code helped you... ;-)
Logged

Chris

Location: Berkshire, UK
My Astro and DIY projects website: http://yesyes.info/

Berkshire, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 120
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, here you go. Watchdog circuit attached.

Any questions - just ask. ;-)

* watchdog (Schematic).pdf (8.97 KB - downloaded 49 times.)
Logged

Chris

Location: Berkshire, UK
My Astro and DIY projects website: http://yesyes.info/

San Jose, Costa Rica
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the circuit diagram!  Currently the system has been up for more than 5 hours with just the code changes.  I'll monitor it over the weekend and see how it behaves.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 code.google.com/p/agentuino/.  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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

oh yayee..It is working..nxt step setup cacti smiley-grin
Logged

Berkshire, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 120
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Spandy19,

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

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
Logged

Chris

Location: Berkshire, UK
My Astro and DIY projects website: http://yesyes.info/

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey Chris

Thanks for the reply..yes plz that would be great smiley
I have run into another problem.. I have been trying to graph the sensor results on cacti.
Code:
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 smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

* graph27.ino (16.92 KB - downloaded 31 times.)
Logged

Berkshire, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 120
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Chris

Location: Berkshire, UK
My Astro and DIY projects website: http://yesyes.info/

Berkshire, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 120
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.. smiley-wink

Logged

Chris

Location: Berkshire, UK
My Astro and DIY projects website: http://yesyes.info/

Berkshire, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 120
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.46 KB - downloaded 32 times.)
Logged

Chris

Location: Berkshire, UK
My Astro and DIY projects website: http://yesyes.info/

Pages: 1 [2] 3 4   Go Up
Jump to: