WMI a SNMP

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

HI all,
sorry for my bad eglisch . I have questation about SNMP . I want trap the
snmp traps . I am write this code :
ManagementScope ms = new ManagementScope("root/snmp/localhost");
ms.Connect();
WqlEventQuery wql = new WqlEventQuery("select * from SNMPNotification");
ManagementEventWatcher mew = new ManagementEventWatcher(ms,wql);
mew.EventArrived +=new EventArrivedEventHandler(mew_EventArrived);
after I call mew.Start() the trap work , but after few hour the trap not
work .
where is trouble ?
thanx
 
Hi Marek,

Move the ManagementEventWatcher mew declaration outside the procedure, and
declare it at class level. Otherwise eventually is garbage-collected after
some time.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
I try :
public class snmp_tracer : System.ServiceProcess.ServiceBase
{
private System.Data.SqlClient.SqlConnection sqlcon;
private System.ComponentModel.Container components = null;
private System.Data.SqlClient.SqlCommand sqlcom;
public ManagementEventWatcher mew;
but still not work .....
 
Back
Top