Re: how to write a handler reacting on requests under the registered mib?
"Dave Shield" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
On 10/08/07, Torben Surmer <[email protected]> wrote: > I have generated some example code with mib2c -c mib2c.create-dataset.conf > NET-SNMP-EXAMPLES-MIB::netSnmpIETFWGTable > > After compiling a subagent with the code generated by mib2c I assumed that > the handler-function would be called when I run a snmpget on a MIB under the > registerd OID {1,3,6,1,4,1,8072,2,2,1}, thus something like %snmpget > localhost .1.3.6.1.4.1.8072.2.2.1.4711 ... I was mistaken, but to my > surprise the handler IS called when I do %snmpget localhost > .1.3.6.1.4.1.8072.2.2.1.1.3.1 ! > > Mysterious. Do anybody know why? The basic idea of the 'dataset' helper is that the table contents are maintained by the helper itself. It knows which rows are valid, and which rows are not. When the agent receives a GET request for a valid row, it will retrieve the corresponding column value, insert this into the response varbind, and then call the user-provided handler for any last-minute processing that might be required. When the agent receives a GET request for a non-existant row, it recognises that the row is not valid, so returns a 'noSuchInstance' exception automatically. It doesn't call the user-provided handler, because it knows that the row doesn't exist. If you want to take care of which rows are/aren't valid yourself, then don't use the 'dataset' helper. It's not designed for that. Dave ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users