2

We're using SNMPTT in a Nagios environment. My MIB works for all events, but 1. I can't figure out what's going on.

When a trap comes in, I want it to execute a file, which will then handle the notification and Nagios alerting.

Here's the section from the 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

My pob_translate_liebert_trap.sh file just does extra email debugging, then sends it to Nagios. Nothing really to see here.

Here's the result from the snmptt.debug log when a trap comes in matching .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

Now, if I log in as user snmptt and run this 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 it works great.

Any insight on what is breaking down from this script not running when snmptt translates it? It looks like it should be running

  • The script is not executed at all? Can SNMPTT execute something else, e.g. EXEC /bin/echo "Trap from $r received" >>/tmp/snmptt.test – L.R. Jul 18 '16 at 13:20
  • @L.R. Yeah it's exec'ing other OIDs with the same exec script fine. It's this exec block thats not working. Also, when I su to the snmptt user, i can exec it as well. – Pat Jul 19 '16 at 0:18
  • That's strange. Is there any substantial difference in environmental variables (env) when script is started by the snmptt process compared to situation when it is started manually as snmptt user? – L.R. Jul 25 '16 at 14:36
1

In my case the problem was in one of the "$*". Remove this one from parametr list and all will work fine.

This is a bug. Depends on a symbols in text of trap|oids.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.