On Mon, 6 Sep 2004 13:17:11 +0200 Fallmann, wrote:
FD> I use "netsnmp_register_watched_instance" to register my OID/value
FD> pairs. 
FD> 
FD> I would like to get informed, within my agentx subagent, when someone
FD> SETs the value behind an OID from a management station and I would like
FD> to be able to get an internal Event when someone does a GET on a
FD> registered OID, too.
FD> 
FD> Can net-snmp do this for me?

Yes. Depending on exactly what you want to do, it could be really easy or a
little tricky.

FD> Is this functionality built-in into net-snmp already (maybe there is
FD> some place I can register a callback function)? 

The easiest way is to simply add your own custom handler to the chain:

    netsnmp_mib_handler *ret, *tmp;
    netsnmp_handler_registration *reginfo = NULL;
    ...
    netsnmp_register_watched_instance( reginfo, watchinfo );
    ret = netsnmp_create_handler("my_handler", my_handler);
    tmp = reginfo->handler; /* get first handler */
    while( NULL != tmp ) {
       if ( NULL == tmp->next ) { /* found the last one? */
          tmp->next = ret;
          break;
       }
       tmp = tmp->next;
    }

Then my_handler will get called for every request for the instance (assuming
no errors are detected in higher level handlers). You can find lots of examples
in the code base on the different modes that a helper might encounter. As a
matter of fact, take a peek at netsnmp_watcher_helper_handler(), and you'll see
exactly what is going on right before your handler is being called.

-- 
Robert Story; NET-SNMP Junkie <http://www.net-snmp.org/>
<irc://irc.freenode.net/#net-snmp>
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-coders>

You are lost in a twisty maze of little standards, all different. 


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
Net-snmp-coders mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to