Generating traps in Multi-thread Sub-agent: proposed workaround
"Makavy, Erez (Erez)" <[email protected]>
| Newsgroups | gmane.network.net-snmp.devel,gmane.network.net-snmp.user |
|---|---|
| Message-ID | <AAB4B3D3CF0F454F98272CBE187FDE2F09F9487C@is0004avexu1.global.avaya.com> |
Hey, Let me rephrase my last question: Please read through, this might be interesting. The scenario ------------------- - In my subagent process the agent_check_and_process() is running within a thread. (Linux thread) - I'd like to able to generate traps within the sub-agent process. Questions 1 ------------------ Is there a multi-thread problem with using send_v2trap() in the main process, while the agent_check_and_process() thread is running? (I guess the answer is that there is a problem, because both threads require the same socket for sending agentX PDUs.) The problem ------------------ I'd like to solve this without changing the Library function agent_check_and_process(). How? Proposed solution --------------------------- - Open a session over Unix Domain socket (so that the agent_check_and_process() will listen on it) - my main process will write the trap parameters to that socket. - In the callback funciton of that session, instead of parsing an agentX PDU, I'll read the parameters from the socket, and invoke send_v2Trap(). Questions: ---------------- 1) Can it be done that way? 2) Am I missing some details? Any comment appreciated, Erez. Erez Makavy Software Engineer AVAYA Communication, ITC Mail : <mailto:[email protected] <mailto:[email protected]> > Tel:+972-3-6457562 _____ From: [email protected] [mailto:[email protected]] On Behalf Of Makavy, Erez (Erez) Sent: Wednesday, February 01, 2006 5:49 PM To: [email protected] Subject: Can't send trap from a running sub-agent. I have a sub-agent running as a thread. If I want to send a trap (using send_v2trap), I have to interupt the sub-agents agent_check_and_process() in order to send the trap. Is there some event mechanism in net-snmp to allow to interupt the sub-agent? Thanks, erez.