Re: SNMP subagent in C + exec_command or similar

Wes Hardaker <[email protected]>
Newsgroups gmane.network.net-snmp.user
Organization Sparta
Message-ID <[email protected]>
>>>>> On Tue, 4 May 2010 12:22:50 +0200, Hársszegi Tibor <[email protected]> said:

HT> I need to create a subagent within C.
HT> Majority of the code executes 'scripts' like

Well, that architecture will be hard to make work quickly.  At a minimum
I'd suggest using a caching mechanism so you don't fire the script off
per ever call.

HT> I know that for this only I would NOT need .C agents at all,
HT> snmpd.conf + extend would be just fine. However it is also needed to
HT> trace whenever someone changes a given OID so that a trap event can
HT> ge sent to a remote host.

(in theory you could also accomplish this by inserting a handler
somewhere in between the main agent and the end-script execution, but
that's probably more advanced :-)

The problem with forking is that you'll end up duplicating the entire
agent memory, which is expensive.

HT> I have also tried to use the exec_command() within util_funcs, but I
HT> can't even use that, as "struct extensible" is not being defined in
HT> any of the publicly available headers.

You can go steal it from the agent/mibgroup directory.  It's actually a
header we've wanted to install for a long time but haven't.  The
function is defined in the libnetsnmpmibs library when you do your linking.

-- 
Wes Hardaker
Cobham Analytic Solutions

------------------------------------------------------------------------------

_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.