On tis, 2008-03-04 at 16:37 +0000, Dave Shield wrote: > On 04/03/2008, Aaron Young <[EMAIL PROTECTED]> wrote: > > I'm fairly new to net-snmp and am currently working on a subagent > > serving our own mib. It would be nice to be able to perform GET > > requests on data served by the main agent (i.e. mib-2 data) from within > > my agent code. Is there a clean way to do this, or would this involve > > adding client code to the agent? > > Try something like: > > netsnmp_query_set_default_session( > netsnmp_iquery_user_session(secName)); > > where secName is an SNMPv3 user with read-access to the > information you want to query > > Then use > > netsnmp_query_get( varlist, NULL ); > > where varlist is a netsnmp_variable_list structure > (or list of structures) containing the OIDs that you > are interested in. > This call will fill in the corresponding values.
It should be noted that this only work in a compiled in or dlopened module. It won't work in an AgentX or SMUX subagent where you would have to actually send a request to the master agent to get hold of the value. /MF ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
