Follow

Why does trap message dispay hex encoded string?

Normally string variables (octet string) included with a trap are displayed/rendered as ASCII characters when processed by the Traverse Message Handler.  However, should a string contain any non-printable characters then the string is displayed as hex encoded bytes.

For example, this trap (sent using the NET-SNMP command 'snmptrap') contains a string of printable characters:

snmptrap -v 2c -c public 10.10.14.218 '' .1.3.6.1.4.1.11307.10 1.3.6.1.4.1.11307.10.1 x '41 6c 65 72 74 3a 20 52 65 63 65 69 76 65 20 45 72 72 6f 72 73 20 66 6f 72 20 41 6c 6c 65 6e 74 6f 77 6e 2d 32 39 30 31 72 74 72 20 2d 20 47 69 67 61 62 69 74 45 74 68 65 72 6e 65 74 30 2f 30'

and is interpreted as such in TRAVERSE_HOME\logs\messages.log;

2015-06-01 18:36:03,259 m.MessageFilter[MessagePublisher]: (INFO \) Published Message: "date=Mon Jun 01 18:36:03 PDT 2015", "messageSourceTy
pe=externalmessage", "messageSourceCategory=trap", "sourceName=*", "sourceObjectType=device", "sourceObjectName=lnx-adrian-02", "deviceAddre
ss=10.10.15.26", "severity=Critical", "autoClear=1433210763181", "showMessage=true", "originalMessage=TRAP: 36271304 10.10.15.26 (enterprise
) .1.3.6.1.4.1.11307:10 1:enterprises.11307.10.1=Alert: Receive Errors for Allentown-2901rtr - GigabitEthernet0/0; ", "processedMessage=(ent
erprise) .1.3.6.1.4.1.11307:10 1:enterprises.11307.10.1=Alert: Receive Errors for Allentown-2901rtr - GigabitEthernet0/0; "

 

Here is another example where the string contains a least one non-printable character (0xb7):

snmptrap -v 2c -c public 10.10.14.218 '' .1.3.6.1.4.1.11307.10 1.3.6.1.4.1.11307.10.1 x '41 6c 65 72 74 3a 20 52 65 63 65 69 76 65 20 45 72 72 6f 72 73 20 66 6f 72 20 41 6c 6c 65 6e 74 6f 77 6e 2d 32 39 30 31 72 74 72 20 2d 20 47 69 67 61 62 69 74 45 74 68 65 72 6e 65 74 30 2f 30 20 b7 20 2a 2a 2a 44 4f 57 4e 4c 49 4e 4b 20 74 6f 20 52 49 56 45 52 42 45 44 20 57 41 4e 30 5f 30 2a 2a 2a 20 74 68 69 73 20 68 6f 75 72 20 69 73 20 30'

and this the corresponding entry in 'messages.log';

2015-06-01 18:26:38,511 m.MessageFilter[MessagePublisher]: (INFO \) Published Message: "date=Mon Jun 01 18:26:38 PDT 2015", "messageSourceTy
pe=externalmessage", "messageSourceCategory=trap", "sourceName=*", "sourceObjectType=device", "sourceObjectName=lnx-adrian-02", "deviceAddre
ss=10.10.15.26", "severity=Critical", "autoClear=1433210198449", "showMessage=true", "originalMessage=TRAP: 36214831 10.10.15.26 (enterprise
) .1.3.6.1.4.1.11307:10 1:enterprises.11307.10.1=Alert: Receive Errors for Allentown-2901rtr - GigabitEthernet0/0; ", "processedMessage=(ent
erprise) .1.3.6.1.4.1.11307:10 1:enterprises.11307.10.1=Alert: Receive Errors for Allentown-2901rtr - GigabitEthernet0/0; "
2015-06-01 18:34:08,297 m.InputProcessor[InputProcessor]: (INFO \) Message discarded (device on non-paired DGE): type=trap/162; name=lnx-adr
ian-01; address=10.10.15.26; message=0x41,0x6c,0x65,0x72,0x74,0x3a,0x20,0x52,0x65,0x63,0x65,0x69,0x76,0x65,0x20,0x45,0x72,0x72,0x6f,0x72,0x7
3,0x20,0x66,0x6f,0x72,0x20,0x41,0x6c,0x6c,0x65,0x6e,0x74,0x6f,0x77,0x6e,0x2d,0x32,0x39,0x30,0x31,0x72,0x74,0x72,0x20,0x2d,0x20,0x47,0x69,0x6
7,0x61,0x62,0x69,0x74,0x45,0x74,0x68,0x65,0x72,0x6e,0x65,0x74,0x30,0x2f,0x30,0x20,0xb7,0x20,0x2a,0x2a,0x2a,0x44,0x4f,0x57,0x4e,0x4c,0x49,0x4
e,0x4b,0x20,0x74,0x6f,0x20,0x52,0x49,0x56,0x45,0x52,0x42,0x45,0x44,0x20,0x57,0x41,0x4e,0x30,0x5f,0x30,0x2a,0x2a,0x2a,0x20,0x74,0x68,0x69,0x7
3,0x20,0x68,0x6f,0x75,0x72,0x20,0x69,0x73,0x20,0x30
2015-06-01 18:34:08,375 m.MessageFilter[MessagePublisher]: (INFO \) Published Message: "date=Mon Jun 01 18:34:08 PDT 2015", "messageSourceTy
pe=externalmessage", "messageSourceCategory=trap", "sourceName=*", "sourceObjectType=device", "sourceObjectName=lnx-adrian-02", "deviceAddre
ss=10.10.15.26", "severity=Ok", "autoClear=1433209448297", "showMessage=true", "originalMessage=TRAP: 36259813 10.10.15.26 (enterprise) .1.3
.6.1.4.1.11307:10 1:enterprises.11307.10.1=0x41,0x6c,0x65,0x72,0x74,0x3a,0x20,0x52,0x65,0x63,0x65,0x69,0x76,0x65,0x20,0x45,0x72,0x72,0x6f,0x
72,0x73,0x20,0x66,0x6f,0x72,0x20,0x41,0x6c,0x6c,0x65,0x6e,0x74,0x6f,0x77,0x6e,0x2d,0x32,0x39,0x30,0x31,0x72,0x74,0x72,0x20,0x2d,0x20,0x47,0x
69,0x67,0x61,0x62,0x69,0x74,0x45,0x74,0x68,0x65,0x72,0x6e,0x65,0x74,0x30,0x2f,0x30,0x20,0xb7,0x20,0x2a,0x2a,0x2a,0x44,0x4f,0x57,0x4e,0x4c,0x
49,0x4e,0x4b,0x20,0x74,0x6f,0x20,0x52,0x49,0x56,0x45,0x52,0x42,0x45,0x44,0x20,0x57,0x41,0x4e,0x30,0x5f,0x30,0x2a,0x2a,0x2a,0x20,0x74,0x68,0x
69,0x73,0x20,0x68,0x6f,0x75,0x72,0x20,0x69,0x73,0x20,0x30; ", "processedMessage=0x41,0x6c,0x65,0x72,0x74,0x3a,0x20,0x52,0x65,0x63,0x65,0x69,
0x76,0x65,0x20,0x45,0x72,0x72,0x6f,0x72,0x73,0x20,0x66,0x6f,0x72,0x20,0x41,0x6c,0x6c,0x65,0x6e,0x74,0x6f,0x77,0x6e,0x2d,0x32,0x39,0x30,0x31,
0x72,0x74,0x72,0x20,0x2d,0x20,0x47,0x69,0x67,0x61,0x62,0x69,0x74,0x45,0x74,0x68,0x65,0x72,0x6e,0x65,0x74,0x30,0x2f,0x30,0x20,0xb7,0x20,0x2a,
0x2a,0x2a,0x44,0x4f,0x57,0x4e,0x4c,0x49,0x4e,0x4b,0x20,0x74,0x6f,0x20,0x52,0x49,0x56,0x45,0x52,0x42,0x45,0x44,0x20,0x57,0x41,0x4e,0x30,0x5f,
0x30,0x2a,0x2a,0x2a,0x20,0x74,0x68,0x69,0x73,0x20,0x68,0x6f,0x75,0x72,0x20,0x69,0x73,0x20,0x30"
Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.