Create custom SNMP Manager, Trap and Agent applications for monitoring and controlling network devices.

Using PowerSNMP for ActiveX Part 1: Creating a simple Agent in VB.


Skill level:   Beginner
Software required:   · Visual Basic 6
· powerSNMP for ActiveX


The PowerSNMP product can be used to create a simple SNMP agent in minutes. This tutorial demonstrates creating an agent which listens for requests from the manager and responds to a manager's request for sysDescr. For instructions on how to create the manager application, see Using powerSNMP for ActiveX Part 2: Creating a simple Manager.

Step 1

  1. Download and install powerSNMP for ActiveX.

  2. Create a new project in Visual Basic.
    • Start Visual Basic
    • From the opening dialog, select Standard Exe and click OK

  3. Add an SNMP Agent Control to the form.
    • Right-click the Toolbox and select Components
    • Find the SNMP Agent control; select and click OK

  4. Drag an instance of the SNMP Agent Control onto the form.


Step 2

Now, just add the code necessary to respond to the query.

  1. Add a Command Button to the form.

  2. Access the button's OnClick event by double-clicking the button.

  3. Place the following code within the OnClick event of the button added above.

Private Sub Command1_Click()
   Dim Variable As New SnmpVariable 
   'The OID for sysDescr
   Variable.Oid = "" 
   'The value for this variable
   Variable.Value = "This is Dart's Computer"  
   'The SNMP value type   
   Variable.Type = snmpOctetString 
   'Add the variable to the Mib variable collection
   Agent1.Mib.Variables.Add Variable   
   'Start the agent on port 161
   Agent1.Open 161 
 End Sub


Step 3

When Step 2 is completed, compile and run the application. Click the button to start the Agent.