Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorViktors Tjarve <viktors.tjarve@zabbix.com>2016-08-30 12:14:30 +0300
committerViktors Tjarve <viktors.tjarve@zabbix.com>2016-08-30 12:14:30 +0300
commita2d57dac7387bf04208b16484675517d63d11852 (patch)
tree04e2ba21ba10ac940af3bbd4ae1753dff4ecca37 /misc
parent29bd48bdcae848637e0e111c82ba2ad6fedf4ee8 (diff)
........S. [ZBX-10830] fixed SNMP trap to convert non-printable values from SNMPv3 to hexadecimal (viktors, zalex_ua)
[merge ^/branches/3.0 -c r62054]
Diffstat (limited to 'misc')
-rw-r--r--misc/snmptrap/zabbix_trap_receiver.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/misc/snmptrap/zabbix_trap_receiver.pl b/misc/snmptrap/zabbix_trap_receiver.pl
index 52c0f67ddfa..3dad69c7fad 100644
--- a/misc/snmptrap/zabbix_trap_receiver.pl
+++ b/misc/snmptrap/zabbix_trap_receiver.pl
@@ -87,6 +87,12 @@ sub zabbix_receiver
print OUTPUT_FILE "PDU INFO:\n";
foreach my $key(keys(%pdu_info))
{
+ if ($pdu_info{$key} !~ /^[[:print:]]*$/)
+ {
+ my $OctetAsHex = unpack('H*',$pdu_info{$key}) ; # convert octet string to hex
+ $pdu_info{$key} = "0x$OctetAsHex" ; # apply 0x prefix for consistency
+ }
+
printf OUTPUT_FILE " %-30s %s\n", $key, $pdu_info{$key};
}