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 . "Status Events" CRITICAL
FORMAT LIEBERT CUSTOM TRAP lgpEventConditionEntryAdded
EXEC /usr/lib64/nagios/plugins/pob_translate_liebert_trap.sh $r $s $2
The device is reporting an alarm.

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 .

Processing file: #snmptt-trap-1468519738245030
Reading trap.  Current time: Thu Jul 14 14:32:38 2016

Raw trap passed from snmptrapd:
UDP: [10.redacted]:65534->[170.redacted]
. 70:4:13:32.08
. .
. 12
. .
. 70:4:13:32.05
. 10.redacted
. "public"
. .

Items passed from snmptrapd:
value 0: 10.redacted
value 1: 10.redacted
value 2: .
value 3: 70:4:13:32.08
value 4: .
value 5: .
value 6: .
value 7: 12
value 8: .
value 9: .
value 10: .
value 11: 70:4:13:32.05
value 12: .
value 13: 10.redacted
value 14: .
value 15: public
value 16: .
value 17: .
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: .
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: .
Value 4: 10.redacted
Value 5: public
Value 6: .
Value 7:
Value 8:
Value 9:
Value 10:
Agent dns name: 10.redacted
Ent Value 0 ($1): .
Ent Value 1 ($2): .
Ent Value 2 ($3): .

Exact match of trap found in EVENT hash table

Working with EVENT entry: . => 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 . with value 70:4:13:32.05
Variable . with value .
Variable . with value 12
LIEBERT CUSTOM TRAP lgpEventConditionEntryAdded
. CRITICAL "Status Events" 10.redacted - LIEBERT CUSTOM TRAP lgpEventConditionEntryAdded

EXEC line(s):
Variable . with value 70:4:13:32.05
Variable . with value .
Variable . with value 12
EXEC command:/usr/lib64/nagios/plugins/pob_translate_liebert_trap.sh 10.redacted CRITICAL .

Now, if I log in as user snmptt and run this command: /usr/lib64/nagios/plugins/pob_translate_liebert_trap.sh 10.redacted CRITICAL . 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

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.