locked
Unable to fetch the SNMP Trap message in VB.NET RRS feed

  • Question

  • Hi,

    Can somebody help me with problem mentioned above. I am unable to the text message in the trap.

    However I am getting other information like-:

    SnmpV1Notification event occurred.

    public Community name---> .

    Process has created, path is:

    Property count 9

    Relative path

    Server

    SUPERCLASS SnmpNotification

    AgentAddress 127.0.0.1

    AgentTransportAddress 127.0.0.1

    AgentTransportProtocol IP

    Identification 1.3.6.1.4.1.393.200.50.66.0.2

    TimeStamp 9



    Try

    Dim connection As New ConnectionOptions()

    ' connection.Username = "administrator"

    'connection.Password = "Admin#123"

    'connection.Authority = "ntlmdomain:DOMAIN"

    Dim scope As New ManagementScope("\\localhost\root\snmp\localhost", connection)

    scope.Connect()

    Dim query As New WqlEventQuery("SELECT * FROM SnmpNotification")

    Dim watcher As New ManagementEventWatcher(scope, query)

    Console.WriteLine("Waiting for an event on FullComputerName ...")

    Dim eventObj As ManagementBaseObject = watcher.WaitForNextEvent()

    watcher.Start()

    Console.WriteLine("{0} event occurred.", eventObj("__CLASS"))

    console.WriteLine("{0} Community name---> .", eventObj("Community"))

    'Display information from the event

    Console.WriteLine("Process {0} has created, path is: ", eventObj("__PATH"))

    Console.WriteLine("Property count {0}", eventObj("__PROPERTY_COUNT"))

    Console.WriteLine("Relative path {0} ", eventObj("__RELPATH"))

    Console.WriteLine("Server {0} ", eventObj("__SERVER"))

    Console.WriteLine("SUPERCLASS {0} ", eventObj("__SUPERCLASS"))

    Console.WriteLine("AgentAddress {0} ", eventObj("AgentAddress"))

    Console.WriteLine("AgentTransportAddress {0} ", eventObj("AgentTransportAddress"))

    Console.WriteLine("AgentTransportProtocol {0} ", eventObj("AgentTransportProtocol"))

    Console.WriteLine("Identification {0} ", eventObj("Identification"))

    Console.WriteLine("TimeStamp {0} ", eventObj("TimeStamp"))

    Console.WriteLine("VarBindList {0} ", eventObj("VarBindList"))

    'Console.WriteLine("Enterprise {0} ", eventObj("Enterprise"))



    ' Cancel the event subscription

    watcher.Stop()

    Close()

    Catch err As ManagementException

    MessageBox.Show("An error occurred while trying to receive an event: " & err.Message)

    Catch unauthorizedErr As System.UnauthorizedAccessException

    MessageBox.Show("Connection error (user name or password might be incorrect): " & unauthorizedErr.Message)

    End Try



    Thanks,

    Rahul

    Thursday, March 19, 2009 7:31 AM