All home networking related discussions.
ChrisFredriksson
New Member
Posts:
1
Joined:
Mon Mar 06, 2017 7:48 am

SNMP, snmptrapd not snapping on OIDs

Mon Mar 06, 2017 8:35 am

Hey everyone,

First post here. Haven't really had the need to visit a real networking forum before, I've done some networking in the past but nothing like this project.

What I'm doing right now is developing an SNMP v1 client inside an Arduino. Of course, SNMP v2c would probably/possibly be better, but I'm working on a proof of concept right now, so a v2c will be for later. There are lots of libraries with quite some excellent code for v1, so it wasn't too hard to get it to work. Lots of work has been done though to improve on the code and to allow walk and similar features.

However, the server (snmptrapd) seems to be wanting something else than what my module is sending.


On my linux server I've setup snmptrapd to the best of my knowledge after reading the manual and lots of resources on the net. The package I get from my Arduino module is the following in snmptrapd;

Code: Select all
Mar  6 13:38:40 arduino snmptrapd[9539]: 2017-03-06 13:38:40 x.x.x.193(via UDP: [x.x.x.193]:161->[x.x.x.184]:162) TRAP, SNMP v1, community public#012#011iso.3.6.1.4.1.3000.1.1.1 Enterprise Specific Trap (1) Uptime: 0:10:24.00#012#011iso.3.6.1.4.1.3000.1.1.1 = STRING: "message"


The 3000 part, which I think is the Enterprise ID? is just made up of course as I haven't gone through the process to get my own EID. I believe that shouldn't do anything wrong unless I connect up some hardware that already has EID 3000 configured. Snmptrapd should only pass it through right?


In my snmptrapd.conf file I've configured a traphandle to snap on the following;
Code: Select all
traphandle .1.3.6.1.4.1.3000.1.1.1      php /var/www/arduino/snmp.php


The PHP file isn't triggered at all, unless I configure a traphandle such as;
Code: Select all
traphandle .1.3.6.1.4.1.3000*      php /var/www/arduino/snmp.php


Then it triggers without any problems. However, I can't seem to read out the OID or message or anything inside the PHP script. So it's not really useful. If I can get that to work somehow, that would be perfect of course! But I don't know if its possible at all?

Therefore I would need to have it configured like the following and add an argument after the php file like so;
Code: Select all
traphandle .1.3.6.1.4.1.3000.1.1.1      php /var/www/arduino/snmp.php INPUT1


Because then I would know inside the php file that it is the INPUT1 that has triggered the trap. Of course, if I specify any other program for the traphandle it doesn't work either. It just doesn't match the OID at all when I'm not using the asterisk.


So.. what I'm wondering is.. Is the package I'm sending out from my arduino module correct? When probing with for example cacti the module answers properly. According to WireShark the packages are properly setup and valid.

At the moment I can't understand what might be wrong, so I hope you guys can help me out!


Oh also, is it possible to use the "format" variables such as %B %W and similar in snmptrapd even for traphandle? If so, how? Because when I specify them after my traphandle like the following, it just sends those characters straight through and no conversion is done.
Code: Select all
traphandle .1.3.6.1.4.1.3000*      php /var/www/arduino/snmp.php %B %W



Hope you guys can help me out! Many thanks in advance!

Return to Home Networking

Who is online

Users browsing this forum: No registered users and 37 guests

      cron