SNMP--How to install SNMP extension agent DLL(如何安装SNMP扩展代理DLL)

来源:互联网 发布:淘宝能寄到印尼吗 编辑:程序博客网 时间:2024/06/05 05:31

本文翻译只是出于学习的目的,中文部分仅代表个人观点,有错误还望指正,英文部分来自www.codeproject.com/。其中复制可能有误,可以看懂英文的还请到官网下载。如有版权争议,请联系QQ:643166601,本人会及处理。翻译新手,有错是必然的,求高人指点。欢迎同为新手的你共同学习。

 

英文原文地址:

http://www.codeproject.com/Articles/9025/How-to-install-SNMP-extension-agent-DLL

 

How to install SNMP extension agent DLL

How to develop a SNMP extension agent DLL

如何安装SNMP扩展代理DLL

By Ramanan.T, 12 Dec 2004

--Ramanan.T 20041212

 

 

Download demo project - 15.6 Kb 

 

 

Introduction

简介

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

这个教程是我以前的文章"How to develop a SNMP extension agent DLL"的第二部分。

 

 

Here I shall explain how to install the developed SNMP extension agent DLL in Windows 2000. 

在这里我将解释如何在Windows2000中安装开发的完SNMP扩展代理DLL

This agent DLL is from the previous part of this article. 

这个代理DLL是这篇文章的先前部分。

Please find the source code of this DLL from the previous article. 

从之前的文章中请找到这个DLL的源代码。

Here I'm demonstrating SNMP on the same computer, which will act as SNMP client and server (i.e., SNMP manager and Agent, respectively). 

在这里我在相同的计算机上演示SNMP,这将作为SNMP客户端和服务端(SNMP管理和代理,分别展示)

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.

因此,我们将用 127.0.01做为本地IP

 

 

Install SNMP Service

安装SNMP服务

By default, Windows 2000 doesn't have SNMP installed. 

默认情况下,Windows2000SNMP不安装。

Therefore, install the SNMP services first. 

因此,首先安装SNMP服务。

For that, go to "Control panel", "Add\Remove Programs". 

对于这一点,到“控制面板”,“添加\删除程序”。

Click "Add/Remove Windows components".

点击“添加/删除Windows组件”。

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.

最可能的是,你需要插入Windows2000 CD来完成安装。

 

 

After the installation, go to the Services and make sure you have two new services "SNMP Service" and "SNMP Trap Service". 

安装完成之后,去服务中看确保你有两个新的服务“SNMP Service”和“SNMP Trap Service”。 

"SNMP Service" corresponds to the service file SNMP.EXE and "SNMP Trap Service" corresponds to the service file SNMPTRAP.EXE. 

SNMP服务”相应的服务文件是SNMP.EXE和“SNMP Trap Service”相应的服务文件是“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".

要配置服务,在服务(管理控制台工具),右击“SNMP Service”点击“属性”。

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. 

在“社区名称”组合框中输入“public”,点击“增加到列表”按钮。

Then to fire traps to our same computer, click "Add" and add the IP address "127.0.0.1". 

然后删除我们的同一台计算机已有陷阱,点击“添加”,添加IP地址“127.0.0.1”。

If you have the luxury of another computer then specify its IP address here.

如果你有奢侈的另一台计算机然后在这里指定它的IP

 

 

Now go to "Log On" tab and enable the "Profile 1" by clicking "Enable" button. 

现在到“登录”选项卡,启用“个人资料1”点击“启用”按钮。

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". 

出现对话框,在“团体权限”中选择“读写”,在“团体民称”中输入“public”。点击“确定”按钮。

If you want to accept requests only from a particular client, then select "Accept SNMP packets from these hosts" and click "Add" underneath that. 

如果你想从一个特定的客户端接收请求,然后选择“接收来自下列主机的SNMP数据包”,点击下方的“添加”。

Type the host name or IP address and click "OK" on the appearing dialog box. 

键入主机名或IP地址在出现的对话框上点击“确定”。

After all this, click "Apply" or "OK" and close the "SNMP Service" Properties dialog. 

这一切之后,点击“应用”或“确定”关闭“SNMP Service”属性对话框。

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. 

SNMP服务”配置完成之后,选择“SNMP Trap Service”在它的上面右击打开它的属性对话框。

On the "Log On" tab, configure as for the service before. 

在“登录”选项卡上,配置这个服务之前。

Then "Apply" or "OK", and close the "SNMP Trap Service" Properties dialog.

然后“应用”或“确定”,关闭“NMP Trap Service”属性对话框。

 

 

These minimal configurations are enough to run our MyAgent.DLL. 

这些最低配置是足够运行我们的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. 

首先使用任何注册表编辑器到 

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\ExtensionAgents 注册表项。

If you have installed the SNMP properly, then you can see several Microsoft agents' entries. 

如果你已经正确的安装了SNMP,然后你能看到几个Microsoft的代理的入口。

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. 

在这个键下面,创建一个字符串名字是“Pathname”和真实的DLL路径。

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. 

Yep,我仍然不能提供任何事关于客户端。

There are three options available to you:

对于你有三个选择可用:

Follow my next article "MIB Browser tool - Tool to traverse MIB tree using SNMP" and get the tool and test it.

跟着我下一篇文章“MIB Browser tool - Tool to traverse MIB tree using SNMP”下载工具测试它。

Download some free tool from the web to browse MIB tree (or if you are rich, buy one ;)).

从网上下载一些写免费的工具去浏览MIB tree(或者你是富有的,买一个;)

Create you own tool from SNMP walk through template class: C++ Template class to walk through a tree from Nandagopal. 

SNMP walk通过模版类创建你自己的工具:C++模版类从Nandagopal树去walk通过。

 

 

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.

通过任何方式,你可以找到非常详细的解释在MSDNJames D. Murray的“Getting Started with the SNMP Service”有关于Windows SNMP服务和安装。

 

 

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

希望我的文章让你在学习SNMP上容易,谢谢。

 

 

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 

澳大利亚

0 0
原创粉丝点击