Agentuino - A lightweight SNMP Agent

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

Sweet!!!! thnk u :slight_smile: (dnt know how I missed that)
Have good day!!

Cheers

I take it that means it's working? :wink: Or have you not tried yet?

Update.. There is grab in data cause I disconnected the sensor.
I was looking at your watchdog circuit very useful.. :)I am facing the same prob..SNMP gets stuck with unknow packet. That's my next step...

oh yes itz working ..Yaaayeee and big HI5 to u :slight_smile:

Great. It's working .. :wink:

I just realised that we were discussing this in the Agentuino thread. I hope LAVco doesn't mind... :wink:

Yahh oppss!! but I am sure people will find it useful at some stage.

Hi everyone, I'm an SNMP newbie.
However, I've added basic trap support.
If you're interested, I've attached the patches to this post.
Here is how you'd use it:
Sending the trap:

void send()
{
    SNMP_PDU pdu;
    char agent[] = {192, 168, 0, 177};
    const uint8_t manager[] = {192, 168, 0, 3};
    pdu.OID.size = 2;
    pdu.OID.data[0] = 7;
    pdu.OID.data[1] = 7;
    pdu.address = agent;
    pdu.trap_type = SNMP_TRAP_ENTERPRISE_SPECIFIC;
    pdu.specific_trap = 1;
    pdu.time_ticks = 0;
    /* the size of the data you will add at the end of the packet */
    pdu.trap_data_size = 10;
    /* the function that adds this data */
    pdu.trap_data_adder = add_trap_data;
    Agentuino.sendTrap(&pdu, manager);
}

The trap_data_adder function:

void add_trap_data(byte* p)
{
    byte i;
    SNMP_OID var_name;
    var_name.data[0] = 42;
    var_name.data[1] = 2;
    var_name.data[2] = 3;
    var_name.data[3] = 4;
    var_name.size = 4;
    *(p++) = SNMP_SYNTAX_OID;
    *(p++) = var_name.size;
    for(i = 0; i < var_name.size; i++) *(p++) = var_name.data[i];
    *(p++) = SNMP_SYNTAX_INT;
    *(p++) = 2;
    *(p++) = 0x42;
    *(p++) = 0;
}

Agentuino.h.diff (710 Bytes)

Agentuino.cpp.diff (4.14 KB)