On 10 February 2010 16:00, Andrea Agosti <[email protected]> wrote: > I'm building a subagent and it need to read some values from snmp server > itself.
>From the SNMP server (agent) or from the underlying system? Remember that the SNMP agent is simply a middleman. The majority of the information that it's reporting is retrieved from some element of the system that it's running on. So one way to read such values is to query the underlying subsystem directly - bypassing the agent altogether. Of course, that is very closely tied to the particular information you want to retrieve (and probably the current O/S as well) The alternative is to effectively pretend to be a management client, and retrieve the value for a given OID. That protects your subagent module from having to deal with this sort of system-specific detail. > There's a way to get a value from the same tree without the need > of creating a snmp session as shown in snmpdemoapp.c? Not really, no. If you are going to query the agent, then you do need an SNMP session. If this is all within the same process (e.g. all run within the master agent), then you can use a special "callback" session, to avoid actually sending an SNMP request packet. Similarly, if your subagent is querying data from elsewhere within the same subagent., then you can also use this callback mechanism. But if your subagent is querying data from the master agent (or some other subagent), then it does need a normal SNMP session, connecting to the master agent and sending SNMP requests over a network interface (even if that's the loopback interface). > What I need is something like: [snip] Have a look at the routines 'netsnmp_query_get()' and similar. These will handle things for you - regardless of whether you're working in the same process or not. You just have to provide a suitable session to use. Also have a look at the DisMan Event MIB code - which uses this mechanism. Dave ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
