Could give me a hand:

I am using Red Hat 9, Kernel 2.4, with net-snmp-5.0.6.

What I want:
I am trying to extend the agent and add a new oid .1.3.6.1.2.1.12.1. Upon a get request, i want to write something to a file, and upon a set request i want to write something else.

what I did:
I wrote a .h and .c file (myIntMIB.h and myIntMIB.c). I recompiled the agent with them in the agent/mibgroup directory as usual. I am using netsnmp_create_handler_registration with HANDLER_CAN_RWRITE as last argument to create a handler that can set and get. Of course it refers to an oid handler (myIntMIB_handler) i wrote in this .c file. Then I am using netsnmp_register_handler to register it.
The oid handler I wrote has a regular switch statement with MODE_GET, MODE_GET_NEXT, MODE_SET_ACTION etc and depending on the case I am in, the handler writes a different string to a file.

My problem:
I wrote a few lines at the beginning of the oid handler so that it writes to a file as soon as it is invoked, before any processing of the request in the switch statement is done. It seems that the oid handler is only invoked upon GET requests. When a SET request is received, there is no output on the latter file.
Additionally, I looked at the /var/log/snmpd.log file: The DEBUGMSGTL writes to it the request mode at the beginning of the oid handler, again before the switch statement. You can see that there is only a debug output when a GET request is received.
BRIEFLY, my handler is never invoked unless the request is a GET request. What can I do about it to make it work with SET requests too?

I have attached the .c and .h files if u wanna take a look.

Thanks.
PS: Please reply to this email address if possible.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

Attachment: myIntMIB.c
Description: Binary data


Attachment: myIntMIB.h
Description: Binary data

Reply via email to