AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 425077
Accepted
mbrownnyc
mbrownnyc
Asked: 2012-09-07 11:46:56 +0800 CST2012-09-07 11:46:56 +0800 CST 2012-09-07 11:46:56 +0800 CST

snmptt 不翻译陷阱,即使 translate_log_trap_oid=1

  • 772

我在配置snmptt以正确转换 snmp 陷阱时遇到了一些问题。

以下是一个问题:

/etc/snmp/snmptt.conf 反映:

EVENT fgFmTrapIfChange .1.3.6.1.4.1.12356.101.6.0.1004 "Status Events" Critical
FORMAT $*
EXEC /usr/local/nagios/libexec/eventhandlers/submit_check_result $r "snmp_traps" 2 "$O: $+*" "$*"
SDESC

Trap is sent to the managing FortiManager if an interface IP is changed
Variables:
  1: fnSysSerial
  2: ifName
  3: fgManIfIp
  4: fgManIfMask
EDESC

当收到陷阱时,/var/log/messages 反映:

Sep  6 12:07:32 SNMPMANAGERHOST snmptrapd[15385]:
2012-09-06 12:07:32 <UNKNOWN>
[UDP:
[192.168.100.2]:162->[192.168.100.31]]:
#012.1.3.6.1.2.1.1.3.0 = Timeticks: (707253943) 81 days, 20:35:39.43
#011.1.3.6.1.6.3.1.1.4.1.0 = OID: .1.3.6.1.4.1.12356.101.6.0.1004
#011.1.3.6.1.4.1.12356.100.1.1.1.0 = STRING: FGTNNNNNNNNN
#011.1.3.6.1.2.1.31.1.1.1.1.10 = STRING: internal4
#011.1.3.6.1.4.1.12356.101.6.2.1.0 = IpAddress: 192.168.65.100
#011.1.3.6.1.4.1.12356.101.6.2.2.0 = IpAddress: 255.255.255.0

Sep  6 12:07:37 SNMPMANAGERHOST icinga:
EXTERNAL COMMAND:
PROCESS_SERVICE_CHECK_RESULT;
192.168.100.2;
snmp_traps;
2;
enterprises.12356.101.6.0.1004: enterprises.12356.100.1.1.1.0:FGTNNNNNNNNN ifName.10:internal4 enterprises.12356.101.6.2.1.0:192.168.65.100 enterprises.12356.101.6.2.2.0:255.255.255.0

由于该icinga条目反映了EXEC,很明显 没有翻译发生snmptt。

我已验证translate_log_trap_oid并net_snmp_perl_enable已启用snmptt.ini

使用--debug=1启动时snmptt,我在以下内容中看到--debugfile:

********** Net-SNMP version 5.05 Perl module enabled **********

主 NET-SNMP 版本报告为NET-SNMP version: 5.5.

还可以做什么来验证是否snmptt已正确配置以转换陷阱?

我已经运行snmptt-net-snmp-test以验证我已正确安装的任何 net-snmp-perl 版本都支持翻译。输出表明它确实如此。

/root/snmptt_1.3/snmptt-net-snmp-test --best_guess=2

SNMPTT Net-SNMP Test v1.0
(c) 2003 Alex Burger
http://snmptt.sourceforge.net

MIBS:RFC1213-MIB
best_guess: 2


Testing translateObj
********************

Testing: .1.3.6.1.2.1.1.1, long_names=disabled, include_module=disabled
Test passed.  Result: sysDescr

Testing: .1.3.6.1.2.1.1.1, long_names=disabled, include_module=enabled
Test passed.  Result: RFC1213-MIB::sysDescr

Testing: .1.3.6.1.2.1.1.1, long_names=enabled, include_module=disabled
Test passed.  Result: .iso.org.dod.internet.mgmt.mib-2.system.sysDescr

Testing: .1.3.6.1.2.1.1.1, long_names=enabled, include_module=enabled
Test passed.  Result: RFC1213-MIB::.iso.org.dod.internet.mgmt.mib-2.system.sysDescr

Testing: sysDescr, long_names=disabled, include_module=disabled
Test passed.  Result: .1.3.6.1.2.1.1.1

Testing: RFC1213-MIB::sysDescr, long_names=disabled, include_module=disabled
Test passed.  Result: .1.3.6.1.2.1.1.1

Testing: system.sysDescr, long_names=disabled, include_module=disabled
Test passed.  Result: .1.3.6.1.2.1.1.1

Testing: RFC1213-MIB::system.sysDescr, long_names=disabled, include_module=disabled
Test passed.  Result: .1.3.6.1.2.1.1.1

Testing: .iso.org.dod.internet.mgmt.mib-2.system.sysDescr, long_names=disabled, include_module=disabled
Test passed.  Result: .1.3.6.1.2.1.1.1


Testing getType
***************

Testing: .1.3.6.1.2.1.4.1
Test passed.  Result: INTEGER

Testing: ipForwarding
Test passed.  Result: INTEGER


Testing Description
*******************
Test passed.  Result:
-------------------------------------------------
The indication of whether this entity is acting
as an IP gateway in respect to the forwarding of
datagrams received by, but not addressed to, this
entity.  IP gateways forward datagrams.  IP hosts
do not (except those source-routed via the host).
Note that for some managed nodes, this object may
take on only a subset of the values possible.
Accordingly, it is appropriate for an agent to
return a `badValue' response if a management
station attempts to change this object to an
inappropriate value.
-------------------------------------------------

我手动检查了带有未解析定义的 MIB,并验证它是否正确链接回正确解析的定义。这是:

FORTINET-FORTIGATE-MIB.txt contains:

fgFmTrapIfChange NOTIFICATION-TYPE
    OBJECTS     { fnSysSerial, ifName, fgManIfIp, fgManIfMask }
    STATUS      current
    DESCRIPTION
        "Trap is sent to the managing FortiManager if an interface IP is changed"
    ::= { fgFmTrapPrefix 1004 }


fgFmTrapPrefix OBJECT IDENTIFIER
    ::= { fgMgmt 0 }

fgMgmt OBJECT IDENTIFIER
    ::= { fnFortiGateMib 6 }

fnFortiGateMib
    ::= { fortinet 101 }

IMPORTS
    FnBoolState, FnIndex, fnAdminEntry, fnSysSerial, fortinet
        FROM FORTINET-CORE-MIB

fortinet MODULE-IDENTITY
    ::= { enterprises 12356 }

LOOKS GOOD!!!!!
1.3.6.1.4.1.12356.101.6.0.1004

我已经用尽了所有文档,甚至在snmptt-users 邮件列表中无果而终地张贴了。

我无法证明它是MIB。

为什么会snmptt编译失败陷阱?

简单地:

  • $O = 企业.12356.101.6.0.1004
  • 当 $O 应该 = fgFmTrapIfChange

谢谢,

马特

[更新]

配置文件

snmptrapd.conf:

authCommunity log,execute,net communitystr
traphandle default /usr/bin/snmptthandler

配置文件

MIB 未被翻译的陷阱所在的地方(它被引用为 MIB)。

请注意 linkUp 和 linkDown 翻译正确。

[更新 2]

我还测试了另一个 MIB,它不是包含在 net-snmp 包中的默认 MIB,而且这个 MIB 也无法解析。

[更新 3]

如果我在 snmptt.ini 中设置以下内容:

mode = standalone

我在 snmptrapd.conf 中设置了以下内容:

traphandle default /usr/sbin/snmptt --ini=/etc/snmp/snmptt.ini

我能够按预期翻译陷阱。

这意味着/usr/sbin/snmptt用于守护进程的任何方法都可能无法访问 MIB,或者可能正在执行与描述不同的操作。snmptt.ini可能包含的文档将包含我寻求的答案。

[[ 解决方案 ]]

置入mibs_environment = ALL_snmptt.ini

描述:

# Allows you to set the MIBS environment variable used by SNMPTT
# Leave blank or comment out to have the systems enviroment settings used
# To have all MIBS processed, set to ALL
# See the snmp.conf manual page for more info.

mibs_environment = ALL必须设置为snmptt.ini即使 snmptrapd 开头-m ALL(其中ALL是包含所有 MIB [在文件中定义] 的通配符语句)。

\o。

linux
  • 1 1 个回答
  • 12650 Views

1 个回答

  • Voted
  1. Best Answer
    D.F.
    2012-09-13T12:05:44+08:002012-09-13T12:05:44+08:00

    我刚才在聊天窗口中发布了这个,但看起来你可能已经离开了。您的 snmptt.ini 文件设置了以下翻译选项:

    translate_log_trap_oid = 1
    translate_value_oids = 1
    translate_enterprise_oid_format = 1
    translate_trap_oid_format = 0
    translate_varname_oid_format = 0
    translate_integers = 1
    

    有趣的是影响 $O 值的“translate_trap_oid_format”。有效值为 0 - 4,其中 0 关闭翻译,其余列在 snmptt.ini 中 --

    Set to 0 to disable translating OID values to text (symbolic form)
    Set to 1 to translate OID values to short text (symbolic form) (eg: BuildingAlarm)
    Set to 2 to translate OID values to short text with module name (eg: UPS-MIB::BuildingAlarm)
    Set to 3 to translate OID values to long text (eg: iso...upsAlarm.BuildingAlarm)
    Set to 4 to translate OID values to long text with module name (eg:UPS-MIB::iso...upsAlarm.BuildingAlarm)
    
    • 3

相关问题

  • Linux 主机到主机迁移

  • 如何在 Linux 机器上找到有关硬件的详细信息?

  • 如何在 Linux 下监控每个进程的网络 I/O 使用情况?

  • 在 RHEL4 上修改 CUPS 中的现有打印机设置

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve