On 18 March 2010 01:11, daily study <study.dail...@gmail.com> wrote: > 1. I want to use net-snmp as such agent, Could i use net-snmp in the > model above ? How to use net-snmp? Could give me some examples in such > model?
Yes - you could use Net-SNMP for this. What you are describing sounds similar to the existing standard extension protocols (SMUX or AgentX) or the Net-SNMP-specific extension mechanisms (sh/exec/extend or pass/pass_persist). The cleanest example is probably the AgentX master code. See the routine agentx_master_handler() in the file mibgroup/agentx/master.c The details of how you pass the private protocol request on to your traffic processes will be different, but the basic model is likely to be broadly similar. > 2. I find i may use send_v2trap api to send snmpv2 trap to manager. If you want to send a notification from the agent to the manager, then 'send_v2trap' would be a perfectly sensible way to do this. Remember that the version (and destination) of the trap are determined by the trap2sink (or equivalent) lines in your snmpd.conf file. The agent will convert between versions as appropriate, so calling send_v2trap may result in an SNMPv1 (or v3) notification being sent. See the FAQ for more details. > 3. How and where i can get OID from snmp message from manager? The agent will call the handler routine that you register. This will include a list of varbinds to be processed, including the OIDs. See the code routine mentioned above for an example of what to do with this information. > 4. How can i make a snmp message to manager when i receive private > procotol message from traffic process ? which API in net-snmp i can use to > send this RESPONSE message to manager? The simplest approach would be if you're happy for the SNMP agent to block while wating for a response from the traffic process. You'd then insert the values into the request list (just as for any other MIB code) and return from the handler. If you don't want the agent to block, then you should mark the requested varbind (i.e. "request") as 'delegated' and awaiting a response. That's the approach used in the AgentX code - see 'agentx_got_response' for what to do with the return message. I believe there's more on delegated requests on the project website, but it's not something I've really looked into myself. A blocking approach would be much simpler - at least to start with, > 5. In snmp normal model, is it ture that agent MUST have the real data of > all OID in defined MIB and agent MUST get real data from traffic process > periodical ? No. That's certainly one model of working. But it's perfectly feasible to implement the MIB within the master agent, and query some extenal subsystem for the actual values to use, whenever a request comes in. There's nothing inherently different between making a local system call to retrieve the information of interest (say the current clock time), and making some more complicated query from a remote system. The main reason for using a local cache is to avoid excessive delays in getting the necessary information. It's a trade off between speed of response, and timeliness of data. Dave ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users