从Linux命令lne发送SNMP2陷阱消息 [英] Sending SNMP2 trap message from Linux command lne

查看:112
本文介绍了从Linux命令lne发送SNMP2陷阱消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计,

我需要从Linux命令行使用此命令(snmptrap)将自定义消息发送到陷阱侦听器.我需要根据用户设置在v1和v2c中发送相同的消息.

I need to use this command (snmptrap) from Linux command line to send my custom message to a trap listener. I need to send the same message in both v1 and v2c depending on user settings.

这是我发现的东西.

对于v1:

snmptrap -v 1 -c Tas hostname 1.3.6.1.4.1.2.3 "" 6 3 1234 s s "This is a test"

以上命令有效,我在侦听器中看到以下消息.

The above command works, I see the following message in my listener.

Display of SNMPv1 trap:
community:       Tas
enterprise oid:  1.3.6.1.4.1.2.3
        .....    ibmAgents
agentAddress:    hostname
generic-trap:    enterpriseSpecific ('00000006'h)
specific-trap:   3 ('00000003'h)
time-stamp:      1234 - 12.34 seconds
varBind oid:     OBJECT_IDENTIFIER 1.3.6.1.6
        name:    snmpV2
        value:   OCTET_STRING This is a test <- Here is my message. 

我的侦听器基本上是一个AIX系统,运行以下命令.

My listener is a basically an AIX system, running the following command.

clsnmp -c public TRAP

对于v2c:我正在发出此命令.

For v2c: I am issuing this command.

snmptrap -v 2c -c "Tas" hostname '1234' 1.3.6.1.4.1.2.3 s s "This is a Test"

该命令没有给我任何错误.但是在听众上我看到了.

The command does not give me any error. But on the listener I see this.

Display of SNMPv2 trap with SNMPV2C security
community:       Tas

未显示消息这是测试".

The message "This is a Test" is not shown.

我对snmptrap命令不熟悉-也对该协议知之甚少.我已经用谷歌搜索了该命令.我的问题...

I am not familiar with snmptrap command - know very little about the protocol also. I have googled the command. My questions...

  1. v2c命令有什么问题吗?

  1. Is there anything wrong with the v2c command?

我的监听器命令有什么问题吗?让我知道是否还需要其他东西.我也可以设置Linux侦听器.

Is there anything wrong with my listener command? Let me know if I should something else. I can set up a Linux listener too.

任何建议都是最欢迎的.我想保持简单-通过snmp向主机,v1和v2c发送自定义消息,并设置一个侦听器以验证我的命令是否正常工作.

Any suggestion is most welcome. I want to keep it simple - sending a custom message over snmp to a host, v1 and v2c and set up a listener to verify that my commands are working.

非常感谢

Tas

推荐答案

命令应如下所示:

snmptrap -v 2c -c "Tas" 127.0.0.1 0 1.3.6.1.4.1.2.3 1.3.6.1.6.1.4.1.2.3.1.1.1.1.1 s "This is a Test"

请注意,作为SNMP陷阱PDU一部分的varbind(在这种情况下为"OCTET STRING")也应分配一个OID.我刚刚为此varbind使用了随机OID:1.3.6.1.6.1.4.1.2.3.1.1.1.1.1

Please note that varbind (OCTET STRING in this case) which is part of your SNMP trap PDU should also have an OID assigned. I've just used random OID for this varbind: 1.3.6.1.6.1.4.1.2.3.1.1.1.1.1

请注意,您应该根据MIB文件中的陷阱定义使用正确的OID.

Please also note that you should use proper OIDs based on trap definitions from MIB file(s).

我建议使用企业级SNMP工具发送SNMP陷阱,例如 NetDecision陷阱模拟器.该工具完全按照SNMP标准并基于MIB文件定义发出陷阱:

I'd suggest using enterprise class SNMP tools to send out SNMP traps like NetDecision Trap Simulator. This tool sends out traps in full accordance with SNMP standards and based on MIB file definitions:

这篇关于从Linux命令lne发送SNMP2陷阱消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆