mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2024-11-28 18:53:10 +01:00
Using snmptrapd only instead of external handler
This commit is contained in:
commit
454122e87f
@ -18,13 +18,13 @@ These are the only official Zabbix Java Gateway Docker images. They are based on
|
||||
|
||||
Zabbix Java Gateway 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest, centos-3.0-latest)
|
||||
Zabbix Java Gateway 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*, centos-3.0.*)
|
||||
Zabbix Java Gateway 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2.*) (unsupported)
|
||||
Zabbix Java Gateway 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2-latest) (unsupported)
|
||||
Zabbix Java Gateway 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*, centos-3.2.*) (unsupported)
|
||||
Zabbix Java Gateway 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4.*) (unsupported)
|
||||
Zabbix Java Gateway 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4-latest) (unsupported)
|
||||
Zabbix Java Gateway 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*, centos-3.4.*) (unsupported)
|
||||
Zabbix Java Gateway 4.0 (tags: alpine-4.0-latest, ubuntu-4.0-latest, centos-4.0-latest)
|
||||
Zabbix Java Gateway 4.0.* (tags: alpine-4.0.*, ubuntu-4.0.*, centos-4.0.*)
|
||||
Zabbix Java Gateway 4.2 (tags: alpine-4.2-latest, ubuntu-4.2-latest, centos-4.2.*) (unsupported)
|
||||
Zabbix Java Gateway 4.2 (tags: alpine-4.2-latest, ubuntu-4.2-latest, centos-4.2-latest) (unsupported)
|
||||
Zabbix Java Gateway 4.2.* (tags: alpine-4.2.*, ubuntu-4.2.*, centos-4.2.*) (unsupported)
|
||||
Zabbix Java Gateway 4.4 (tags: alpine-4.4-latest, ubuntu-4.4-latest, centos-4.4-latest) (unsupported)
|
||||
Zabbix Java Gateway 4.4.* (tags: alpine-4.4.*, ubuntu-4.4.*, centos-4.4.*) (unsupported)
|
||||
|
@ -18,13 +18,13 @@ These are the only official Zabbix Java Gateway Docker images. They are based on
|
||||
|
||||
Zabbix Java Gateway 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest, centos-3.0-latest)
|
||||
Zabbix Java Gateway 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*, centos-3.0.*)
|
||||
Zabbix Java Gateway 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2.*) (unsupported)
|
||||
Zabbix Java Gateway 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2-latest) (unsupported)
|
||||
Zabbix Java Gateway 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*, centos-3.2.*) (unsupported)
|
||||
Zabbix Java Gateway 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4.*) (unsupported)
|
||||
Zabbix Java Gateway 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4-latest) (unsupported)
|
||||
Zabbix Java Gateway 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*, centos-3.4.*) (unsupported)
|
||||
Zabbix Java Gateway 4.0 (tags: alpine-4.0-latest, ubuntu-4.0-latest, centos-4.0-latest)
|
||||
Zabbix Java Gateway 4.0.* (tags: alpine-4.0.*, ubuntu-4.0.*, centos-4.0.*)
|
||||
Zabbix Java Gateway 4.2 (tags: alpine-4.2-latest, ubuntu-4.2-latest, centos-4.2.*) (unsupported)
|
||||
Zabbix Java Gateway 4.2 (tags: alpine-4.2-latest, ubuntu-4.2-latest, centos-4.2-latest) (unsupported)
|
||||
Zabbix Java Gateway 4.2.* (tags: alpine-4.2.*, ubuntu-4.2.*, centos-4.2.*) (unsupported)
|
||||
Zabbix Java Gateway 4.4 (tags: alpine-4.4-latest, ubuntu-4.4-latest, centos-4.4-latest) (unsupported)
|
||||
Zabbix Java Gateway 4.4.* (tags: alpine-4.4.*, ubuntu-4.4.*, centos-4.4.*) (unsupported)
|
||||
|
@ -18,13 +18,13 @@ These are the only official Zabbix Java Gateway Docker images. They are based on
|
||||
|
||||
Zabbix Java Gateway 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest, centos-3.0-latest)
|
||||
Zabbix Java Gateway 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*, centos-3.0.*)
|
||||
Zabbix Java Gateway 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2.*) (unsupported)
|
||||
Zabbix Java Gateway 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2-latest) (unsupported)
|
||||
Zabbix Java Gateway 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*, centos-3.2.*) (unsupported)
|
||||
Zabbix Java Gateway 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4.*) (unsupported)
|
||||
Zabbix Java Gateway 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4-latest) (unsupported)
|
||||
Zabbix Java Gateway 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*, centos-3.4.*) (unsupported)
|
||||
Zabbix Java Gateway 4.0 (tags: alpine-4.0-latest, ubuntu-4.0-latest, centos-4.0-latest)
|
||||
Zabbix Java Gateway 4.0.* (tags: alpine-4.0.*, ubuntu-4.0.*, centos-4.0.*)
|
||||
Zabbix Java Gateway 4.2 (tags: alpine-4.2-latest, ubuntu-4.2-latest, centos-4.2.*) (unsupported)
|
||||
Zabbix Java Gateway 4.2 (tags: alpine-4.2-latest, ubuntu-4.2-latest, centos-4.2-latest) (unsupported)
|
||||
Zabbix Java Gateway 4.2.* (tags: alpine-4.2.*, ubuntu-4.2.*, centos-4.2.*) (unsupported)
|
||||
Zabbix Java Gateway 4.4 (tags: alpine-4.4-latest, ubuntu-4.4-latest, centos-4.4-latest) (unsupported)
|
||||
Zabbix Java Gateway 4.4.* (tags: alpine-4.4.*, ubuntu-4.4.*, centos-4.4.*) (unsupported)
|
||||
|
@ -20,13 +20,13 @@ These are the only official Zabbix server Docker images. They are based on Alpin
|
||||
|
||||
Zabbix server 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest, centos-3.0-latest)
|
||||
Zabbix server 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*, centos-3.0.*)
|
||||
Zabbix server 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2.*) (unsupported)
|
||||
Zabbix server 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2-latest) (unsupported)
|
||||
Zabbix server 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*, centos-3.2.*) (unsupported)
|
||||
Zabbix server 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4.*) (unsupported)
|
||||
Zabbix server 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4-latest) (unsupported)
|
||||
Zabbix server 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*, centos-3.4.*) (unsupported)
|
||||
Zabbix server 4.0 (tags: alpine-4.0-latest, ubuntu-4.0-latest, centos-4.0-latest)
|
||||
Zabbix server 4.0.* (tags: alpine-4.0.*, ubuntu-4.0.*, centos-4.0.*)
|
||||
Zabbix server 4.2 (tags: alpine-4.2-latest, ubuntu-4.2-latest, centos-4.2.*) (unsupported)
|
||||
Zabbix server 4.2 (tags: alpine-4.2-latest, ubuntu-4.2-latest, centos-4.2-latest) (unsupported)
|
||||
Zabbix server 4.2.* (tags: alpine-4.2.*, ubuntu-4.2.*, centos-4.2.*) (unsupported)
|
||||
Zabbix server 4.4 (tags: alpine-4.4-latest, ubuntu-4.4-latest, centos-4.4-latest) (unsupported)
|
||||
Zabbix server 4.4.* (tags: alpine-4.4.*, ubuntu-4.4.*, centos-4.4.*) (unsupported)
|
||||
|
@ -20,13 +20,13 @@ These are the only official Zabbix server Docker images. They are based on Alpin
|
||||
|
||||
Zabbix server 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest, centos-3.0-latest)
|
||||
Zabbix server 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*, centos-3.0.*)
|
||||
Zabbix server 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2.*) (unsupported)
|
||||
Zabbix server 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2-latest) (unsupported)
|
||||
Zabbix server 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*, centos-3.2.*) (unsupported)
|
||||
Zabbix server 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4.*) (unsupported)
|
||||
Zabbix server 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4-latest) (unsupported)
|
||||
Zabbix server 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*, centos-3.4.*) (unsupported)
|
||||
Zabbix server 4.0 (tags: alpine-4.0-latest, ubuntu-4.0-latest, centos-4.0-latest)
|
||||
Zabbix server 4.0.* (tags: alpine-4.0.*, ubuntu-4.0.*, centos-4.0.*)
|
||||
Zabbix server 4.2 (tags: alpine-4.2-latest, ubuntu-4.2-latest, centos-4.2.*) (unsupported)
|
||||
Zabbix server 4.2 (tags: alpine-4.2-latest, ubuntu-4.2-latest, centos-4.2-latest) (unsupported)
|
||||
Zabbix server 4.2.* (tags: alpine-4.2.*, ubuntu-4.2.*, centos-4.2.*) (unsupported)
|
||||
Zabbix server 4.4 (tags: alpine-4.4-latest, ubuntu-4.4-latest, centos-4.4-latest) (unsupported)
|
||||
Zabbix server 4.4.* (tags: alpine-4.4.*, ubuntu-4.4.*, centos-4.4.*) (unsupported)
|
||||
|
@ -20,13 +20,13 @@ These are the only official Zabbix server Docker images. They are based on Alpin
|
||||
|
||||
Zabbix server 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest, centos-3.0-latest)
|
||||
Zabbix server 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*, centos-3.0.*)
|
||||
Zabbix server 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2.*) (unsupported)
|
||||
Zabbix server 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2-latest) (unsupported)
|
||||
Zabbix server 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*, centos-3.2.*) (unsupported)
|
||||
Zabbix server 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4.*) (unsupported)
|
||||
Zabbix server 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4-latest) (unsupported)
|
||||
Zabbix server 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*, centos-3.4.*) (unsupported)
|
||||
Zabbix server 4.0 (tags: alpine-4.0-latest, ubuntu-4.0-latest, centos-4.0-latest)
|
||||
Zabbix server 4.0.* (tags: alpine-4.0.*, ubuntu-4.0.*, centos-4.0.*)
|
||||
Zabbix server 4.2 (tags: alpine-4.2-latest, ubuntu-4.2-latest, centos-4.2.*) (unsupported)
|
||||
Zabbix server 4.2 (tags: alpine-4.2-latest, ubuntu-4.2-latest, centos-4.2-latest) (unsupported)
|
||||
Zabbix server 4.2.* (tags: alpine-4.2.*, ubuntu-4.2.*, centos-4.2.*) (unsupported)
|
||||
Zabbix server 4.4 (tags: alpine-4.4-latest, ubuntu-4.4-latest, centos-4.4-latest) (unsupported)
|
||||
Zabbix server 4.4.* (tags: alpine-4.4.*, ubuntu-4.4.*, centos-4.4.*) (unsupported)
|
||||
|
@ -11,16 +11,13 @@ LABEL org.opencontainers.image.title="zabbix-snmptraps-alpine" \
|
||||
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
|
||||
org.opencontainers.image.vendor="Zabbix LLC" \
|
||||
org.opencontainers.image.url="https://zabbix.com/" \
|
||||
org.opencontainers.image.description="Zabbix server with MySQL database support" \
|
||||
org.opencontainers.image.description="Zabbix SNMP traps receiver" \
|
||||
org.opencontainers.image.licenses="GPL v2.0" \
|
||||
org.opencontainers.image.documentation="Zabbix SNMP traps receiver" \
|
||||
org.opencontainers.image.version="${ZBX_VERSION}" \
|
||||
org.opencontainers.image.source="https://anonscm.debian.org/gitweb/?p=collab-maint/snmptrapfmt.git"
|
||||
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
|
||||
org.opencontainers.image.version="${ZBX_VERSION}"
|
||||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
COPY ["snmptrapfmt_1.14+nmu1ubuntu2.tar.gz", "/tmp/"]
|
||||
|
||||
RUN set -eux && \
|
||||
addgroup -S -g 1995 zabbix && \
|
||||
adduser -S \
|
||||
@ -31,40 +28,14 @@ RUN set -eux && \
|
||||
apk update && \
|
||||
apk add --clean-protected --no-cache \
|
||||
tzdata \
|
||||
net-snmp \
|
||||
supervisor && \
|
||||
apk add --no-cache --virtual build-dependencies \
|
||||
alpine-sdk \
|
||||
autoconf \
|
||||
automake \
|
||||
libnsl-dev \
|
||||
net-snmp-dev && \
|
||||
net-snmp && \
|
||||
touch /var/lib/net-snmp/snmptrapd.conf && \
|
||||
mkdir -p /var/lib/zabbix && \
|
||||
mkdir -p /var/lib/zabbix/snmptraps && \
|
||||
mkdir -p /var/lib/zabbix/mibs && \
|
||||
cd /tmp/ && \
|
||||
tar -zxvf snmptrapfmt_1.14+nmu1ubuntu2.tar.gz && \
|
||||
cd /tmp/snmptrapfmt-1.14+nmu1ubuntu1/ && \
|
||||
patch -p1 < ./patches/makefile.patch && \
|
||||
patch -p1 < ./patches/pid_location.patch && \
|
||||
make -j"$(nproc)" -s && \
|
||||
cp snmptrapfmthdlr /usr/sbin/snmptrapfmthdlr && \
|
||||
cp snmptrapfmt /usr/sbin/snmptrapfmt && \
|
||||
cp snmptrapfmt.conf /etc/snmp/snmptrapfmt.conf && \
|
||||
echo "disableAuthorization yes" >> "/etc/snmp/snmptrapd.conf" && \
|
||||
echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "/etc/snmp/snmptrapd.conf" && \
|
||||
sed -i \
|
||||
-e "/^VARFMT=/s/=.*/=\"%n %v \"/" \
|
||||
-e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \
|
||||
-e "/^LOGFILE=/s/=.*/=\"\/var\/lib\/zabbix\/snmptraps\/snmptraps.log\"/" \
|
||||
"/etc/snmp/snmptrapfmt.conf" && \
|
||||
rm -rf /tmp/snmptrapfmt_1.14+nmu1ubuntu2.tar.gz && \
|
||||
rm -rf /tmp/snmptrapfmt-1.14+nmu1ubuntu1/ && \
|
||||
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/ && \
|
||||
apk del --purge --no-network \
|
||||
build-dependencies && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
EXPOSE 1162/UDP
|
||||
@ -73,9 +44,9 @@ WORKDIR /var/lib/zabbix/snmptraps/
|
||||
|
||||
VOLUME ["/var/lib/zabbix/snmptraps"]
|
||||
|
||||
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
|
||||
COPY ["conf/etc/logrotate.d/zabbix_snmptraps", "/etc/logrotate.d/"]
|
||||
COPY ["conf/etc/snmp/snmptrapd.conf", "/etc/snmp/"]
|
||||
|
||||
USER 1997
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|
||||
CMD ["/usr/sbin/snmptrapd", "-n", "-C", "-c", "/etc/snmp/snmptrapd.conf", "-Lo", "-A"]
|
||||
|
13
snmptraps/alpine/conf/etc/snmp/snmptrapd.conf
Normal file
13
snmptraps/alpine/conf/etc/snmp/snmptrapd.conf
Normal file
@ -0,0 +1,13 @@
|
||||
snmpTrapdAddr udp:0.0.0.0:1162
|
||||
|
||||
doNotFork yes
|
||||
pidFile /tmp/snmptrapd.pid
|
||||
doNotRetainNotificationLogs yes
|
||||
|
||||
authCommunity log,execute,net public
|
||||
disableAuthorization 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
|
||||
|
||||
[snmp] logOption f /var/lib/zabbix/snmptraps/snmptraps.log
|
@ -1,32 +0,0 @@
|
||||
[supervisord]
|
||||
nodaemon = true
|
||||
|
||||
[program:snmptrapfmt]
|
||||
command = /usr/sbin/%(program_name)s -f /etc/snmp/%(program_name)s.conf
|
||||
auto_start = true
|
||||
autorestart = true
|
||||
priority = 50
|
||||
|
||||
startsecs=3
|
||||
startretries=3
|
||||
stopsignal=TERM
|
||||
stopwaitsecs=2
|
||||
|
||||
redirect_stderr=true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
||||
|
||||
[program:snmptrapd]
|
||||
command = /usr/sbin/%(program_name)s -m '+ALL' -M /usr/share/snmp/mibs/:/var/lib/zabbix/mibs -f -n -Lo -p /tmp/snmptrapd.pid -C -c /etc/snmp/%(program_name)s.conf udp:0.0.0.0:1162
|
||||
auto_start = true
|
||||
autorestart = true
|
||||
priority = 100
|
||||
|
||||
startsecs=3
|
||||
startretries=3
|
||||
stopsignal=TERM
|
||||
stopwaitsecs=2
|
||||
|
||||
redirect_stderr=true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
@ -1,35 +0,0 @@
|
||||
; supervisor config file
|
||||
|
||||
[unix_http_server]
|
||||
file = /tmp/supervisor.sock ; (the path to the socket file)
|
||||
chmod = 0700 ; sockef file mode (default 0700)
|
||||
username = zbx
|
||||
password = password
|
||||
|
||||
[supervisord]
|
||||
logfile = /dev/stdout ; (main log file;default $CWD/supervisord.log)
|
||||
pidfile = /tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
|
||||
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
|
||||
critical = critical
|
||||
;user = zabbix
|
||||
logfile_maxbytes = 0
|
||||
logfile_backupcount = 0
|
||||
loglevel = info
|
||||
|
||||
; the below section must remain in the config file for RPC
|
||||
; (supervisorctl/web interface) to work, additional interfaces may be
|
||||
; added by defining them in separate rpcinterface: sections
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl = unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
|
||||
|
||||
; The [include] section can just contain the "files" setting. This
|
||||
; setting can list multiple files (separated by whitespace or
|
||||
; newlines). It can also contain wildcards. The filenames are
|
||||
; interpreted as relative to this file. Included files *cannot*
|
||||
; include files themselves.
|
||||
|
||||
[include]
|
||||
files = /etc/supervisor/conf.d/*.conf
|
Binary file not shown.
@ -14,13 +14,10 @@ LABEL org.opencontainers.image.title="zabbix-snmptraps-centos" \
|
||||
org.opencontainers.image.description="Zabbix SNMP traps receiver" \
|
||||
org.opencontainers.image.licenses="GPL v2.0" \
|
||||
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
|
||||
org.opencontainers.image.version="${ZBX_VERSION}" \
|
||||
org.opencontainers.image.source="https://anonscm.debian.org/gitweb/?p=collab-maint/snmptrapfmt.git"
|
||||
org.opencontainers.image.version="${ZBX_VERSION}"
|
||||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
COPY ["snmptrapfmt_1.14+nmu1ubuntu2.tar.gz", "/tmp/"]
|
||||
|
||||
RUN set -eux && \
|
||||
groupadd -g 1995 --system zabbix && \
|
||||
adduser -r --shell /sbin/nologin \
|
||||
@ -31,42 +28,14 @@ RUN set -eux && \
|
||||
yum -y install epel-release && \
|
||||
yum -y install --setopt=tsflags=nodocs \
|
||||
tzdata \
|
||||
net-snmp \
|
||||
supervisor && \
|
||||
yum -y install --setopt=tsflags=nodocs \
|
||||
autoconf \
|
||||
automake \
|
||||
gcc \
|
||||
patch \
|
||||
make \
|
||||
libnsl-devel \
|
||||
net-snmp-devel && \
|
||||
net-snmp && \
|
||||
mkdir -p /var/lib/zabbix && \
|
||||
mkdir -p /var/lib/zabbix/snmptraps && \
|
||||
mkdir -p /var/lib/zabbix/mibs && \
|
||||
cd /tmp/ && \
|
||||
tar -zxvf snmptrapfmt_1.14+nmu1ubuntu2.tar.gz && \
|
||||
ls -lah && \
|
||||
cd /tmp/snmptrapfmt-1.14+nmu1ubuntu1/ && \
|
||||
patch -p1 < ./patches/makefile.patch && \
|
||||
patch -p1 < ./patches/pid_location.patch && \
|
||||
make -j"$(nproc)" -s && \
|
||||
cp snmptrapfmthdlr /usr/sbin/snmptrapfmthdlr && \
|
||||
cp snmptrapfmt /usr/sbin/snmptrapfmt && \
|
||||
cp snmptrapfmt.conf /etc/snmp/snmptrapfmt.conf && \
|
||||
echo "disableAuthorization yes" >> "/etc/snmp/snmptrapd.conf" && \
|
||||
echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "/etc/snmp/snmptrapd.conf" && \
|
||||
sed -i \
|
||||
-e "/^VARFMT=/s/=.*/=\"%n %v \"/" \
|
||||
-e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \
|
||||
-e "/^LOGFILE=/s/=.*/=\"\/var\/lib\/zabbix\/snmptraps\/snmptraps.log\"/" \
|
||||
"/etc/snmp/snmptrapfmt.conf" && \
|
||||
rm -rf /tmp/snmptrapfmt_1.14+nmu1ubuntu2.tar.gz && \
|
||||
rm -rf /tmp/snmptrapfmt-1.14+nmu1ubuntu1/ && \
|
||||
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/ && \
|
||||
yum -y history undo `yum -q history | sed -n 3p |column -t | cut -d' ' -f1` && \
|
||||
yum -y clean all && \
|
||||
rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \
|
||||
rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki
|
||||
@ -77,9 +46,9 @@ WORKDIR /var/lib/zabbix/snmptraps/
|
||||
|
||||
VOLUME ["/var/lib/zabbix/snmptraps"]
|
||||
|
||||
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
|
||||
COPY ["conf/etc/logrotate.d/zabbix_snmptraps", "/etc/logrotate.d/"]
|
||||
COPY ["conf/etc/snmp/snmptrapd.conf", "/etc/snmp/"]
|
||||
|
||||
USER 1997
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|
||||
CMD ["/usr/sbin/snmptrapd", "-n", "-C", "-c", "/etc/snmp/snmptrapd.conf", "-Lo", "-A"]
|
||||
|
13
snmptraps/centos/conf/etc/snmp/snmptrapd.conf
Normal file
13
snmptraps/centos/conf/etc/snmp/snmptrapd.conf
Normal file
@ -0,0 +1,13 @@
|
||||
snmpTrapdAddr udp:0.0.0.0:1162
|
||||
|
||||
doNotFork yes
|
||||
pidFile /tmp/snmptrapd.pid
|
||||
doNotRetainNotificationLogs yes
|
||||
|
||||
authCommunity log,execute,net public
|
||||
disableAuthorization 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
|
||||
|
||||
[snmp] logOption f /var/lib/zabbix/snmptraps/snmptraps.log
|
@ -1,32 +0,0 @@
|
||||
[supervisord]
|
||||
nodaemon = true
|
||||
|
||||
[program:snmptrapfmt]
|
||||
command = /usr/sbin/%(program_name)s -f /etc/snmp/%(program_name)s.conf
|
||||
auto_start = true
|
||||
autorestart = true
|
||||
priority = 50
|
||||
|
||||
startsecs=3
|
||||
startretries=3
|
||||
stopsignal=TERM
|
||||
stopwaitsecs=2
|
||||
|
||||
redirect_stderr=true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
||||
|
||||
[program:snmptrapd]
|
||||
command = /usr/sbin/%(program_name)s -m '+ALL' -M /usr/share/snmp/mibs/:/var/lib/zabbix/mibs -f -n -Lo -p /var/run/snmptrapd.pid -C -c /etc/snmp/%(program_name)s.conf udp:0.0.0.0:1162
|
||||
auto_start = true
|
||||
autorestart = true
|
||||
priority = 100
|
||||
|
||||
startsecs=3
|
||||
startretries=3
|
||||
stopsignal=TERM
|
||||
stopwaitsecs=2
|
||||
|
||||
redirect_stderr=true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
@ -1,35 +0,0 @@
|
||||
; supervisor config file
|
||||
|
||||
[unix_http_server]
|
||||
file = /tmp/supervisor.sock ; (the path to the socket file)
|
||||
chmod = 0700 ; sockef file mode (default 0700)
|
||||
username = zbx
|
||||
password = password
|
||||
|
||||
[supervisord]
|
||||
logfile = /dev/stdout ; (main log file;default $CWD/supervisord.log)
|
||||
pidfile = /tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
|
||||
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
|
||||
critical = critical
|
||||
;user = zabbix
|
||||
logfile_maxbytes = 0
|
||||
logfile_backupcount = 0
|
||||
loglevel = info
|
||||
|
||||
; the below section must remain in the config file for RPC
|
||||
; (supervisorctl/web interface) to work, additional interfaces may be
|
||||
; added by defining them in separate rpcinterface: sections
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl = unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
|
||||
|
||||
; The [include] section can just contain the "files" setting. This
|
||||
; setting can list multiple files (separated by whitespace or
|
||||
; newlines). It can also contain wildcards. The filenames are
|
||||
; interpreted as relative to this file. Included files *cannot*
|
||||
; include files themselves.
|
||||
|
||||
[include]
|
||||
files = /etc/supervisor/conf.d/*.conf
|
Binary file not shown.
@ -1,11 +1,11 @@
|
||||
FROM ubuntu:bionic
|
||||
FROM ubuntu:focal
|
||||
|
||||
ARG MAJOR_VERSION=5.0
|
||||
ARG ZBX_VERSION=${MAJOR_VERSION}.6
|
||||
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=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL
|
||||
|
||||
LABEL org.opencontainers.image.title="zabbix-snmptraps-ubuntu" \
|
||||
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
|
||||
@ -14,15 +14,12 @@ LABEL org.opencontainers.image.title="zabbix-snmptraps-ubuntu" \
|
||||
org.opencontainers.image.description="Zabbix SNMP traps receiver" \
|
||||
org.opencontainers.image.licenses="GPL v2.0" \
|
||||
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
|
||||
org.opencontainers.image.version="${ZBX_VERSION}" \
|
||||
org.opencontainers.image.source="https://anonscm.debian.org/gitweb/?p=collab-maint/snmptrapfmt.git"
|
||||
org.opencontainers.image.version="${ZBX_VERSION}"
|
||||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
COPY ["snmptrapfmt_1.14+nmu1ubuntu2.tar.gz", "/tmp/"]
|
||||
|
||||
RUN set -eux && \
|
||||
echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
|
||||
echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \
|
||||
addgroup --system --gid 1995 --quiet zabbix && \
|
||||
adduser --quiet \
|
||||
--system --disabled-login \
|
||||
@ -34,51 +31,14 @@ RUN set -eux && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \
|
||||
tzdata \
|
||||
snmp-mibs-downloader \
|
||||
snmptrapd \
|
||||
supervisor && \
|
||||
snmptrapd && \
|
||||
download-mibs && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \
|
||||
autoconf \
|
||||
automake \
|
||||
gcc \
|
||||
patch \
|
||||
make \
|
||||
libc6-dev \
|
||||
libsnmp-dev && \
|
||||
mkdir -p /var/lib/zabbix && \
|
||||
mkdir -p /var/lib/zabbix/snmptraps && \
|
||||
mkdir -p /var/lib/zabbix/mibs && \
|
||||
cd /tmp/ && \
|
||||
tar -zxvf snmptrapfmt_1.14+nmu1ubuntu2.tar.gz && \
|
||||
ls -lah && \
|
||||
cd /tmp/snmptrapfmt-1.14+nmu1ubuntu1/ && \
|
||||
patch -p1 < ./patches/makefile.patch && \
|
||||
patch -p1 < ./patches/pid_location.patch && \
|
||||
make -j"$(nproc)" -s && \
|
||||
cp snmptrapfmthdlr /usr/sbin/snmptrapfmthdlr && \
|
||||
cp snmptrapfmt /usr/sbin/snmptrapfmt && \
|
||||
cp snmptrapfmt.conf /etc/snmp/snmptrapfmt.conf && \
|
||||
echo "disableAuthorization yes" >> "/etc/snmp/snmptrapd.conf" && \
|
||||
echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "/etc/snmp/snmptrapd.conf" && \
|
||||
sed -i \
|
||||
-e "/^VARFMT=/s/=.*/=\"%n %v \"/" \
|
||||
-e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \
|
||||
-e "/^LOGFILE=/s/=.*/=\"\/var\/lib\/zabbix\/snmptraps\/snmptraps.log\"/" \
|
||||
"/etc/snmp/snmptrapfmt.conf" && \
|
||||
rm -rf /tmp/snmptrapfmt_1.14+nmu1ubuntu2.tar.gz && \
|
||||
rm -rf /tmp/snmptrapfmt-1.14+nmu1ubuntu1/ && \
|
||||
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/ && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y purge \
|
||||
autoconf \
|
||||
automake \
|
||||
gcc \
|
||||
patch \
|
||||
make \
|
||||
libc6-dev \
|
||||
libsnmp-dev && \
|
||||
apt-get -y autoremove && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
EXPOSE 1162/UDP
|
||||
@ -87,9 +47,9 @@ WORKDIR /var/lib/zabbix/snmptraps/
|
||||
|
||||
VOLUME ["/var/lib/zabbix/snmptraps"]
|
||||
|
||||
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
|
||||
COPY ["conf/etc/logrotate.d/zabbix_snmptraps", "/etc/logrotate.d/"]
|
||||
COPY ["conf/etc/snmp/snmptrapd.conf", "/etc/snmp/"]
|
||||
|
||||
USER 1997
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|
||||
CMD ["/usr/sbin/snmptrapd", "-n", "-C", "-c", "/etc/snmp/snmptrapd.conf", "-Lo", "-A"]
|
||||
|
13
snmptraps/ubuntu/conf/etc/snmp/snmptrapd.conf
Normal file
13
snmptraps/ubuntu/conf/etc/snmp/snmptrapd.conf
Normal file
@ -0,0 +1,13 @@
|
||||
snmpTrapdAddr udp:0.0.0.0:1162
|
||||
|
||||
doNotFork yes
|
||||
pidFile /tmp/snmptrapd.pid
|
||||
doNotRetainNotificationLogs yes
|
||||
|
||||
authCommunity log,execute,net public
|
||||
disableAuthorization 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
|
||||
|
||||
[snmp] logOption f /var/lib/zabbix/snmptraps/snmptraps.log
|
@ -1,32 +0,0 @@
|
||||
[supervisord]
|
||||
nodaemon = true
|
||||
|
||||
[program:snmptrapfmt]
|
||||
command = /usr/sbin/%(program_name)s -f /etc/snmp/%(program_name)s.conf
|
||||
auto_start = true
|
||||
autorestart = true
|
||||
priority = 50
|
||||
|
||||
startsecs=3
|
||||
startretries=3
|
||||
stopsignal=TERM
|
||||
stopwaitsecs=2
|
||||
|
||||
redirect_stderr=true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
||||
|
||||
[program:snmptrapd]
|
||||
command = /usr/sbin/%(program_name)s -m '+ALL' -M /usr/share/snmp/mibs:/var/lib/snmp/mibs/iana:/var/lib/snmp/mibs/ietf:/var/lib/zabbix/mibs -f -n -Lo -p /var/run/snmptrapd.pid -C -c /etc/snmp/%(program_name)s.conf udp:0.0.0.0:1162
|
||||
auto_start = true
|
||||
autorestart = true
|
||||
priority = 100
|
||||
|
||||
startsecs=3
|
||||
startretries=3
|
||||
stopsignal=TERM
|
||||
stopwaitsecs=2
|
||||
|
||||
redirect_stderr=true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
@ -1,35 +0,0 @@
|
||||
; supervisor config file
|
||||
|
||||
[unix_http_server]
|
||||
file = /tmp/supervisor.sock ; (the path to the socket file)
|
||||
chmod = 0700 ; sockef file mode (default 0700)
|
||||
username = zbx
|
||||
password = password
|
||||
|
||||
[supervisord]
|
||||
logfile = /dev/stdout ; (main log file;default $CWD/supervisord.log)
|
||||
pidfile = /tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
|
||||
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
|
||||
critical = critical
|
||||
;user = zabbix
|
||||
logfile_maxbytes = 0
|
||||
logfile_backupcount = 0
|
||||
loglevel = info
|
||||
|
||||
; the below section must remain in the config file for RPC
|
||||
; (supervisorctl/web interface) to work, additional interfaces may be
|
||||
; added by defining them in separate rpcinterface: sections
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl = unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
|
||||
|
||||
; The [include] section can just contain the "files" setting. This
|
||||
; setting can list multiple files (separated by whitespace or
|
||||
; newlines). It can also contain wildcards. The filenames are
|
||||
; interpreted as relative to this file. Included files *cannot*
|
||||
; include files themselves.
|
||||
|
||||
[include]
|
||||
files = /etc/supervisor/conf.d/*.conf
|
Binary file not shown.
@ -4,7 +4,7 @@ LABEL org.opencontainers.image.title="Zabbix web-interface (Nginx, PostgreSQL)"
|
||||
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
|
||||
org.opencontainers.image.vendor="Zabbix LLC" \
|
||||
org.opencontainers.image.url="https://zabbix.com/" \
|
||||
org.opencontainers.image.description="abbix web-interface based on Nginx web server with PostgreSQL database support" \
|
||||
org.opencontainers.image.description="Zabbix web-interface based on Nginx web server with PostgreSQL database support" \
|
||||
org.opencontainers.image.licenses="GPL v2.0"
|
||||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
Loading…
Reference in New Issue
Block a user