Create custom SNMP Manager, Trap and Agent applications for monitoring and controlling network devices.
That SNMP MIB files can be loaded for easy cross-referencing?
Variables and traps defined in MIBs are parsed into easy-to-use programming objects using the SnmpMib object. The SnmpMib object also provides the means for easily cross-referencing OIDs with variable names, and vice-versa.
Code Sample:
'Add mib files to a collection of file names
Dim MibList As New DartStrings
MibList.Add "d:\Mib Depository\smi.mib"
MibList.Add "d:\Mib Depository\mib_ii.mib"

'Compile the mibs in the collection
Dim Mib As New SnmpMib
Mib.Compile MibList

'Find a variable from an Oid
Debug.Print Mib.Name("")

'Find a variable's OID
Debug.Print Mib.Oid("sysName")
Back to Top
That the Manager control can be used to receive traps from your network agents?
A Trap event will fire whenever the Manager control receives an unsolicited message (trap) from an agent on the network.
Code Sample:
Private Sub Manager1_Trap()
'Fires when manager receives a trap
'Add trap info to trap log
    Dim trapLog As String
    trapLog = trapLog + "Trap received from host " + Manager1.AgentName + vbCrLf

    Dim v As New SnmpVariable
    For Each v In Manager1.Message.Variables
        trapLog = trapLog + v.Oid + " " + v.Value + vbCrLf
End Sub
Back to Top
That the SnmpMessage object makes sending SNMP requests easy?
Just set a few properties of the SnmpMessage object, and let the control encode the properly formatted SNMP message for you.
Code Sample:
'Open the Manager control for sending
Manager1.Open 162

'Set the Agent properties
Manager1.AgentName = "balrog"
Manager1.AgentPort = 161

'Create a variable to send in the request
Dim v As New SnmpVariable
v.Oid = "" 'sysName OID

'Send a Get Request for the sysName variable
Manager1.Message.Type = snmpGet1
Manager1.Message.Variables.Add v

'Send the Request

'Examine the Response
Debug.Print Manager1.Message.Variables(1).Value
Back to Top
That the Agent control can be used to create an SNMP agent, without the need of a MIB file?
MIB files are not necessary to create agent applications with the control. The Agent control can handle variables added programmatically using SnmpVariable objects, making the need for MIB files optional.
Code Sample:
'This Agent supports the sysLocation variable
Dim v As New SnmpVariable
v.OID = "" 'sysLocation
v.Type = snmpOctetString
v.Value = "The test machine in Lab 1"
Agent1.Mib.Variables.Add v

'Start the Agent.
'The Agent will automatically respond to Set and Get queries
'For the sysLocation variable
Agent1.Auto = True
Agent1.Open 161
Back to Top
That the Agent control can send SNMP trap messages to listening Managers on your network?
The Agent control can be used to send unsolicited trap messages to all Managers listening on the network.
Code Sample:
'Create WarmStart Trap Message
Agent1.Message.Type = snmpTrap1
Agent1.Message.GenericTrap = snmpWarmStart
Agent1.Message.Enterprise = ""

'Set destination and Send
Agent1.TrapManagers.Add "" 'multicast to all listeners on network
Back to Top
That the Agent control will automatically respond to get and set requests without the need for additional handling code?
By keeping the Agent.Auto property true, the control will automatically format and send responses to Get and Set queries it receives. Alternatively, code can be added to the Agent.Response event for custom responses.
Code Sample:
'The Agent control will respond automatically to Set and Request messages
'For variables added to the Agent.Mib.Variables collection
Agent1.Auto = True
Back to Top