TrapGen 使用说明

Using Trapgen

You can download trapgen from here (there are alternative SNMP trap generators around, this is just as an example):

http://trapgen.trapreceiver.com/

Usage:

trapgen -d <destinationIpAddress:port>

-c <communityName>

-f <filename>

-g <trapType>

-h

-i <senderIP>

-m <timeout>

-o <senderOID>

-p a | h | b

-r <requestId>

-s <specificType>

-t <timestamp>

-v <oid> <type> <value>

Note: Either the -d <destination ip address> pair or the -f <input file> pair (which must contain a -d <destination ip address> pair) is mandandatory. Choosing -p will cause the trap to be printed to the screen, and will not send a trap to the specified destination.

example: trapgen -d 192.168.2.3

The above example will generate a trap that looks like this:

community: public

sender ip: current host ip

Sender OID: 1.3.6.1.4.1.2854

Trap Type: 6 (enterprise specific)

Specific Type: 1

Timestamp: system time value in timeticks

This trap will have an empty varbind list and will be sent to ip address 192.168.2.3 on port 162. The above values are the defaults (except the destination ip address 192.168.2.3). Use the various command line options to override these defaults. 

Command Line Options

-d <destinationIpAddress:port>

This mandatory parameter specifies the destination IP address for the generated trap. However, if the -p option is chosen, no trap will go to the specifed IP address. The default destination port is 162. If you want to send the trap to a different port, you can specify the new port number by following the IP address with a colon followed by the port number. For example:

trapgen -d 10.1.1.1 (Sends a trap to IP address 10.1.1.1 port 162)

trapgen -d 10.1.1.1:8162 (Sends a trap to IP address 10.1.1.1 port 8162)

-c <communityName>

An optional parameter that modifies the value of the community name from the default value of "public" to the value specified

-f <filename>

You may store the parameter information in a text file. The text file should look like a series of command line options, with each option on a separate line. For example:

–mytrapfile.txt–

-d 123.45.67.89:1025

-c private

-o 1.3.6.1.4.1.1824

-i 199.8.7.6

-g 5

-s 23

-t 12445

-v 1.3.6.1.4.1.1824.1.0.0.1 STRING This is a string (you do not need quotes)

-v 1.3.6.1.4.1.1824.1.0.0.1 COUNTER 3345556

-v 1.3.6.1.4.1.1824.1.0.0.1 GAUGE 12343212

-v 1.3.6.1.4.1.1824.1.0.0.1 INTEGER 99

-v 1.3.6.1.4.1.1824.1.0.0.1 ADDRESS 100.200.123.111

-v 1.3.6.1.4.1.1824.1.0.0.1 OID 1.2.3.4.5.6.7.8.9

-v 1.3.6.1.4.1.1824.1.0.0.1 TIMETICK 2233121

trapgen -d 10.1.1.1 -f mytrapfile.txt

In addition to the options listed in the file, the command line options will also be processed. The command line options will override the file specified options (except varbind info which will accumulate).

-g <trapType>

An optional parameter that modifies the default trap type from enterprise specific (6) to the user specified trap type. Valid trap types are:

· 0 – cold start

· 1 – warm start

· 2 – link down

· 3 – link up

· 4 – authentication failure

· 5 – egp neighbor loss

· 6 – enterprise specific

-h

Prints a help message that lists these command line parameters and options

-i <senderIP>

This modifies the default send IP address. The default value is the currnent host IP address of the machine running trapgen.

-m <timeout>

Set the value for the timeout

-o <senderOID>

This modifies the default value of the NCOMTECH enterprise OID (1.3.6.1.4.1.2854) to the value specified.

-p a | h | b

This option prints the traps generated to the screen rather than sending them to the specified IP address. This helps you to review the contents of the trap you are expecting to receive at your trap receiving program. THis option has three methods of printing: a – ASCII, h – hexidecimal, and b for both.

-r <requestId>

This option sets the request ID to a value specified by the user. This value is otherwise generated by trapgen.


-s <specificType>

This option enables the user to specify the specific type for a trap. This value is usually defined in the MIBs.

-t <timestamp>

This replaces the default value of the current system time with the value specified by the user.

-v <oid> <type> <value>

<oid> is the MIB variable object identified (oid) for the instance variable specified by this option. The oid should match a valid leaf instance, and should match the type listed in this option if you are sending a valid trap.

<TYPE> is one of the following:

· STRING

· COUNTER

· GAUGE

· INTEGER

· ADDRESS

· OID

· TIMETICK

· HEX

<value> is the value to associate in the varbind

For example:

trapgen -d 10.1.1.1 -v 1.3.6.1.4.1.1824.1.0.0.1 STRING "Very High Temperature"

Note the use of quotes ("") to enclose the text which contains spaces.

SOSSE and NSM integration – SNMP

To configure Spotlight SQL Server Enterprise to integrate with a NMS using SNMP traps generated by trapgen.exe

1. Open Spotlight and select File -> Connect

2. In Connection Manager right click on an instance of SQL Server and select Properties.

3. In Properties select Alarms

4. In Editing Alarms (select Click here to edit the default settings for all connections if required) select the relevant alarm i.e. Databases Unavailable and select Override the default settings for the rule. Select Run Program when the alarm is raised. Choose Select a Programto run. Adjust thresholds and severity as required.

5. Enter trapgen.exe and parameters in the Command Line box.

时间: 2024-08-04 06:25:20

TrapGen 使用说明的相关文章

SnmpTrap测试与学习

公司有一款产品是基于SNMP进行管理的.所以自己也就摸索着,学习点有关这方面的知识. 有关SnmpTrap的理论知识我就不做介绍了.你可以去百度中找到很多很多有关这方面的介绍.说一下自我对这方面的理解:snmp trap162其实就相当于服务器端,主要用于接收(公司产品就是一个trap).而开启SNMP161的机器就相当于客户端,主要用于发送.当客户端主动向服务器端发起请求或者报告相关的信息,此时服务器端会接收到相关的信息,然后服务器端在进行相关的处理. 我们这次试验的目的就是模拟SnmpTra

TDDL动态数据源开源-示例使用说明

TDDL动态数据源使用示例说明 环境准备 因为tddl动态数据源强依赖diamond配置中心,该依赖项目已经开源.请到http://code.taobao.org/p/diamond/src/ checkout 代码,下载使用文档(http://code.taobao.org/p/diamond/wiki/index/)按步骤部署. Jdk 1.6 安装. Mysql 5.1.x或者5.5.x 安装 Maven2  settings.xml修改(见附录) 示例使用 Tddl 动态数据源的开源代码

W3 Jmail使用说明中文版

W3 Jmail使用说明中文版 jmail.smtpmail Body : String (v3.0) 信件体,正文,使用AppendText追加内容 如:JMail.Body = "Hello world" Charset : String (v3.0) 字符集,缺省为"US-ASCII" 如:JMail.Charset = "US-ASCII" ContentTransferEncoding : String (v3.0) 指定内容传送时的编

CSS3 HSLA colors使用说明

前面我们讲一了篇关于<CSS3 HSL colors 使用说明>的文章,这里我们再说说css中别一个颜色相关的属性:CSS3 HSLA colors 其语法为: <length> <percentage> <percentage> <opacity>各个属性跟我们前说的HSL相同,有别之处是加了一个:opacity,其意思为: alpha(透明度). 取值在0到1之间:HSLA是在HSL的基础上增加一个透明度(A)的设置. 当然,HSLA 就是H

PHP Form表单验证:PHP form validator使用说明

在PHP网站开发建设中,用户注册.留言是必不可少的功能,用户提交的信息数据都是通过Form表单提交,为了保证数据的完整性.安全性,PHP Form表单验证是过滤数据的首要环节,PHP对表单提交数据的验证方式多种多样,早期一般使用Javascript对PHP表单进行验证,随着WEB2.0时代的到来,考虑到用户体验,使用Jquery Form表单验证插件是常用手法,今天我要介绍的是一个PHP表单验证类PHP form validator,其可应用于一般的PHP表单验证,也可以和第三方程序或Javas

W3 Jmail中文使用说明

      W3 Jmail 使用说明   jmail.smtpmail     Body : String        (v3.0)        信件体,正文,使用AppendText追加内容        如:JMail.Body = "Hello world"    Charset : String        (v3.0)        字符集,缺省为"US-ASCII"        如:JMail.Charset = "US-ASCII&

Jmail邮件组件使用说明及示例代码

 W3 Jmail 使用说明 jmail.smtpmail Body : String(v3.0)信件体,正文,使用AppendText追加内容如:JMail.Body = "Hello world" Charset : String(v3.0)字符集,缺省为"US-ASCII"如:JMail.Charset = "US-ASCII" ContentTransferEncoding : String(v3.0)指定内容传送时的编码方式,缺省是&q

Websharp使用说明(1)

web Websharp使用说明 前言 N层的应用软件系统,由于其众多的优点,已经成为典型的软件系统架构,也已经为广大开发人员所熟知.在一个典型的三层应用软件系统中,应用系统通常被划分成以下三个层次:数据库层.应用服务层和用户界面层.如下图所示: 其中,应用服务层集中了系统的业务逻辑的处理,因此,可以说是应用软件系统中的核心部分.软件系统的健壮性.灵活性.可重用性.可升级性和可维护性,在很大程度上取决于应用服务层的设计.因此,如何构建一个良好架构的应用服务层,是应用软件开发者需要着重解决的问题.

Hadoop webHDFS设置和使用说明

1.配置 namenode的hdfs-site.xml是必须将dfs.webhdfs.enabled属性设置为true,否则就不能使用webhdfs的LISTSTATUS.LISTFILESTATUS等需要列出文件.文件夹状态的命令,因为这些信息都是由namenode来保存的. 在namenode和一台datanode中向/etc/hadoop/conf/hdfs-site.xml中添加属性: <property> <name>dfs.webhdfs.enabled</nam