SNMPTT exec不起作用

我们在Nagios环境中使用SNMPTT。 我的MIB适用于所有事件,但是1.我无法弄清楚发生了什么。

当陷阱进来时,我希望它执行一个文件,然后处理通知和Nagios警报。

以下是MIB的部分:

EVENT lgpEventConditionEntryAdded .1.3.6.1.4.1.476.1.42.3.3.0.1 "Status Events" CRITICAL FORMAT LIEBERT CUSTOM TRAP lgpEventConditionEntryAdded EXEC /usr/lib64/nagios/plugins/pob_translate_liebert_trap.sh $r $s $2 SDESC The device is reporting an alarm. EDESC 

我的pob_translate_liebert_trap.sh文件只是额外的电子邮件debugging,然后将其发送到Nagios。 这里没有什么可看的。

这是snmptt.debug日志的结果,当一个陷阱匹配时.1.3.6.1.4.1.476.1.42.3.3.0.1

 Processing file: #snmptt-trap-1468519738245030 Reading trap. Current time: Thu Jul 14 14:32:38 2016 Raw trap passed from snmptrapd: 1468519738 <UNKNOWN> UDP: [10.redacted]:65534->[170.redacted] .1.3.6.1.2.1.1.3.0 70:4:13:32.08 .1.3.6.1.6.3.1.1.4.1.0 .1.3.6.1.4.1.476.1.42.3.3.0.1 .1.3.6.1.4.1.476.1.42.3.2.3.1.1.12 12 .1.3.6.1.4.1.476.1.42.3.2.3.1.2.12 .1.3.6.1.4.1.476.1.42.3.2.1.19 .1.3.6.1.4.1.476.1.42.3.2.3.1.3.12 70:4:13:32.05 .1.3.6.1.6.3.18.1.3.0 10.redacted .1.3.6.1.6.3.18.1.4.0 "public" .1.3.6.1.6.3.1.1.4.3.0 .1.3.6.1.4.1.476.1.42.3.3 Items passed from snmptrapd: value 0: 10.redacted value 1: 10.redacted value 2: .1.3.6.1.2.1.1.3.0 value 3: 70:4:13:32.08 value 4: .1.3.6.1.6.3.1.1.4.1.0 value 5: .1.3.6.1.4.1.476.1.42.3.3.0.1 value 6: .1.3.6.1.4.1.476.1.42.3.2.3.1.1.12 value 7: 12 value 8: .1.3.6.1.4.1.476.1.42.3.2.3.1.2.12 value 9: .1.3.6.1.4.1.476.1.42.3.2.1.19 value 10: .1.3.6.1.4.1.476.1.42.3.2.3.1.3.12 value 11: 70:4:13:32.05 value 12: .1.3.6.1.6.3.18.1.3.0 value 13: 10.redacted value 14: .1.3.6.1.6.3.18.1.4.0 value 15: public value 16: .1.3.6.1.6.3.1.1.4.3.0 value 17: .1.3.6.1.4.1.476.1.42.3.3 Host IP address (10.redacted) could not be resolved by DNS. Variable $r / $R etc will use the IP address Agent IP address (10.redacted) is the same as the host IP, so copying the host name: 10.redacted Trap received from 10.redacted: .1.3.6.1.4.1.476.1.42.3.3.0.1 0: hostname 1: ip address 2: uptime 3: trapname / OID 4: ip address from trap agent 5: trap community string 6: enterprise 7: securityEngineID (snmptthandler-embedded required) 8: securityName (snmptthandler-embedded required) 9: contextEngineID (snmptthandler-embedded required) 10: contextName (snmptthandler-embedded required) 0+: passed variables Value 0: 10.redacted Value 1: 10.redacted Value 2: 70:4:13:32.08 Value 3: .1.3.6.1.4.1.476.1.42.3.3.0.1 Value 4: 10.redacted Value 5: public Value 6: .1.3.6.1.4.1.476.1.42.3.3 Value 7: Value 8: Value 9: Value 10: Agent dns name: 10.redacted Ent Value 0 ($1): .1.3.6.1.4.1.476.1.42.3.2.3.1.1.12=12 Ent Value 1 ($2): .1.3.6.1.4.1.476.1.42.3.2.3.1.2.12=.1.3.6.1.4.1.476.1.42.3.2.1.19 Ent Value 2 ($3): .1.3.6.1.4.1.476.1.42.3.2.3.1.3.12=70:4:13:32.05 Exact match of trap found in EVENT hash table Working with EVENT entry: .1.3.6.1.4.1.476.1.42.3.3.0.1 => lgpEventConditionEntryAdded,Status Events,CRITICAL, No nodes defined for this entry so all nodes will match No MATCH entries defined for this entry Trap defined, processing... PREEXEC line(s): FORMAT line: Variable .1.3.6.1.4.1.476.1.42.3.2.3.1.3.12 with value 70:4:13:32.05 Variable .1.3.6.1.4.1.476.1.42.3.2.3.1.2.12 with value .1.3.6.1.4.1.476.1.42.3.2.1.19 Variable .1.3.6.1.4.1.476.1.42.3.2.3.1.1.12 with value 12 LIEBERT CUSTOM TRAP lgpEventConditionEntryAdded .1.3.6.1.4.1.476.1.42.3.3.0.1 CRITICAL "Status Events" 10.redacted - LIEBERT CUSTOM TRAP lgpEventConditionEntryAdded EXEC line(s): Variable .1.3.6.1.4.1.476.1.42.3.2.3.1.3.12 with value 70:4:13:32.05 Variable .1.3.6.1.4.1.476.1.42.3.2.3.1.2.12 with value .1.3.6.1.4.1.476.1.42.3.2.1.19 Variable .1.3.6.1.4.1.476.1.42.3.2.3.1.1.12 with value 12 EXEC command:/usr/lib64/nagios/plugins/pob_translate_liebert_trap.sh 10.redacted CRITICAL .1.3.6.1.4.1.476.1.42.3.2.1.19 

现在,如果我以用户snmpttlogin并运行以下命令: /usr/lib64/nagios/plugins/pob_translate_liebert_trap.sh 10.redacted CRITICAL .1.3.6.1.4.1.476.1.42.3.2.1.19它工作的很好。

当snmptt翻译它时,有什么洞察力从这个脚本中分解出来? 它看起来应该是运行