From d1ce7b21a624fe66687dfc1bce49a670c1ce9dcb Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Mon, 8 Feb 2021 19:58:31 -0500 Subject: [PATCH 1/4] Updated snmptraps image. Fixed source IP handling and trap format --- snmptraps/alpine/Dockerfile | 5 ++- snmptraps/alpine/conf/etc/snmp/snmptrapd.conf | 26 +++++++++-- .../conf/usr/sbin/zabbix_trap_handler.sh | 43 +++++++++++++++++++ snmptraps/centos/Dockerfile | 6 ++- snmptraps/centos/conf/etc/snmp/snmptrapd.conf | 26 +++++++++-- .../conf/usr/sbin/zabbix_trap_handler.sh | 43 +++++++++++++++++++ snmptraps/ubuntu/Dockerfile | 4 +- snmptraps/ubuntu/conf/etc/snmp/snmptrapd.conf | 26 +++++++++-- .../conf/usr/sbin/zabbix_trap_handler.sh | 43 +++++++++++++++++++ 9 files changed, 206 insertions(+), 16 deletions(-) create mode 100644 snmptraps/alpine/conf/usr/sbin/zabbix_trap_handler.sh create mode 100644 snmptraps/centos/conf/usr/sbin/zabbix_trap_handler.sh create mode 100644 snmptraps/ubuntu/conf/usr/sbin/zabbix_trap_handler.sh diff --git a/snmptraps/alpine/Dockerfile b/snmptraps/alpine/Dockerfile index 9b81e884b..17be6f513 100644 --- a/snmptraps/alpine/Dockerfile +++ b/snmptraps/alpine/Dockerfile @@ -5,7 +5,8 @@ ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ - MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ + ZBX_SNMP_TRAP_DATE_FORMAT=+%Y%m%d.%H%M%S ZBX_SNMP_TRAP_FORMAT=" " LABEL org.opencontainers.image.title="zabbix-snmptraps-alpine" \ org.opencontainers.image.authors="Alexey Pustovalov " \ @@ -31,6 +32,7 @@ RUN set -eux && \ adduser zabbix root && \ apk update && \ apk add --clean-protected --no-cache \ + bash \ tzdata \ net-snmp && \ touch /var/lib/net-snmp/snmptrapd.conf && \ @@ -50,6 +52,7 @@ VOLUME ["/var/lib/zabbix/snmptraps"] COPY ["conf/etc/logrotate.d/zabbix_snmptraps", "/etc/logrotate.d/"] COPY ["conf/etc/snmp/snmptrapd.conf", "/etc/snmp/"] +COPY ["conf/usr/sbin/zabbix_trap_handler.sh", "/usr/sbin/"] USER 1997 diff --git a/snmptraps/alpine/conf/etc/snmp/snmptrapd.conf b/snmptraps/alpine/conf/etc/snmp/snmptrapd.conf index 6b6d2e31f..aa3bbf1dd 100644 --- a/snmptraps/alpine/conf/etc/snmp/snmptrapd.conf +++ b/snmptraps/alpine/conf/etc/snmp/snmptrapd.conf @@ -1,13 +1,31 @@ -snmpTrapdAddr udp:0.0.0.0:1162 +# A list of listening addresses, on which to receive incoming SNMP notifications +snmpTrapdAddr udp:1162 +snmpTrapdAddr udp6:1162 +# Do not fork from the calling shell doNotFork yes +# File in which to store the process ID of the notification receiver pidFile /tmp/snmptrapd.pid +# Disables support for the NOTIFICATION-LOG-MIB doNotRetainNotificationLogs yes authCommunity log,execute,net public disableAuthorization yes +ignoreAuthFailure yes -format1 %V\n%.4y%.2m%.2l.%.2h:%.2j:%.2k ZBXTRAP %A\n%b\n%v\n -format2 %V\n%.4y%.2m%.2l.%.2h:%.2j:%.2k ZBXTRAP %A\n%b\n%v\n +# Specify the format used for trap handle location +#format execute %B\n%b\n%V\n%v\n -[snmp] logOption f /var/lib/zabbix/snmptraps/snmptraps.log +# o - Log messages to the standard output stream. +# logOption o + +# S - Display the name of the MIB, as well as the object name (This is the default OID output format) +# T - If values are printed as Hex strings, display a printable version as well +# t - Display TimeTicks values as raw numbers +# e - Removes the symbolic labels from enumeration values +# +outputOption STte + +# Invokes the specified program (with the given arguments) whenever a notification +# is received that matches the OID token +traphandle default /bin/bash /usr/sbin/zabbix_trap_handler.sh diff --git a/snmptraps/alpine/conf/usr/sbin/zabbix_trap_handler.sh b/snmptraps/alpine/conf/usr/sbin/zabbix_trap_handler.sh new file mode 100644 index 000000000..1dcd907c2 --- /dev/null +++ b/snmptraps/alpine/conf/usr/sbin/zabbix_trap_handler.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +ZABBIX_TRAPS_FILE="/var/lib/zabbix/snmptraps/snmptraps.log" + +ZBX_SNMP_TRAP_DATE_FORMAT=${ZBX_SNMP_TRAP_DATE_FORMAT:-"+%Y%m%d.%H%M%S"} + +ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:"\n"} + +date=$(date "$ZBX_SNMP_TRAP_DATE_FORMAT") + +# The name of the host that sent the notification, as determined by gethostbyaddr(3). +# In fact this line is irrelevant and useless since snmptrapd basically attempts to +# perform reverse name lookup for the transport address (see below). +# In case of failure it will print "" +read host +# The transport address, like "[UDP: [172.16.10.12]:23456->[10.150.0.8]]" +read sender +# The first OID should always be SNMPv2-MIB::sysUpTime.0 +#read uptime +# the second should be SNMPv2-MIB::snmpTrapOID.0 +#read trapoid + +# The remaining lines will contain the payload varbind list. For SNMPv1 traps, the final OID will be SNMPv2-MIB::snmpTrapEnterprise.0. +vars= +while read oid val +do + if [ "$vars" = "" ] + then + vars="$oid = $val" + else + vars="$vars$ZBX_SNMP_TRAP_FORMAT$oid = $val" + fi + + if [[ "$oid" =~ snmpTrapAddress\.0 ]] || [[ "$oid" =~ 1\.3\.6\.1\.6\.3\.18\.1\.3\.0 ]]; then + trap_address=$val + fi +done + +[[ ${sender} =~ \[(.*?)\].*\-\> ]] && sender_addr=${BASH_REMATCH[1]} + +! [ -z $trap_address ] && sender_addr=$trap_address + +echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE diff --git a/snmptraps/centos/Dockerfile b/snmptraps/centos/Dockerfile index fbb118d71..e8d16f99b 100644 --- a/snmptraps/centos/Dockerfile +++ b/snmptraps/centos/Dockerfile @@ -5,7 +5,8 @@ ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ - MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ + ZBX_SNMP_TRAP_DATE_FORMAT=+%Y%m%d.%H%M%S ZBX_SNMP_TRAP_FORMAT=" " LABEL org.opencontainers.image.title="zabbix-snmptraps-centos" \ org.opencontainers.image.authors="Alexey Pustovalov " \ @@ -35,7 +36,7 @@ RUN set -eux && \ mkdir -p /var/lib/zabbix && \ mkdir -p /var/lib/zabbix/snmptraps && \ mkdir -p /var/lib/zabbix/mibs && \ - touch /var/lib/net-snmp/snmptrapd.conf && \ + touch /var/lib/net-snmp/snmptrapd.conf && \ chown --quiet -R zabbix:root /etc/snmp/ /var/lib/zabbix/ /var/tmp/ /var/run/ && \ chgrp -R 0 /etc/snmp/ /var/lib/zabbix/ /var/tmp/ /var/run/ && \ chmod -R g=u /etc/snmp/ /var/lib/zabbix/ /var/tmp/ /var/run/ && \ @@ -51,6 +52,7 @@ VOLUME ["/var/lib/zabbix/snmptraps"] COPY ["conf/etc/logrotate.d/zabbix_snmptraps", "/etc/logrotate.d/"] COPY ["conf/etc/snmp/snmptrapd.conf", "/etc/snmp/"] +COPY ["conf/usr/sbin/zabbix_trap_handler.sh", "/usr/sbin/"] USER 1997 diff --git a/snmptraps/centos/conf/etc/snmp/snmptrapd.conf b/snmptraps/centos/conf/etc/snmp/snmptrapd.conf index 6b6d2e31f..aa3bbf1dd 100644 --- a/snmptraps/centos/conf/etc/snmp/snmptrapd.conf +++ b/snmptraps/centos/conf/etc/snmp/snmptrapd.conf @@ -1,13 +1,31 @@ -snmpTrapdAddr udp:0.0.0.0:1162 +# A list of listening addresses, on which to receive incoming SNMP notifications +snmpTrapdAddr udp:1162 +snmpTrapdAddr udp6:1162 +# Do not fork from the calling shell doNotFork yes +# File in which to store the process ID of the notification receiver pidFile /tmp/snmptrapd.pid +# Disables support for the NOTIFICATION-LOG-MIB doNotRetainNotificationLogs yes authCommunity log,execute,net public disableAuthorization yes +ignoreAuthFailure yes -format1 %V\n%.4y%.2m%.2l.%.2h:%.2j:%.2k ZBXTRAP %A\n%b\n%v\n -format2 %V\n%.4y%.2m%.2l.%.2h:%.2j:%.2k ZBXTRAP %A\n%b\n%v\n +# Specify the format used for trap handle location +#format execute %B\n%b\n%V\n%v\n -[snmp] logOption f /var/lib/zabbix/snmptraps/snmptraps.log +# o - Log messages to the standard output stream. +# logOption o + +# S - Display the name of the MIB, as well as the object name (This is the default OID output format) +# T - If values are printed as Hex strings, display a printable version as well +# t - Display TimeTicks values as raw numbers +# e - Removes the symbolic labels from enumeration values +# +outputOption STte + +# Invokes the specified program (with the given arguments) whenever a notification +# is received that matches the OID token +traphandle default /bin/bash /usr/sbin/zabbix_trap_handler.sh diff --git a/snmptraps/centos/conf/usr/sbin/zabbix_trap_handler.sh b/snmptraps/centos/conf/usr/sbin/zabbix_trap_handler.sh new file mode 100644 index 000000000..1dcd907c2 --- /dev/null +++ b/snmptraps/centos/conf/usr/sbin/zabbix_trap_handler.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +ZABBIX_TRAPS_FILE="/var/lib/zabbix/snmptraps/snmptraps.log" + +ZBX_SNMP_TRAP_DATE_FORMAT=${ZBX_SNMP_TRAP_DATE_FORMAT:-"+%Y%m%d.%H%M%S"} + +ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:"\n"} + +date=$(date "$ZBX_SNMP_TRAP_DATE_FORMAT") + +# The name of the host that sent the notification, as determined by gethostbyaddr(3). +# In fact this line is irrelevant and useless since snmptrapd basically attempts to +# perform reverse name lookup for the transport address (see below). +# In case of failure it will print "" +read host +# The transport address, like "[UDP: [172.16.10.12]:23456->[10.150.0.8]]" +read sender +# The first OID should always be SNMPv2-MIB::sysUpTime.0 +#read uptime +# the second should be SNMPv2-MIB::snmpTrapOID.0 +#read trapoid + +# The remaining lines will contain the payload varbind list. For SNMPv1 traps, the final OID will be SNMPv2-MIB::snmpTrapEnterprise.0. +vars= +while read oid val +do + if [ "$vars" = "" ] + then + vars="$oid = $val" + else + vars="$vars$ZBX_SNMP_TRAP_FORMAT$oid = $val" + fi + + if [[ "$oid" =~ snmpTrapAddress\.0 ]] || [[ "$oid" =~ 1\.3\.6\.1\.6\.3\.18\.1\.3\.0 ]]; then + trap_address=$val + fi +done + +[[ ${sender} =~ \[(.*?)\].*\-\> ]] && sender_addr=${BASH_REMATCH[1]} + +! [ -z $trap_address ] && sender_addr=$trap_address + +echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE diff --git a/snmptraps/ubuntu/Dockerfile b/snmptraps/ubuntu/Dockerfile index 7716b7a8d..6a3e8cb31 100644 --- a/snmptraps/ubuntu/Dockerfile +++ b/snmptraps/ubuntu/Dockerfile @@ -5,7 +5,8 @@ ARG ZBX_VERSION=${MAJOR_VERSION} ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ - MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ + ZBX_SNMP_TRAP_DATE_FORMAT=+%Y%m%d.%H%M%S ZBX_SNMP_TRAP_FORMAT=" " LABEL org.opencontainers.image.title="zabbix-snmptraps-ubuntu" \ org.opencontainers.image.authors="Alexey Pustovalov " \ @@ -50,6 +51,7 @@ VOLUME ["/var/lib/zabbix/snmptraps"] COPY ["conf/etc/logrotate.d/zabbix_snmptraps", "/etc/logrotate.d/"] COPY ["conf/etc/snmp/snmptrapd.conf", "/etc/snmp/"] +COPY ["conf/usr/sbin/zabbix_trap_handler.sh", "/usr/sbin/"] USER 1997 diff --git a/snmptraps/ubuntu/conf/etc/snmp/snmptrapd.conf b/snmptraps/ubuntu/conf/etc/snmp/snmptrapd.conf index 6b6d2e31f..aa3bbf1dd 100644 --- a/snmptraps/ubuntu/conf/etc/snmp/snmptrapd.conf +++ b/snmptraps/ubuntu/conf/etc/snmp/snmptrapd.conf @@ -1,13 +1,31 @@ -snmpTrapdAddr udp:0.0.0.0:1162 +# A list of listening addresses, on which to receive incoming SNMP notifications +snmpTrapdAddr udp:1162 +snmpTrapdAddr udp6:1162 +# Do not fork from the calling shell doNotFork yes +# File in which to store the process ID of the notification receiver pidFile /tmp/snmptrapd.pid +# Disables support for the NOTIFICATION-LOG-MIB doNotRetainNotificationLogs yes authCommunity log,execute,net public disableAuthorization yes +ignoreAuthFailure yes -format1 %V\n%.4y%.2m%.2l.%.2h:%.2j:%.2k ZBXTRAP %A\n%b\n%v\n -format2 %V\n%.4y%.2m%.2l.%.2h:%.2j:%.2k ZBXTRAP %A\n%b\n%v\n +# Specify the format used for trap handle location +#format execute %B\n%b\n%V\n%v\n -[snmp] logOption f /var/lib/zabbix/snmptraps/snmptraps.log +# o - Log messages to the standard output stream. +# logOption o + +# S - Display the name of the MIB, as well as the object name (This is the default OID output format) +# T - If values are printed as Hex strings, display a printable version as well +# t - Display TimeTicks values as raw numbers +# e - Removes the symbolic labels from enumeration values +# +outputOption STte + +# Invokes the specified program (with the given arguments) whenever a notification +# is received that matches the OID token +traphandle default /bin/bash /usr/sbin/zabbix_trap_handler.sh diff --git a/snmptraps/ubuntu/conf/usr/sbin/zabbix_trap_handler.sh b/snmptraps/ubuntu/conf/usr/sbin/zabbix_trap_handler.sh new file mode 100644 index 000000000..1dcd907c2 --- /dev/null +++ b/snmptraps/ubuntu/conf/usr/sbin/zabbix_trap_handler.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +ZABBIX_TRAPS_FILE="/var/lib/zabbix/snmptraps/snmptraps.log" + +ZBX_SNMP_TRAP_DATE_FORMAT=${ZBX_SNMP_TRAP_DATE_FORMAT:-"+%Y%m%d.%H%M%S"} + +ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:"\n"} + +date=$(date "$ZBX_SNMP_TRAP_DATE_FORMAT") + +# The name of the host that sent the notification, as determined by gethostbyaddr(3). +# In fact this line is irrelevant and useless since snmptrapd basically attempts to +# perform reverse name lookup for the transport address (see below). +# In case of failure it will print "" +read host +# The transport address, like "[UDP: [172.16.10.12]:23456->[10.150.0.8]]" +read sender +# The first OID should always be SNMPv2-MIB::sysUpTime.0 +#read uptime +# the second should be SNMPv2-MIB::snmpTrapOID.0 +#read trapoid + +# The remaining lines will contain the payload varbind list. For SNMPv1 traps, the final OID will be SNMPv2-MIB::snmpTrapEnterprise.0. +vars= +while read oid val +do + if [ "$vars" = "" ] + then + vars="$oid = $val" + else + vars="$vars$ZBX_SNMP_TRAP_FORMAT$oid = $val" + fi + + if [[ "$oid" =~ snmpTrapAddress\.0 ]] || [[ "$oid" =~ 1\.3\.6\.1\.6\.3\.18\.1\.3\.0 ]]; then + trap_address=$val + fi +done + +[[ ${sender} =~ \[(.*?)\].*\-\> ]] && sender_addr=${BASH_REMATCH[1]} + +! [ -z $trap_address ] && sender_addr=$trap_address + +echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE From 3a099e7b9b144718d6137dc7a091f6c258bd6ba0 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Mon, 8 Feb 2021 20:11:50 -0500 Subject: [PATCH 2/4] Zabbix Appliance has been decommissioned --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f5454ca6f..063712bb0 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ This repository contains **Dockerfile** of [Zabbix](https://zabbix.com/) for [Do Please follow usage instructions of each Zabbix component image: * [zabbix-appliance](https://hub.docker.com/r/zabbix/zabbix-appliance/) - Zabbix appliance with built-in MySQL server, Zabbix server, Zabbix Java Gateway and Zabbix frontend based on Nginx web-server + > **Important information: Zabbix Docker Appliance has been decommissioned (except Red Hat edition) and will not be available for 3.0.31, 4.0.19, 4.4.7, 5.0.0 and newer releases. Please use a separate Docker images for each component instead of the all-in-one solution.** * [zabbix-agent](https://hub.docker.com/r/zabbix/zabbix-agent/) - Zabbix agent * [zabbix-server-mysql](https://hub.docker.com/r/zabbix/zabbix-server-mysql/) - Zabbix server with MySQL database support From 528876cc8cb43094e96259f7d942f99868089502 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Fri, 12 Feb 2021 08:14:16 -0500 Subject: [PATCH 3/4] Updated snmptraps image. Fixed source IP handling and trap format --- snmptraps/alpine/conf/usr/sbin/zabbix_trap_handler.sh | 4 ++-- snmptraps/centos/conf/usr/sbin/zabbix_trap_handler.sh | 2 +- snmptraps/ubuntu/conf/usr/sbin/zabbix_trap_handler.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/snmptraps/alpine/conf/usr/sbin/zabbix_trap_handler.sh b/snmptraps/alpine/conf/usr/sbin/zabbix_trap_handler.sh index 1dcd907c2..15c1aa6fa 100644 --- a/snmptraps/alpine/conf/usr/sbin/zabbix_trap_handler.sh +++ b/snmptraps/alpine/conf/usr/sbin/zabbix_trap_handler.sh @@ -4,7 +4,7 @@ ZABBIX_TRAPS_FILE="/var/lib/zabbix/snmptraps/snmptraps.log" ZBX_SNMP_TRAP_DATE_FORMAT=${ZBX_SNMP_TRAP_DATE_FORMAT:-"+%Y%m%d.%H%M%S"} -ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:"\n"} +ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:-" "} date=$(date "$ZBX_SNMP_TRAP_DATE_FORMAT") @@ -40,4 +40,4 @@ done ! [ -z $trap_address ] && sender_addr=$trap_address -echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE +echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$sender$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE diff --git a/snmptraps/centos/conf/usr/sbin/zabbix_trap_handler.sh b/snmptraps/centos/conf/usr/sbin/zabbix_trap_handler.sh index 1dcd907c2..96b599409 100644 --- a/snmptraps/centos/conf/usr/sbin/zabbix_trap_handler.sh +++ b/snmptraps/centos/conf/usr/sbin/zabbix_trap_handler.sh @@ -4,7 +4,7 @@ ZABBIX_TRAPS_FILE="/var/lib/zabbix/snmptraps/snmptraps.log" ZBX_SNMP_TRAP_DATE_FORMAT=${ZBX_SNMP_TRAP_DATE_FORMAT:-"+%Y%m%d.%H%M%S"} -ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:"\n"} +ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:" "} date=$(date "$ZBX_SNMP_TRAP_DATE_FORMAT") diff --git a/snmptraps/ubuntu/conf/usr/sbin/zabbix_trap_handler.sh b/snmptraps/ubuntu/conf/usr/sbin/zabbix_trap_handler.sh index 1dcd907c2..96b599409 100644 --- a/snmptraps/ubuntu/conf/usr/sbin/zabbix_trap_handler.sh +++ b/snmptraps/ubuntu/conf/usr/sbin/zabbix_trap_handler.sh @@ -4,7 +4,7 @@ ZABBIX_TRAPS_FILE="/var/lib/zabbix/snmptraps/snmptraps.log" ZBX_SNMP_TRAP_DATE_FORMAT=${ZBX_SNMP_TRAP_DATE_FORMAT:-"+%Y%m%d.%H%M%S"} -ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:"\n"} +ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:" "} date=$(date "$ZBX_SNMP_TRAP_DATE_FORMAT") From c1a435b6c7b165e2b9601dce7ff699b85e34aa8f Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Fri, 12 Feb 2021 08:24:37 -0500 Subject: [PATCH 4/4] Updated snmptraps image. Fixed source IP handling and trap format --- snmptraps/centos/conf/usr/sbin/zabbix_trap_handler.sh | 2 +- snmptraps/ubuntu/conf/usr/sbin/zabbix_trap_handler.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/snmptraps/centos/conf/usr/sbin/zabbix_trap_handler.sh b/snmptraps/centos/conf/usr/sbin/zabbix_trap_handler.sh index 96b599409..051c6f02d 100644 --- a/snmptraps/centos/conf/usr/sbin/zabbix_trap_handler.sh +++ b/snmptraps/centos/conf/usr/sbin/zabbix_trap_handler.sh @@ -4,7 +4,7 @@ ZABBIX_TRAPS_FILE="/var/lib/zabbix/snmptraps/snmptraps.log" ZBX_SNMP_TRAP_DATE_FORMAT=${ZBX_SNMP_TRAP_DATE_FORMAT:-"+%Y%m%d.%H%M%S"} -ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:" "} +ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:-" "} date=$(date "$ZBX_SNMP_TRAP_DATE_FORMAT") diff --git a/snmptraps/ubuntu/conf/usr/sbin/zabbix_trap_handler.sh b/snmptraps/ubuntu/conf/usr/sbin/zabbix_trap_handler.sh index 96b599409..051c6f02d 100644 --- a/snmptraps/ubuntu/conf/usr/sbin/zabbix_trap_handler.sh +++ b/snmptraps/ubuntu/conf/usr/sbin/zabbix_trap_handler.sh @@ -4,7 +4,7 @@ ZABBIX_TRAPS_FILE="/var/lib/zabbix/snmptraps/snmptraps.log" ZBX_SNMP_TRAP_DATE_FORMAT=${ZBX_SNMP_TRAP_DATE_FORMAT:-"+%Y%m%d.%H%M%S"} -ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:" "} +ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:-" "} date=$(date "$ZBX_SNMP_TRAP_DATE_FORMAT")