gpt4 book ai didi

snmp - 什么是正确的 snmptrap 命令格式?

转载 作者:行者123 更新时间:2023-12-04 17:49:45 25 4
gpt4 key购买 nike

以下哪项是 snmptrap (net-snmp) 命令的正确格式?

snmptrap -v 2c -c public host "" NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatNotification \
netSnmpExampleHeartbeatRate i 123456

或者
snmptrap -v 2c -c public host "" NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatNotification \
netSnmpExampleHeartbeatRate.0 i 123456

即,变量绑定(bind)中是否有 .0

实际上这两种格式都有效,但哪一种是正确的,或者有什么区别?

最佳答案

这取决于陷阱中是否引用了“标量”或“表行”相关的 varbind。
http://www.net-snmp.org/wiki/index.php/TUT:snmptrap状态 :

Note that this command also includes an (OID,type,value) triple forthe varbinds listed in the VARIABLES clause (in the same way as withthe snmpset command).


表行示例。
snmptrap -v 2c -c public host:162 .1.3.6.1.6.3.1.1.5.3 .1.3.6.1.6.3.1.1.5.3    \
ifIndex i 2 ifAdminStatus i 1 ifOperStatus i 1
以供引用 :
snmptranslate -m +ALL -Pu .1.3.6.1.6.3.1.1.5.3
IF-MIB::linkDown
没有 .0在变量绑定(bind)中,因为 id 由 ifIndex 处理精确定位该行。
标量行示例。
http://www.net-snmp.org/wiki/index.php/TUT:snmptrap显示示例
snmptrap -v 1 -c public host UCD-TRAP-TEST-MIB::demotraps "" 6 17 "" \
SNMPv2-MIB::sysLocation.0 s "Just here"
'SNMPv2-MIB::sysLocation.0' 是 标量 .
不像 IF-MIB::linkDown上面的示例,它与由 标识的表行相关。 ifIndex ,这里是 .0最后的 s 精确定位标量(就像你设置它时一样)
来自原始问题的 Netsnmp 示例 mibs/NET-SNMP-EXAMPLES-MIB.txt状态
netSnmpExampleHeartbeatRate OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS accessible-for-notify
STATUS current
DESCRIPTION
"A simple integer object, to act as a payload for the
netSnmpExampleHeartbeatNotification. The value has
no real meaning, but is nominally the interval (in
seconds) between successive heartbeat notifications."
::= { netSnmpExampleNotificationObjects 1 }
即它是 不是 一个真实的、可识别的、可访问的标量,所以我建议不要 .0 .

关于snmp - 什么是正确的 snmptrap 命令格式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19947680/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com