Click here to Skip to main content
Click here to Skip to main content

How to install SNMP extension agent DLL

By , 11 Dec 2004
 

Introduction

This tutorial is the second part of my previous article "How to develop a SNMP extension agent DLL".

Here I shall explain how to install the developed SNMP extension agent DLL in Windows 2000. This agent DLL is from the previous part of this article. Please find the source code of this DLL from the previous article. Here I'm demonstrating SNMP on the same computer, which will act as SNMP client and server (i.e., SNMP manager and Agent, respectively). Real thing should be on two computers. To install and experiment on the same computer, we don't need Internet connection. So in this case, we'll be using "127.0.0.1" local IP.

Install SNMP Service

By default, Windows 2000 doesn't have SNMP installed. Therefore, install the SNMP services first. For that, go to "Control panel", "Add\Remove Programs". Click "Add/Remove Windows components". Check the checkbox "Management and Monitoring Tools". Then on Detail, check "Simple Network Management Protocol". Click Next and complete the installation. Most probably, you will need Windows 2000 CD inserted to complete the installation.

After the installation, go to the Services and make sure you have two new services "SNMP Service" and "SNMP Trap Service". "SNMP Service" corresponds to the service file SNMP.EXE and "SNMP Trap Service" corresponds to the service file SNMPTRAP.EXE. You can find the Services Tool (Management Console Tool) in "Administrative Tools" under "Control Panel".

Configure Services

To configure, on Services (Management Console Tool), right click on "SNMP Service" and click "Properties". Properties dialog will open up. This will look like this...

Select the tab "Traps". Type "public" on "community name" combo box and click "Add to list" button. Then to fire traps to our same computer, click "Add" and add the IP address "127.0.0.1". If you have the luxury of another computer then specify its IP address here.

Now go to "Log On" tab and enable the "Profile 1" by clicking "Enable" button. Also make sure "Local system account" radio button appears selected.

Now to configure security, go to the tab "Security". Check the checkbox "Send authentication trap". Click "Add" under "Accepted community names". On appearing dialog box, select "READ WRITE" on "Community rights", enter "public" on "Community name", and click "OK". If you want to accept requests only from a particular client, then select "Accept SNMP packets from these hosts" and click "Add" underneath that. Type the host name or IP address and click "OK" on the appearing dialog box. After all this, click "Apply" or "OK" and close the "SNMP Service" Properties dialog. If the service is not started, right click and start it. Security tab will look like this...

After finishing "SNMP Service" configuration, select "SNMP Trap Service" and open up the Properties dialog by right clicking on it. On the "Log On" tab, configure as for the service before. Then "Apply" or "OK", and close the "SNMP Trap Service" Properties dialog.

These minimal configurations are enough to run our MyAgent.DLL. All your configurations will be stored under the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SNMP

Configure Our Agent

Now we have to configure our extension agent. We have to do this by adding registry entries in two places.

First, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\ ExtensionAgents registry key using any registry editor. If you have installed the SNMP properly, then you can see several Microsoft agents' entries. What we have got to do is add a string value at the end of all agent entries and add our agent's registry key path. After adding, here is how my registry looks like...

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ 
                        Services\SNMP\Parameters\ExtensionAgents]
"1"="SOFTWARE\\Microsoft\\LANManagerMIB2Agent\\CurrentVersion"
"2"="SOFTWARE\\Microsoft\\RFC1156Agent\\CurrentVersion"
"3"="SOFTWARE\\Microsoft\\HostMIB\\CurrentVersion"
"4"="SOFTWARE\\Microsoft\\SNMPMIB\\CurrentVersion"
"5"="SOFTWARE\\Microsoft\\SNMP_EVENTS\\CurrentVersion"
"6"="SOFTWARE\\Microsoft\\ACS\\CurrentVersion"
"7"="SOFTWARE\\Microsoft\\IGMPMibAgent\\CurrentVersion"
"8"="SOFTWARE\\Microsoft\\IPMulticastMibAgent\\CurrentVersion"
"9"="SOFTWARE\\Microsoft\\IPXMibAgent\\CurrentVersion"
"10"="SOFTWARE\\Microsoft\\IASAgent\\CurrentVersion"
"11"="SOFTWARE\\SNMP\\CurrentVersion" <--<note, this is our agent's 
                                                reg path that I added>

Secondly, we should create the registry key path that we specified previously. Under this key, create a string value and name it as "Pathname" and put the actual DLL path. After adding, here is how my registry looks like...

[HKEY_LOCAL_MACHINE\SOFTWARE\SNMP\CurrentVersion]
"Pathname"="H:\\VC++ Dev\\SNMP\\MyAgent\\Release\\MyAgent.dll"

Test Our Installation and Agent

Now we are ready to test our installation and extension agent. I can hear you asking "what about client tool?". Yep, still I didn't mention any thing about client. There are three options available to you:

Conclusion

I have written this article to make my extension agent-developing tutorial complete and to make it easy for beginners. Any way, you can find very detail explanation about Windows SNMP services and installations on MSDN "Getting Started with the SNMP Service" By James D. Murray.

Hope my article makes your life easy in learning SNMP. Thanks.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Ramanan.T
Software Developer (Senior)
Australia Australia
Member
No Biography provided

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.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 5memberbreakwind24 Feb '11 - 20:43 
it is very useful for me.
thanks lot
QuestionUsing mib file instead of hardcoded mib entries???memberShawn Choe9 Jun '06 - 12:13 
D'Oh! | :doh:
Hello, YogaRamanan. First of all, thank you very much for all these info and efforts. THey were very helpful. I created a new mib file and compiled it with compiler Smi2smir and mofcomp. However, system cannot detect the mib entries created in the new mib file. Do you know how to let XP load and know about the newly created mib file? Please give me a word if you know anything about this? Your word would be appreciated!
 
Shawn
GeneralAgent not respondingmembertobeymag26 Aug '05 - 18:47 

Hi YogaRamanan,
 
I installed the agent as per the instructions in your article. I've got an MIB Browser(WinAgents MIB Browser), but it does nor display the MIB Objects made by your Agent.
 
However using "snmputil.exe" i get the Object Information, but only when I am using the name format i.e.
 
.iso.org.dod. .... .private.enterprises.15.0.0.1
 
but not when using the numbers i.e.
 
.1.3.6.4. ....15.0.0.1
 
Could you please tell why this is so?
 
Thanks
TobeyMag
GeneralMyAgent.dllmemberAwadhesh Kumar21 Jul '05 - 23:28 
How can i download MyAgent.dll, PLs provide the link.
 
Regards
Awadhesh
QuestionCan do SNMP-GET but not SETmemberDral11 Jul '05 - 0:42 
Hello
 
I did compile the extension agent under VC++(version6) and installed it in the manner explained by the article; I am using win2000.
 
When testing, I can read the three mib entries you define in the agent using SNMP-GET, but i cannot do an SNMP-SET to write to the writable parameters, eg Age. I cannot work out where I am going wrong if any. It appears that the SnmpExtensionQuery is not being called during an SNMP-SET, but I cannot be sure.
 
Any ideas? I would really appreciate some hints here.
 
Regards
 
Dral
Generalprobs -- need help urgentlymemberenjoycrack14 Jun '05 - 22:24 
hi,
 
tried to config extension agent as ur steps, but there was an warning msg reported in event viewer. Plz refer below
 
The SNMP Service is ignoring extension agent dll C:\dev\bin\extsnmp.dll because it is missing or misconfigured
 
does any1 know this?
Thanx in advance
AnswerRe: probs -- need help urgentlymemberpogosama11 Feb '11 - 2:28 
If you have a 32-bit dll and want to use it on a 64-bit machine, then you need to create a registry key (containing the Pathname string) in \\HKLM\Software\Wow6432Node\ instead of \\HKLM\Software\. Otherwise you'll get the warning message described above.
GeneralBuilding with Borland C++ Buildermembermcintyre25 Feb '05 - 3:43 
I can view data in the MIB using the given library file, but when I build the application myself under Borland C++ Builder on XP I have problems accessing the data in the MIB. I can verify that the nodes exist, but the data is null. I have used "__declspec (dllexport)" and have not had any success. I have also checked and made sure that read/write properties are set correctly. Any sugestions?
GeneralCode Correction (typo?)sussRandyCP13 Jan '05 - 7:24 
Within the downloaded code, routine SnmpExtensionTrap(), the statement:
pEnterpriseOid->idLength = sizeof(g_TrapOid);
 
should read:
pEnterpriseOid->idLength = sizeof(g_TrapOid)/sizeof(UINT);
QuestionCatching traps under XP ?memberMoz16 Dec '04 - 23:04 
Hi YogaRamanan
Thank you for your article. I used with success agents under Windows NT and 2000 and catch traps sent by agents but under XP can not handle traps generated by agents Frown | :( . Have you tested MySNMP under XP or have your any idea for not working under XP ?
Thanks
 
Moz
Tunis - Tunisia
AnswerRe: Catching traps under XP ?memberT.YogaRamanan17 Dec '04 - 2:38 
I haven't tested this tool in XP. Untill I get a XP machine its impossible for me to trace this bug. I'll try to solve this in the future, in the mean time if you find a solution please send me a word.
 
-YogaRamanan
 

GeneralRe: Catching traps under XP ?memberMoz19 Dec '05 - 4:01 
Sorry, I have not a solution yet D'Oh! | :doh:
 
Moz
Tunis - Tunisia
AnswerRe: Catching traps under XP ?memberSalvador Madrazo30 May '08 - 6:00 
Hi Everybody.
 
Im not T.YogaRamanan, not even know very well the language, but i have a solution for the xp problem:
 
Windows CE does not support the expansion of SystemRoot –
the only thing needed in the registry value is the name of the DLL – this differs from NT

(http://msdn.microsoft.com/en-us/library/aa910042.aspx[^])
 
So you need change your:
"Pathname"="H:\\VC++ Dev\\SNMP\\MyAgent\\Release\\MyAgent.dll"
 
for something like:
"Pathname"="%SystemRoot%\\System32\\MyAgent.dll"
 
that works for me.
 
Salvador

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

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 11 Dec 2004
Article Copyright 2004 by Ramanan.T
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid