Click here to Skip to main content
Licence CPOL
First Posted 18 Mar 2008
Views 26,802
Downloads 1,022
Bookmarked 11 times

Use WINSNMP and VB.Net 2005 to retrieve SNMP information.

By | 18 Mar 2008 | Article
(untagged)
Make a get call via the WINSNMP API to retrieve the os version from a remote machine.

Introduction

VBDNFW2SNMP is a quick attempt to use the winsnmp api to retrieve information from remote snmp agents. This example uses VB .Net 2005 with the .Net framework 2.0

Background

Most of the examples I found on the net used WMI instead of api calls, and the older VB6 code used winsock. After many, many hours of searching and putting pieces of info together, i could finaly make a get call to a remote snmp agent. The most valuable resources were:

Microsoft platform SDK for Windows 2003 server.

WinSNMP (VB6) at Http://www.winsnmp.com

check out the WinSNMP v2.0 Addendum at http://www.winsnmp.com/docs/winsnmp2.txt

Function Pointers and COM
By Ben Garcia (VB6 and C++) at http://www.15seconds.com/issue/021002.htm

Windows SNMP - An Open Interface for Programming Network Management Applications usint the Simple Network Management Protocol under Microsoft Windows - available via FTP from host SunSite.unc.edu under directory /pub/micro/pc-stuff/ms-windows/WinSNMP

SNMP example in C# from Evolution software at http://www.evolutionsoftwarellc.com/

The rest was filled in with info from MSDN and GOOGLE

Using the code

I have included the complete project which retrieves the os version only. Simply run VBDNFW2SNMP.exe, type in the remote IP and click on the get button.

The current code does not release and cleanup SNMP objects created. It also does not retrieve all types of OID, as this part of the code has to be expanded on further. Where possible I have added the necessary error management to try and make the code easier to debug.

Points of Interest

This was a huge challenge for me as I had to use API calls and really tried to understand a bit more about interoperability between managed and unmanaged code.

History

First attempt :)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

JuanPieterse



South Africa South Africa

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Question"SNMP error description: No operation performed " using VBDNFW2SNMP Pinmemberfoca1722:39 29 Apr '10  
AnswerRe: "SNMP error description: No operation performed " using VBDNFW2SNMP [modified] PinmemberMember 87293579:39 14 Mar '12  
GeneralOpen source 100% .NET SNMP library Pinmemberlextm20:27 9 Sep '08  
GeneralI don´t get OS version PinmemberAndybestlc12:42 9 May '08  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 18 Mar 2008
Article Copyright 2008 by JuanPieterse
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid