2023年12月31日发(作者:)
说明:
根据net-snmp-5.6中的“32”摘录和翻译。转载请注明出处。
email:wulinshuxue@
net-snmp 在windows下用MSVC编译(一)
net-snmp是一个开源项目,提供关于snmp的一些库和工具。下载网址:
/projects/net-snmp/
目前的最新版本是5.6。如果想简单地安装一下的话,可以下载x86的exe版本,一般最新版的程序还没有发布exe版本。目前最新的exe版本为 。
在网上搜了一下,大多是在linux下的编译过程,windows下的情况比较少,另外,一些注意事项也很少。
在下载了net-snmp-5.6后,看到里面那么多的文件,觉得很晕。我猜里面需要先读的文件大概是“”,这个文件是在win32环境下编译使用net-snmp的说明文件。
用记事本打开后,估计超长的篇幅要让不少人崩溃。不过没事,这是分小节写的,每小节有内容说明,条理很清晰。
摘录了一些说明,并作了大致的翻译,如下:
1、“This guide describes building with Microsoft Visual C++ 6.0 and higher, with
the gcc compiler from MinGW / MSYS, and with the gcc compiler from Cygwin.
As developers build with other Win32 environments, their notes will be
included here.”
这个指南介绍了如何使用VC++6.0及更高版本以及gcc来build。
2、If you are using Microsoft Visual Studio 6.0, you will have to install the
Platform SDK (PSDK) first.
如果使用的是VC6.0,那么必须先安装PSDK
3、If you are using any of the following environments, the PSDK download is not
necessary as the required parts of the PSDK are included:
- Microsoft Visual Studio 2002 or later.
- Cygwin.
- MinGW.
使用的是这些环境的话,无需安装PSDK
4、There are two ways to build Net-SNMP using Microsoft Visual C++. The first
and easiest method is using Configure and nmake on the command line, and the
second is using the Workspace files inside the interactive development
environment.
两种方式来用VC build Net-SNMP.
第一种,也是最简单的方法,就是在命令行下使用Configure和nmake。
第二种,就是IDE下使用workspace文件。
4.1、To use nmake on the command line, the Configure script is run first to create
the various makefiles. Once these have been created, nmake is used to build
the applications. Perl is required to use this method, as the Configure
script is written in Perl. ActiveState ActivePerl is available at:
/Products/ActivePerl/
为了在命令行下使用nmake,必须先运行Configure脚本来生成makefile。由于Configure脚本是
用Perl写的,所以要先安装ActivePerl
4.2、The make file system is based on and uses the directory structure of the
projects contained in the Workspace files which are described below. It is
recommended that you read and understand how the workspaces are configured
even if you will only be using the command line Configure / nmake system.
make文件系统是基工程的目录结构的,建议先阅读和理解workspace是如何配置的。
4.3、For building via the interactive development environment, there are the Win32
workspaces and . The last workspace allows to build a DLL
version of snmplib ().
对于使用IDE的情况,有和这两个文件。后者可以用来编译snmplb的DLL版本
4.4、There is one core development library ('libsnmp'), together with a number
of utility projects for the individual executable commands ('snmpget',
'snmpwalk', ). All of these projects require the .lib created by
the libsnmp project.
有一个核心的开发库——libsnmp,和一些用于各种可执行命令(如snmpget)的工程。
所有的这些工程都需要libsnmp工程产生的.lib文件
4.5、The agent requires the core library plus the other three library projects
('libagent', libhelpers' and 'netsnmpmibs') together with the main agent
project ('snmpd').
这个代理需要核心库加上其他三个库工程——libagent,libhelpers和netsnmpmibs,和
主代理工程——snmpd
4.6、The final application project is the trap handler 'snmptrapd'. This also
requires the agent libraries ('libagent' and 'netsnmpmibs') as well as the
core development library.
最终的应用工程师处理trap的snmptrapped。这同样需要代理库——libagent和netsnmpmibs
及核心开发库。
4.7、There is a Debug version and Release version for each subproject. This is so
the Debug and Release versions of an application can be built and tested
separately.
对于每个子工程,都有一个debug版本和一个发行(Release)版本。
所以,一个应用的debug版本和Release版本可以独立编译测试
4.8、VC++ 6.0, 7.1, 8.0 (2005) and 9.0 (2008) have been tested. Building with
earlier Microsoft compiler versions is no longer supported.
6.0及以后版本已经测试过,更早的版本不再支持
4.9、OpenSSL is required to support the encryption capabilities in SNMPv3,
or SHA authentication.
要支持SNMPv3的加密或SHA鉴定(SHA authentication)的话,需要OpenSSL
4.10、Since the MSVC build environment does not natively use "configure" nor "make"
to generate the various pathnames that the programs require, the header files
need to be manually modified when using the IDE, and an install script is
provided. When using the Perl Configure / nmake system, the header files are
automatically modified and require no manual editing.
由于VC不在本地使用configure或make命令来生成程序需要的各种路径名,所以在
使用IDE的时候需要手动修改头文件,有一个安装脚本可以使用(bat文件,
"")。
如果诸位看官使用的是Perl的configure/nmake的话,头文件会自动修改,无需劳您大驾。
4.11、The projects are arranged so that ALL of the usable products, the .exe files,
are written to the win32bin directory. The win32lib directory is used only
to build the the files in the win32bin directory. Once building is
completed, there is no further use for the files in the win32lib directory.
所有可用的产物(products),exe文件,都被写入了win2/bin目录。这个目录只是用于编译
目录中的文件。一朝编译成,该目录不再有用。
5、Debug Information
-----------------
Note that VC++ 6.0 has options for debugging information - the 'Program
Database'. This option is set in the Project settings, C/C++ tab, 'General'
category, and is turned on by default during the conversion of the project
files. This option is not for use with a library, as it embeds debug
information into the library that references an external file that will
not be available to the linking application. If you get an error message
along the lines of 'debugging information not available in file ,
make sure the library debug option is set to 'Program Database' or "/Zi".
如果出现'debugging information not available in file ',参考上述内容。
net-snmp 在windows下用MSVC编译(二)
(原创作品,转载注明出处)
继续阅读32
***************************************************************************
*
* Microsoft Visual C++ - Workspace - Building
*
***************************************************************************
The and workspaces allow to build the agent and the
applications. Proceed as follows:
1. Update the version stamp in win32net-snmpnet-snmp-config.h. The current
version can be found in the Unix configure script (top level folder) by
looking for the PACKAGE_VERSION variable.
和文件使得可以编译代理和应用。按如下操作:
1. 更新头文件(win32net-snmpnet-snmp-config.h)中的版本号。当前版本号可以在
unix的configure脚本中找到
2. If SNMPv3 encryption capabilities or SHA authentication is required,
install the OpenSSL DLL and library file as described in the section
'Microsoft Visual C++ - Building with OpenSSL" and then continue with
step 2.
如果需要v3的加密功能,则安装OpenSSL DLL和 'Microsoft Visual C++ - Building with
OpenSSL"
中介绍的库文件。然后,继续。
3. The default installation path is c:usr. This folder will contain all
the binaries, MIB files, configuration files etc. To change the location,
the win32net-snmpnet-snmp-config.h file needs to be modified by changing
the INSTALL_BASE variable.
Note:
All paths in net-snmp-config.h use the "/" UNIX pathname delimiter.
If a drive letter is not specified, the current drive letter is assumed.
For example: #define INSTALL_BASE "c:/usr".
缺省安装路径为c:usr 。这个文件将保护所有的二进制文件,MIB文件,配置文件等。
要更改位置的话,则修改win32net-snmpnet-snmp-config.h 中的INSTALL_BASE 变量。
注意:
上述头文件中的路径都是使用了UNIX系统中的"/"
4. When building DLLs instead of static libraries, *change* the following
line which is located near the top of the file:
/* #undef NETSNMP_USE_DLL */
*to*
#define NETSNMP_USE_DLL 1
如果编译DLLs而不是静态库的话,照上述方法更改。
5. Build the agent and the applications
a. Open (static build) or (dynamic build).
b. Click "Build->"
c. Select the projects and configurations you want to build.
d. Click "ReBuild All".
e. When building is done, View the Output window, clip and
save to a text file if there is some information to share.
编译步骤:
打开(静态编译) 或者(动态编译)
点击"Build->"
选择希望编译的工程和配置
点击"ReBuild All"
编译完后,查看Output窗口,若有需要分享的信息,剪辑后保存为txt
6. If the Perl modules are required, continue with the next section:
'Microsoft Visual C++ - Building the Perl SNMP modules'.
Otherwise, continue with the section:
'Microsoft Visual C++ - Installing'
如果需要Perl模块,则继续 'Microsoft Visual C++ - Building the Perl SNMP modules'这
一节.否则,继续 'Microsoft Visual C++ Installing'
***************************************************************************
*
* Microsoft Visual C++ - Workspace - Installing
*
***************************************************************************
The install script "" should be run after a
build is successful. It copies the programs, MIB files, and development
components to an install directory named in the INSTALL_BASE variable.
安装脚本 ""需要在build成功结束后再运行。
它将程序(programs),MIB文件,和开发组件复制到一个INSTALL_BASE变量
指定的路径。
1. Complete the section 'Microsoft Visual C++ - Building'.
完成Microsoft Visual C++ - Building'这一小节。
2. Open using a text editor.
The INSTALL_BASE variable must match the INSTALL_BASE compile constant
defined in "win32net-snmpnet-snmp-config.h", using these rules:
用记事本打开 。其中的 INSTALL_BASE变量必须和头文件
"win32net-snmpnet-snmp-config.h"中定义的一致。
a. All paths in use the "" DOS pathname delimiter.
Example: set INSTALL_BASE="c:usr".
脚本中使用的为""
b. All paths in net-snmp-config.h use the "/" UNIX pathname delimiter.
If a drive letter is not specified, the current drive letter is
assumed.
Example: #define INSTALL_BASE "c:/usr".
Note: You may also modify "" in order to not install
the linking libraries, or the header files.
net-snmp-config.h 中使用的是"/"
3. Open a command prompt window.
打开一个命令提示符窗口
4. Cd to the base directory where this file 32 is located.
进入到32所在的根目录
5. Run to install the programs.
运行
## sample output from
一个输出样例如下:
NOTE: Directory already exist messages are normal. If you are
not building with OpenSSL, then DLL not found messages
are normal.
”Directory already exist“这个消息的出现是正常的。如果没有build with的话,
”DLL not found “也是正常的。
C:net-snmp-5.1.1> win32install-net-snmp
Remember to run this script from the base of the source directory.
Creating "c:usr" sub-directories
A subdirectory or file c:usr already exists.
A subdirectory or file c:usrbin already exists.
A subdirectory or file c:usretcsnmp already exists.
A subdirectory or file c:usrsharesnmpsnmpconf-data
already exists
A subdirectory or file c:usrsharesnmpsnmpconf-data
snmp-data already exists.
A subdirectory or file c:usrsharesnmpsnmpconf-data
snmpd-data already exists.
A subdirectory or file c:usrsharesnmpsnmpconf-data
snmptrapd-data already exists.
A subdirectory or file c:usrlib already exists.
A subdirectory or file c:usrmibs already exists.
A subdirectory or file c:usrinclude already exists.
A subdirectory or file c:usrincludenet-snmp already
exists
.
A subdirectory or file c:usrincludeucd-snmp already
exists
.
Copying MIB files to "c:usr"mibs
Copying compiled programs to "c:usr"bin
Copying snmpconf files to "c:usr"sharesnmpsnmpconf-
datasnmp-data
Copying link libraries to "c:usr"lib
Copying header files to "c:usr"include
Deleting debugging files from "c:usr"
Copying DLL files to "c:usr"
The system cannot find the file specified.
Done copying files to "c:usr"
C:net-snmp-5.1.1>
## END sample output from
##输出样例结束
6. Add the bin folder (c:usrbin in the above example) to
your system path.
将bin文件夹加到系统路径中
7. Test the installation. For a simple test to see if Net-SNMP is working,
open a _new_ command prompt window, and type:
snmptranslate -IR -Td linkDown
测试安装情况。例如打开命令提示符窗口,键入如下:
snmptranslate -IR -Td linkDown
8. If the folder that Net-SNMP was installed to is ever changed, modify the
system environment variables or registry keys as explained in the
'Configuration_' file located in win32/dist/htmlhelp.
如果Net-SNMP安装位置有变,那么修改系统的环境变量或者注册表,参考
'Configuration_' ,它位于win32/dist/htmlhelp.
至此,编译告一段落了。
看到一篇文章,各位看官可以对比着看看:
一、准备工作
1、安装Microsoft Visual Studio 2005,其中Visual C++为必选组件
2、安装Active Perl解析器至C:usr目录下
该步骤必须执行,否则在后期执行配置操作时,会提示没有安装perl解析器的错误,从而无法自动配置。
二、编译NET-SNMP源文件(基于32中的Microsoft Visual C++ - Workspace -
Building部分)
1、配置默认安装路径,打开net-snmp-5.1.3win32net-snmpnet-snmp-config.h,将第8行改为#define INSTALL_BASE "C:/usr"
在net-snmp-config.h文件中,所有的路径都是使用UNIX下的/符号,如果将其改为Windows下的符号的话,反而会在后期配置时出现路径错误。
2、在Visual Studio 2005中打开,点击“全部都
是”转换工作空间。
3、单击菜单栏的“生成”下的“配置管理器”,将活动解决方案配置从Debug改成release。此处也可以不修改,但是在后面的安装过程中,需要加入“-debug”参数。(后续内容以不修改为例)。
4、在右侧解决方案资源管理器中,依次对libagent、libhelpers、libnetsnmptrapd、snmplib、netsnmpmibs这五个项目单击鼠标右键,选择“重新生成”。
5、单击菜单栏的“生成”下的“生成解决方案”。
6、单击菜单栏的“生成”下的“配置管理器”,在“项目上下文中”[color=red]去掉[/color]对libagent、libhelpers、libnetsnmptrapd、snmplib、netsnmpmibs这五个项目的选择,其余不变。
7、单击菜单栏的“生成”下的“重新生成”。
8、编译结束之后,单击菜单栏的“文件”下的“[color=red]关闭解决方案[/color]”,退出。
三、安装NET-SNMP(基于32中的Microsoft Visual C++ - Workspace - Installing部分)
1、打开,检查第12行是否为set
INSTALL_BASE="c:usr",不是的话请改成这个。
2、打开命令提示符窗口,进入net-snmp-5.1.3win32目录下,运行
-debug 安装。
如果编译的时候将活动解决方案配置改成了release的话,直接运行即可。
3、拷贝net-snmp-5.1.3win32local*.bat文件至C:usrbin目录下。
该步骤本应该在执行批处理的时候自动执行,但实际上这些文件并没有被拷贝过去,所以我们必须手动进行,否则无法配置。
四、检查文件是否完整,在C:usrbin目录下应该存在下列22个文件
、、、snmpconf、、
、、、、、
、、、、 、、、、、 、、
五、配置NET-SNMP(基于32中的Configuring Net-SNMP部分)
1、打开C:,检查第2行是否为set
MYPERLPROGRAM=c:usrbinsnmpconf,不是的话请改成这个。
2、打开C:usrbinsnmpconf,查找所有/usr/local/并替换为C:/usr/。
该步骤必须执行,snmpconf中的文件路径采用的是UNIX下的/usr/local/,这里必须改为Windows下的C:/usr/,但/符号仍然保持UNIX下的/符号,不用改成windows下的符号,否则运行时会提示无法创建路径。
3、运行 snmpconf -i
4、选择 3:
5、选择 3: Textual mib parsing
6、选择 1: Specifies directories to be searched for mibs.
7、输入 c:usrsharesnmpmibs
8、输入 finished回车 finished回车 quit回车,正常退出。
9、将C:usrsharesnmp目录下的拷贝至C:usretcsnmp目录。
10、拷贝32至C:usretcsnmp目录下,并改名
11、打开刚刚拷贝的,将第71行改为com2sec
local localhost public
原文件中71行的COMMUNITY部分必须被改成public,COMMUNINTY只是个例子,不修改的话后期无法正常执行。
12、删除或者注释掉第72行。
理由与上一条相同,NETWORK/24也只是个例子。
六、运行NET-SNMP
1、打开一个命令提示符窗口,运行 snmpd -f -Le -d
2、提示如下则正确运行:
NET-SNMP version 5.1.3
3、新开一个命令行窗口,运行 snmpget -c public -v 2c localhost ime.0
4、当前窗口提示如下:
SNMPv2-MIB::sysUpTime.0 = Timeticks: (8279) 0:01:22.79
5、原命令行窗口提示如下:
Received 41 bytes from 127.0.0.1 76
0000: 30 27 02 01 01 04 06 70 75 62 6C 69 63 A0 1A 02 0'.....
SMM)
0016: 02 0F BC 02 01 00 02 01 00 30 0E 30 0C 06 08 2B .........+
0032: 06 01 02 01 01 03 00 05 00 .........
Received SNMP packet(s) from 127.0.0.1
GET message
-- SNMPv2-MIB::sysUpTime.0
Sending 43 bytes to 127.0.0.1
0000: 30 29 02 01 01 04 06 70 75 62 6C 69 63 A2 1C 02 0).....
0016: 02 0F BC 02 01 00 02 01 00 30 10 30 0E 06 08 2B .........
0032: 06 01 02 01 01 03 00 43 02 20 57 .......
[原文]
/?
Microsoft Visual C++ - Building your own
applications with snmplib
***************************************************************************
*
* Microsoft Visual C++ - Building your own applications with snmplib
*
***************************************************************************
Linking in an snmplib built to use the Multithreaded DLL runtime library to
an application configured for the Debug Multithreaded DLL runtime library
results in a link error along the lines of 'defaultlib "MSVCRT" conflicts
with use of other libs'. If you receive a similar message, check that the
projects settings between library and application match up.
链接错误:'defaultlib "MSVCRT" conflicts with use of other libs' 这种情况下,
核实一下,library 和application间的projects settings是匹配的。
To successfully build your existing project with Net-SNMP libraries,
change the project settings FOR YOUR APPLICATION ONLY as follows:
要成功将你的现有工程和Net-SNMP库build,需要将project settings FOR YOUR
APPLICATION ONLY
进行如下更改:
1. In the Link section, Select "Additional Libraries".
Add for Release version.
Add netsnmp_ for Debug version.
在Link中,选择 "Additional Libraries".添加( for Release version)或
netsnmp_( for Debug version.)
2. Remove all references to these libraries:
libsnmp*.lib msvcrt*.lib libc*.lib
移去所有对这三个库的引用:libsnmp*.lib msvcrt*.lib libc*.lib
3. In the C++ section, Select "Code Generation".
For Release, select /MD or "MultiThreaded DLL".
For Debug, select /MDd or "Debug MultiThreaded DLL".
在C++区(?),选择 "Code Generation"。对于Release,选择/MD 或 "MultiThreaded DLL".
对于Debug,选择/MDd 或 "Debug MultiThreaded DLL"
4. Make sure "Ignore all default libraries" is NOT SET.
确保 "Ignore all default libraries"没被设置
5. Make sure "_MBCS" is included in your pre-processor defines.
Note: Some users may have better results compiling other packages that use
the installed header files by removing the "mode_t" definition from
net-snmp-config.h file in the installed directories.
确保"_MBCS"包含在预处理的定义中。
配置Net-SNMP
继续阅读32..... 内容真是够多
***************************************************************************
*
* Configuring Net-SNMP
*
***************************************************************************
Online documentation is available from the Net-SNMP home page at:
在线文档的网址如下:
/docs/
All configuration files should be placed in the INSTALL_BASEetcsnmp folder.
The INSTALL_BASE folder is defined in the win32net-snmpnet-snmp-config.h
file. For example, c:usretcsnmp.
所有的配置文档在INSTALL_BASEetcsnmp文件夹中。INSTALL_BASE变量在
头文件中定义。
Included is a Perl script called snmpconf which can be used to create
configuration files. Full documentation on using snmpconf is available from the
Net-SNMP web site at the above link.
其中包含了一个称作snmpconf的Perl脚本,它可以用来产生配置文件。
使用说明可以从刚才提及的网址下载。
To run snmpconf, first modify located in the bin folder where
Net-SNMP is installed. Modify the set MYPERLPROGRAM= line to contain the full
path to the snmpconf Perl script. For example:
在运行snmpconf前,先修改。如下:
set MYPERLPROGRAM=c:usrbinsnmpconf
You can now run snmpconf using the standard command line such as:
现在,你可以如下使用标准命令行来运行snmpconf
snmpconf -i
For detailed information on using environment variables and the registry to
configure Net-SNMP, see the 'Configuration_' file in
win32/dist/htmlhelp.
关于使用环境变量和注册表来配置的详细信息,参见
win32/dist/htmlhelp中的'Configuration_'
Net-SNMP 注册为windows service
仍然是阅读32。。。。
***************************************************************************
*
* How to Register the Net-SNMP Agent and Trap Daemon as Windows services
*
***************************************************************************
如何将Net-SNMP 代理和Trap Daemon(守护程序?)注册为Windows服务
The Agent () and trap daemon () can be run as a service
under Windows operating systems that have the Service Control Manager (SCM)
(Services Control Panel). This includes Windows NT, 2000, XP and 2003.
Windows 9x/Me do not have the SCM.
Agent()和trap daemon()可以作为有服务控制器的服务运行。
To allow or to run as a service, the programs need
to be registered with the SCM. This is done by running the program once with
the -register command line switch from a command prompt.
首先需要注册。方法是在命令提示符下,运行一次程序,with the -register command line
switch
If Net-SNMP was installed using the binary available from the Net-SNMP web site,
there will be shortcuts in the Start menu for registering and unregistering the
agent and snmptrapd.
如果是通过二进制安装包安装的,那么开始菜单里有注册的快捷方式
The synopsis for registering snmpd as a Windows service is:
注册的命令大概如下:
snmpd -register [OPTIONS] [LISTENING ADDRESSES]
The synopsis for registering snmptrapd as a Windows service is:
(
snmptrapd -register [OPTIONS] [LISTENING ADDRESSES]
After registration, the services 'Net-SNMP Agent' and 'Net-SNMP Trap Handler'
will be available in the SCM. The services can be started and stopped using
the SCM (Services Control Panel) or from the command prompt using:
注册后,这两个服务将可以在SCM里使用。可以使用SCM开始和停止,或者通过
命令提示符,方法如下:
net start "Net-SNMP Agent"
net start "Net-SNMP Trap Handler"
and
net stop "Net-SNMP Agent"
net stop "Net-SNMP Trap Handler"
If any command line options are specified after the -register option, they
will be included when the service starts. For example, to register the
snmptrapd daemon and enable logging of traps to c:,
enter the following command line:
snmptrapd -register -Lf c:/usr/log/
带选项的一个注册命令如上:
Note: Use Unix style slashes (/) for all paths.
注意:使用Unix风格的斜杠'/'
For a complete list of command line options, consult the man pages, or use
the -h switch:
其他可用的选项,参见man页面,或者使用-h,如下
snmpd -h
snmptrapd -h
Notes: -H will display all available , and
configuration file options, not the command line options.
注意:-H将显示所有的, and 配置文件选项,不仅仅
是命令行下的选项
Like all Net-SNMP applications, snmpd and snmptrapd will use the %链接Net-SNMP 应用程序, snmpd 和 snmptrapd,
SNMPCONFPATH and SNMPSHAREPATH environment variables when run as a %作为服务运行,将使用环境变量
service. The registry is the recommended method for defining
these %SNMPCONFPATH 和 SNMPSHAREPATH
variables due to a limitation in the Windows Service Control Manager% 由于SCM的限制,推荐用注册表定义这些变量
(SCM). When running as a service, if any system environment variables%作为服务运行时,如果任意系统环境变量变
are changed, the system will need to be rebooted to allow the services %化了,系统需要重启
to access the changed environment variables (see Microsoft knowledge
base article 821761). Therefore, when running snmpd or snmptrapd as %因此,如果将snmp或snmptrapd作为服务
a service, if SNMPCONFPATH or SNMPSHAREPATH is changed, a reboot will %运行,如果SNMPCONFPATH 或
be required after setting the environment variables, otherwise
the %SNMPSHAREPATH变化了,需要重启
services may fail to start. Using the registry to store the environment %使用注册表来存储环境变量可以避免这个问题。
variables eliminates this problem. See the 'Configuration_'%左边是参考文档
file in win32/dist/htmlhelp for more information on using the registry.
Unregistering the services &注销服务
--------------------------
To un-register the services, use the command line switch -unregister. For
example:
使用-unregister来注销服务,例子如下:
snmpd -unregister
snmptrapd -unregister
Note: Be sure to have all Service Control Panel windows closed when
unregistering, otherwise a reboot may be required to complete
the removal.
确保所有的服务控制面板窗口都关了再注销,否则将需要重启来完成注销
Modifying the services %修改服务
----------------------
To change the parameters that the SCM passes to snmpd or snmptrapd, the
service must be unregistered, and then re-registered with the new options.
要修改SCM传给snmpd额snmptrapd的参数,必须先注销服务,然后使用新的
options重新注册
For example, to change the parameters that SCM passes to snmpd, open a
command prompt window, CD to the directory where the snmpd program is located
(unless it is already in your PATH), identify the full set of parameters you
desire, then type these two commands:
例如,想要更改SCM传给snmpd的参数,则打开命令提示符窗口,
键入snmpd程序所在的目录,键入如下两个命令:
snmpd -unregister
snmpd -register [OPTIONS] [LISTENING ADDRESSES]
Note: Be sure to have all Service Control Panel windows closed when
unregistering, otherwise a reboot may be required to complete
the removal.
Registry Information % 注册信息
--------------------
Warning: Improper use of the registry editor can damage to your operating
system and should only be used by experienced users.
警告:注册表编辑器的不当使用会对看官的操作系统造成损害,只应由
有经验的使用者来使用。
The following registry keys are used by snmpd and snmptrapd:
下面的两个键值( registry keys)是snmpd和snmptrapd使用的:
HKLMSYSTEMCurrentControlSetServicesNet-SNMP Agent
HKLMSYSTEMCurrentControlSetServicesNet-SNMP Trap Handler
Each command line option specified when regsitering the service will be added
to the Parameters registry subkey for the service as a ParamX REG_SZ value
where X starts at 1 and increments for each additional command line option.
For example, '-Lf c:/usr/log/' would be:
每个注册服务时使用的命令行option都要添加到参数注册表子项(Parameters registry
subkey ),
形式是ParamX REG_SZ value, X从1开始,每增加一个option,就加一。如下是个例子:
HKLMSYSTEMCurrentControlSetServices
Net-SNMP Trap HandlerParametersParam1 -Lf
HKLMSYSTEMCurrentControlSetServices
Net-SNMP Trap HandlerParametersParam2 c:/usr/log/
To add additional command line switches or modify the existing ones, it is
recommended to unregister and re-register the services with the new command
line options. It is also possible to directly add or modify the ParamX values
in the registry.
要增加或者修改命令行开关项,推荐先注销,然后用新option重新注册服务。
也可以直接增加或者修改注册表中的ParamX
Note: The Parameters key is only created when there is at least one command
line option specified when registering the service so it may need to be
manually added if modifying using the registry editor.
注意:parameters项只有当至少有一个命令行option的时候才会被建立。
所以,如果使用注册表编辑器修改的话可能需要手动增加。
Notes on SET support for WIN32 ports and
acknowledgements
继续 32
***************************************************************************
*
* Notes on preprocessor defines for MSVC, MinGW and Cygwin
*
***************************************************************************
When adding Windows specific code, one or more of the following defines should
be used:
当增加windows下的代码时,下面的某些定义需要被用到
Define: Description:
------- ------------
WIN32 Defined by MSVC & MinGW
_MSC_VER Defined by MSVC only (standard MSVC macro)
mingw32 Defined by MinGW only
cygwin Defined by Cygwin only
HAVE_WIN32_PLATFORM_SDK Should be defined if the Microsoft Platform SDK is
installed and registered with MSVC or enabled for
MinGW or Cygwin
MinGW and Cygwin do not require the Microsoft Platform SDK as they both should
contain most if not all of the functionality provided by the SDK. When adding
code that requires the PSDK under MSVC, the following can usually be used:
#if defined (HAVE_WIN32_PLATFORM_SDK) || defined (mingw32) || defined (cygwin)
当在MSVC下增加需要PSDK的代码时,上面经常使用
As listed above, Cygwin does NOT define WIN32. When adding generic Windows
code that will work with MSVC, MinGW and Cygwin, the following should be used:
#if defined (WIN32) || defined (cygwin)
当增加windows下的代码,使得可以在MSVC, MinGW and Cygwin下使用时,上述代码需要使用
***************************************************************************
*
* Acknowledgements 致谢
*
***************************************************************************
These people are known to have contributed to one or more of
the Win32 platform ports. If you have, and your name is not here,
please accept our apologies, and tell us so we can add your name.
感谢:
David Perkins, Joe Marzot, Wes Hardaker, Niels Baggesen, Dave Shield,
Robert Story, Suvrit Sra, Mike Slifcak, Latha Prabhu, Nikolai Devereaux,
Alex Burger, Bernhard Penz, Andy Smith and Bart Van Assche.
如果您的名字不在其中,请接受我们的道歉并联系我们。


发布评论