trapdirector icon indicating copy to clipboard operation
trapdirector copied to clipboard

Trap handler can't be created if OID in the trap contains quotes, escaped with backslash

Open ankost403 opened this issue 2 years ago • 0 comments

Get debug logs

Nothing related to trap processing is displayed in the log

Describe the bug

When I try to create a trap handler for a trap received from Ciena device, OIDs from "Additional data" aren't parsed correctly and not shown on the page. This is the example of trap data:

Trap Detail [Add a trap handler] Date Mon 06 Nov 2023 01:18:22 PM EST Source IP 10.35.10.9 Source name Source port 56838 Destination IP 10.0.9.161 Destination port 162 Numeric OID .1.3.6.1.4.1.562.29.6.1.0.301 Trap name nnExtAlarmClear Trap MIB NORTEL-ALARM-EXT-MIB Processing status unknown Status details No action Trap processing time 1.47989

Additional data Numeric OID Text OID MIB Value .1.3.6.1.2.1.1.3.0 sysUpTimeInstance DISMAN-EVENT-MIB 132:15:15:00.00 .1.3.6.1.4.1.562.29.6.2.1 nnAlarmActiveResourceId NORTEL-ALARM-EXT-MIB .0.0 .1.3.6.1.4.1.562.29.6.2.2 nnAlarmActiveDateAndTime NORTEL-ALARM-EXT-MIB "07 E7 0B 06 12 12 14 00 " .1.3.6.1.4.1.562.29.6.2.3 nnAlarmActiveDescription NORTEL-ALARM-EXT-MIB "Unable to Synchronize TOD" .1.3.6.1.4.1.562.29.6.1.1.1.1 nnExtAlarmActiveEventType NORTEL-ALARM-EXT-MIB 11 .1.3.6.1.4.1.562.29.6.1.1.1.2 nnExtAlarmActiveProbableCause NORTEL-ALARM-EXT-MIB 6219 .1.3.6.1.4.1.562.29.6.1.1.1.3 nnExtAlarmActiveAdditionalText NORTEL-ALARM-EXT-MIB "OPP01.XXXX:SP-1-41,TODSYNCFAIL,NSA,NEND,RCV,0336,0100000855,NA,0.00,TOD Server 5" .1.3.6.1.4.1.562.29.6.1.1.1.4 nnExtAlarmActiveDocumentationPointer NORTEL-ALARM-EXT-MIB "NA" .1.3.6.1.4.1.562.29.6.1.1.1.5 nnExtAlarmActiveResourceDescription NORTEL-ALARM-EXT-MIB "NA" .1.3.6.1.4.1.562.29.6.1.1.1.7 nnExtAlarmActiveSequenceNumber NORTEL-ALARM-EXT-MIB 2236 .1.3.6.1.4.1.562.68.11.1.1.1 shelfId NORTEL-OME6500-SHELF-PARAMS-MIB 1 .1.3.6.1.4.1.562.68.11.1.1.2 shelfSubId NORTEL-OME6500-SHELF-PARAMS-MIB 0 .1.3.6.1.4.1.562.68.11.1.1.3 shelfTid NORTEL-OME6500-SHELF-PARAMS-MIB ""OPP01.XXXX"" .1.3.6.1.4.1.562.68.11.1.1.4 shelfIpAddress NORTEL-OME6500-SHELF-PARAMS-MIB 10.35.10.9 .1.3.6.1.4.1.562.68.11.1.1.6 shelfSiteId NORTEL-OME6500-SHELF-PARAMS-MIB 8 .1.3.6.1.6.3.1.1.4.3.0 snmpTrapEnterprise.0 SNMPv2-MIB .1.3.6.1.4.1.562.68.11

Here is the picture: Ciena_trap_details

Next, when I start creation of a handler, OIDs from "Additional data" aren't displayed, the picture: Ciena_add_trap_handler

In browser console I see an error, that points to some quoting issue: Ciena_trap_console

But if I inspect the page code, I see all trap OIDs in the script: Ciena_trap_code_inspector

I suspect that internal quotes used in value of this OID break the parsing: .1.3.6.1.4.1.562.68.11.1.1.3 shelfTid NORTEL-OME6500-SHELF-PARAMS-MIB ""OPP01.XXXX""

Next, if I try to create a new trap handler without adding fields manually, I get just 404 Page not found. This error is visible in the browser console log shown above.

To Reproduce

Steps to reproduce the behavior: This behavior is stable for any traps received from Ciena devices

Expected behavior

To be able to create a new trap handler

Your Environment:

  • trapdirector version (in icinga web 2 : System - About): 1.0.7a

  • Icinga Web 2 version and modules (in icinga web 2 : System - About): 2.8.2

  • Icinga 2 version (icinga2 --version): 2.12.1-1

  • Operating System and version:

  • System information: Platform: CentOS Linux Platform version: 8 (Core) Kernel: Linux Kernel version: 4.18.0-147.8.1.el8_1.x86_64 Architecture: x86_64

  • Webserver, PHP versions: PHP 7.2.24 Server version: Apache/2.4.37 (centos)

Additional context

ankost403 avatar Nov 06 '23 19:11 ankost403