Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

Does anyone know if SNMP Mib implementation files have to be written in C? I have some Perl programs, and I want the SNMP agent to be able to call these Perl programs to perform some actions and to retrieve some data values. Is this possible with net-snmp? Thanks.

Replies are listed 'Best First'.
Re: SNMP MIB Implementation
by traveler (Parson) on Feb 27, 2003 at 22:25 UTC
    This depends on the agent. If the agent can invoke "any" executable, and the Operating System supports perl scripts as executables, then it appears that it will work. If perl scripts are not viewed as executables, you may have to compile the perl scripts.

    If, OTOH, the agent expects to call a function that it assumes to be C, you have to be a little bit more clever. In that case you could make a perl function look like a C function. The camel book gives the basic idea and our own SuperSearch when asked for "embed perl C" has some info. You should also check out swig.

    Finally, you could create a little C function to call the appropriate perl program and retreive the result.

    HTH, --traveler