[2012/04/24 02:39:26] #net-snmp <jigspan> hello guys i am new to snmp can anyone help?
[2012/04/24 10:47:18] #net-snmp <hydrian> ello all
[2012/04/24 10:51:57] #net-snmp <hydrian> Does anybody know if net-snmp can monitor OIDs that are proxied?
[2012/04/24 10:52:37] #net-snmp <hydrian> This is for net-snmp 5.3.2.2 (centos 5)
[2012/04/24 11:30:49] #net-snmp <rstory-work> hydrian: yes, net-snmp can act as a proxy..
[2012/04/24 11:36:02] #net-snmp <hydrian> rstory: That's not what I asked. I know net-snmp can act as a proxy. I already have that setup. I'm asking do the monitor directive in the snmpd.conf work on proxied OID?
[2012/04/24 11:37:18] #net-snmp <hydrian> Sorry If I seem a bit short. I've been dealing with this issue for most of a day. Trying to find any answers has been difficult.
[2012/04/24 11:53:21] #net-snmp <rstory-work> ah.. ok.. that's a good question... your best bet at an answer would be to try it and see..
[2012/04/24 15:19:17] #net-snmp <stephane_charett> I've written a MIB with scalars, and a table. Use AgentX and lots of C/C++ code to get it all working. So I'm a noobie, but I'm forging ahead. :)
[2012/04/24 15:20:40] #net-snmp <stephane_charett> now I've added some NOTIFICATION-TYPE to the MIB, and used code generated by: mib2c -c mib2c.notify.conf MyMib
[2012/04/24 15:21:26] #net-snmp <stephane_charett> but when I call that code to try and generate (trigger? what is the terminology here?) the trap notifications...nothing happens.
[2012/04/24 15:22:02] #net-snmp <stephane_charett> I'm looking for some help to try and determine where I've misconfigured something
[2012/04/24 15:27:53] #net-snmp <stephane_charett> my /etc/snmp/snmptrapd.conf has these lines:
[2012/04/24 15:27:53] #net-snmp <stephane_charett> snmpTrapdAddr udp:127.0.0.1:162,udp:192.168.1.55:162
[2012/04/24 15:27:53] #net-snmp <stephane_charett> authCommunity log,execute,net public
[2012/04/24 15:27:53] #net-snmp <stephane_charett> ignoreAuthFailure no
[2012/04/24 15:27:53] #net-snmp <stephane_charett> traphandle default /usr/sbin/sl-snmptrap
[2012/04/24 15:27:54] #net-snmp <stephane_charett> forward default udp:192.168.1.33:161
[2012/04/24 15:27:54] #net-snmp <stephane_charett> ...and from what I can tell that part looks good. I do see snmptrapd listening on udp port 162.
[2012/04/24 15:27:54] #net-snmp <stephane_charett> I'm thinking my client application, which previously wasn't SNMP-aware, is where I've made a mistake. Should 3rd-party apps be able to call the generated functions and have the snmp trap trigger, or is there more configuration required?
[2012/04/24 16:13:27] #net-snmp <fenestro> Do you have any trap sinks listed in snmpd.conf of your master agent?
[2012/04/24 16:13:50] #net-snmp <fenestro> Alternately, if you have the NOTIFICATION-LOG-MIB compiled into your master agent, you could see if your trap made it into the log
[2012/04/24 16:14:25] #net-snmp <stephane_charett> /etc/snmp/snmpd.conf contains lots of stuff, such as views, access, group, and then the following lines:
[2012/04/24 16:14:25] #net-snmp <stephane_charett> authtrapenable 1
[2012/04/24 16:14:25] #net-snmp <stephane_charett> trapcommunity public
[2012/04/24 16:14:25] #net-snmp <stephane_charett> trap2sink udp:127.0.0.1:162 public
[2012/04/24 16:15:33] #net-snmp <fenestro> that looks OK to me.
[2012/04/24 16:16:31] #net-snmp <fenestro> An AgentX subagent should be able to call, e.g., send_v2trap() and have the trap sent via AgentX to the master agent which will then send it to its configured trap sinks.
[2012/04/24 16:16:46] #net-snmp <stephane_charett> note my agentx is not what is sending the trap
[2012/04/24 16:17:05] #net-snmp <stephane_charett> the trap is sent by some other application which until today wasn't snmp-aware
[2012/04/24 16:17:30] #net-snmp <stephane_charett> in addition to the generate code, I found I also had to add a call to: init_traps();
[2012/04/24 16:17:50] #net-snmp <stephane_charett> but I worry there are other calls I should have made...maybe stuff like init_snmp( "foo" ); ?
[2012/04/24 16:20:53] #net-snmp <fenestro> oh
[2012/04/24 16:22:11] #net-snmp <fenestro> yes, you need to at least init_snmp(), and probably init_agent()
[2012/04/24 16:22:24] #net-snmp <fenestro> and you would need to put your trap sinks into foo.conf if you're calling int_*("foo")
[2012/04/24 16:22:38] #net-snmp <stephane_charett> so our custom application now does this when a problem happens:
[2012/04/24 16:22:39] #net-snmp <stephane_charett> init_traps();
[2012/04/24 16:22:39] #net-snmp <stephane_charett> oid oid_snmptrap[] = { 1,3,6,1,6,3,1,1,4,1,0 };
[2012/04/24 16:22:39] #net-snmp <stephane_charett> oid oid_trapFoo[] = { 1,3,6,1,4,1,38322,1,0,1 }; // yes...I know...this gives away who I work for :)
[2012/04/24 16:22:39] #net-snmp <stephane_charett> netsnmp_variable_list *var_list = NULL;
[2012/04/24 16:22:39] #net-snmp <stephane_charett> snmp_varlist_add_variable( &var_list, oid_snmptrap, OID_LENGTH(oid_snmptrap), ASN_OBJECT_ID, (const unsigned char *)oid_trapFoo, sizeof(oid_trapFoo) );
[2012/04/24 16:22:39] #net-snmp <stephane_charett> send_v2trap( var_list );
[2012/04/24 16:22:40] #net-snmp <stephane_charett> snmp_free_varbind( var_list );
[2012/04/24 16:23:12] #net-snmp <stephane_charett> so foo.conf would have the same trap2sink that I have in snmpd.conf?
[2012/04/24 16:24:37] #net-snmp <fenestro> right. Or you could init_snmp( "snmpd" ), but that may have side effects :-)
[2012/04/24 16:24:54] #net-snmp <stephane_charett> I tried that, but then it complains about every line being invalid
[2012/04/24 16:25:17] #net-snmp <stephane_charett> as if it parses that file differently, expecting just a subset of the config lines
[2012/04/24 16:25:55] #net-snmp <stephane_charett> let me try now with just the trap2sink line in foo.conf, and calling init_snmp("foo");
[2012/04/24 16:30:25] #net-snmp <stephane_charett> No, this is what I get with a single trap2sink line in foo.conf: /etc/snmp/foo.conf: line 10: Warning: Unknown token: trap2sink.
[2012/04/24 16:30:50] #net-snmp <fenestro> did you call init_agent("foo") first?
[2012/04/24 16:31:10] #net-snmp <stephane_charett> no, I called this: init_snmp( "strangeloop" );
[2012/04/24 16:31:26] #net-snmp <stephane_charett> let me try with init_agent() instead
[2012/04/24 16:32:28] #net-snmp <fenestro> I am not sure, but it's possible that you need both. This isn't a space that I've explored myself.
[2012/04/24 16:32:42] #net-snmp <fenestro> I guess init_agent() might actually cause you to try to start serving snmp requests
[2012/04/24 16:34:57] #net-snmp <stephane_charett> calling init_agent("foo") got rid of the "unknown token" error, but as far as I can tell no trap was triggered. The "traphandle" script in snmpd.conf didn't get called.
[2012/04/24 16:50:17] #net-snmp <stephane_charett> if I call "snmptrap" from a bash prompt to generate the trap, then my traphandle script runs.
[2012/04/24 16:51:48] #net-snmp <stephane_charett> However, in case this makes sense to anyone or is related to the problem, there are some errors generated by snmptrap when I run it without "sudo":
[2012/04/24 16:51:48] #net-snmp <stephane_charett> $ snmptrap -v 2c -c public 127.0.0.1 "" 1.3.6.1.4.1.38322.1.0.1
[2012/04/24 16:51:48] #net-snmp <stephane_charett> Cannot rename /var/lib/snmp/snmpapp.conf to /var/lib/snmp/snmpapp.0.conf
[2012/04/24 16:51:48] #net-snmp <stephane_charett> Cannot unlink /var/lib/snmp/snmpapp.conf
[2012/04/24 16:51:49] #net-snmp <stephane_charett> read_config_store open failure on /var/lib/snmp/snmpapp.conf (this line is repeated 3 times)
[2012/04/24 16:53:07] #net-snmp <fenestro> That is not related to the problem, but is pretty undesirable. The snmp client tools shouldn't be trying to manage persistent storage
[2012/04/24 16:54:12] #net-snmp <stephane_charett> our network device is still on Ubuntu 10.04, with net-snmp 5.4.2.1
[2012/04/24 16:54:49] #net-snmp <stephane_charett> within the next month we're moving to Ubuntu 12.04
[2012/04/24 16:57:37] #net-snmp <stephane_charett> but since calling snmptrap from bash seems to work and snmptrapd calls the traphandle script, I'm going to assume my .conf files are correct. This brings me back to the code generated by "mib2c -c mib2c.notify.conf MyMib" to trigger a trap notification.
[2012/04/24 16:58:21] #net-snmp <fenestro> so, I think you have two options: 1. run in the agent context and use use send_v2trap(); 2. run as if you were a client application, specify the trap sink within the app, and do what snmptrap.c does to build and send the trap
[2012/04/24 16:58:26] #net-snmp <fenestro> mib2c.notify.conf assumes #1
[2012/04/24 16:58:53] #net-snmp <fenestro> but it feels more like you don't really want to behave as though you're running inside an agent, so you would rather do #2
[2012/04/24 16:59:16] #net-snmp <stephane_charett> Sorry, I don't know the different between the two.
[2012/04/24 16:59:45] #net-snmp <stephane_charett> when you say agent, are you talking about our agentx daemon I wrote to serve our custom MIB scalars and table?
[2012/04/24 17:00:37] #net-snmp <fenestro> well, this could be a separate agent, but yeah, at some level you have to, e.g., integrate your main app loop with the snmp agent main loop with snmp_select_info, for example
[2012/04/24 17:01:35] #net-snmp <stephane_charett> we have...probably a dozen daemons running on this device. When any of those detect an error, we wanted a "simple" API to call to generate a trap.
[2012/04/24 17:02:00] #net-snmp <stephane_charett> but it sounds like I'm using the wrong approach?
[2012/04/24 17:02:47] #net-snmp <stephane_charett> is there something better suited than the send_v2trap() API I'm trying to call?
[2012/04/24 18:56:41] #net-snmp <fenestro> you might be better off using the same API that snmptrap.c uses instead (my "#2" above)
[2012/04/24 21:37:48] #net-snmp <stephane_charett> Yes, #2 sounds like a better description. How do I specify the trap sink within the app and do what snmptrap does?