SNMPTT 执行不工作

SNMPTT 执行不工作

我们在 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文件只是进行额外的电子邮件调试,然后将其发送到 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

现在,如果我以用户身份登录snmptt并运行此命令:/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 翻译时此脚本无法运行的原因?看起来是应该正在运行

答案1

在我的例子中,问题出在“$*”之一上。从参数列表中删除它,一切就都正常了。

这是一个错误。取决于 trap|oids 文本中的符号。

相关内容