Page 1 of 1

Can we change this information?

Posted: Wed Mar 19, 2014 12:17 am
by phyo
Hi all,

We monitored Cisco Catalyst 4510+E switch ports status via SNMP Traps. We want to edit the status information.

Image

Instead of this information, I want to show "GigabitEhternet2/2/7:UP".

Can we change it?

Thanks.

Re: Can we change this information?

Posted: Wed Mar 19, 2014 10:09 am
by sreinhardt
You can absolutely change it, that can be handled either in how the trap is interpreted in snmptt.conf with the exec line, or in the snmptrapsender.py script that ends up forwarding the trap to nagios via nagios.cmd file. However my guess is that this is a single string from the trap and would need to be regexed or something similar to mangle it how you would like.

Re: Can we change this information?

Posted: Thu Mar 20, 2014 1:27 am
by b2m
Hi,

no there is no RegEx necessary in this case. I changed my /etc/snmp/snmptt.conf to

Code: Select all

...
EVENT linkDown .1.3.6.1.6.3.1.1.5.3 "Status Events" Warning
FORMAT A linkDown trap signifies that the SNMP entity, acting in $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "Interface $2" "linkDown"
SDESC
A linkDown trap signifies that the SNMP entity, acting in
an agent role, has detected that the ifOperStatus object for
one of its communication links is about to enter the down
state from some other state (but not from the notPresent
state).  This other state is indicated by the included value
of ifOperStatus.
Variables:
  1: ifIndex
  2: ifAdminStatus
  3: ifOperStatus
EDESC
#
#
#
EVENT linkUp .1.3.6.1.6.3.1.1.5.4 "Status Events" Normal
FORMAT A linkUp trap signifies that the SNMP entity, acting in an $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "Interface $2" "linkUp"
SDESC
A linkUp trap signifies that the SNMP entity, acting in an
agent role, has detected that the ifOperStatus object for
one of its communication links left the down state and
transitioned into some other state (but not into the
notPresent state).  This other state is indicated by the
included value of ifOperStatus.
Variables:
  1: ifIndex
  2: ifAdminStatus
  3: ifOperStatus
EDESC
...
Nagios will show the traps as "linkUp / Interface TenGigE0/0/0/6" for example. We have tested this with Cisco IOS / IOS XR Switches / Routers.

Best wishes

b2m

Re: Can we change this information?

Posted: Thu Mar 20, 2014 3:37 am
by phyo
Thanks b2m.

I just followed your guide. Then the status information changed to what I want to see.
SNMP Traps Ok 2m 44s 1/1 2014-03-20 16:33:40 LinkUp / Interface GigabitEthernet2/2/6
Have a nice day!