Merge master

This commit is contained in:
root 2018-05-10 16:38:07 -07:00
commit 9cbee91a1c
43 changed files with 669 additions and 43 deletions

View File

@ -234,7 +234,7 @@ services:
com.zabbix.os: "alpine"
zabbix-snmptraps:
image: zabbix/zabbix-snmptraps:ubuntu-trunk
image: zabbix/zabbix-snmptraps:alpine-trunk
ports:
- "162:162/udp"
volumes:

View File

@ -241,8 +241,8 @@ services:
com.zabbix.os: "alpine"
zabbix-snmptraps:
build: ./snmptraps/ubuntu
image: zabbix-snmptraps:ubuntu-local
build: ./snmptraps/alpine
image: zabbix-snmptraps:alpine-local
ports:
- "162:162/udp"
volumes:

View File

@ -234,7 +234,7 @@ services:
com.zabbix.os: "alpine"
zabbix-snmptraps:
image: zabbix/zabbix-snmptraps:ubuntu-trunk
image: zabbix/zabbix-snmptraps:alpine-trunk
ports:
- "162:162/udp"
volumes:

View File

@ -242,8 +242,8 @@ services:
com.zabbix.os: "alpine"
zabbix-snmptraps:
build: ./snmptraps/ubuntu
image: zabbix-snmptraps:ubuntu-local
build: ./snmptraps/alpine
image: zabbix-snmptraps:alpine-local
ports:
- "162:162/udp"
volumes:

View File

@ -234,7 +234,7 @@ services:
com.zabbix.os: "centos"
zabbix-snmptraps:
image: zabbix/zabbix-snmptraps:ubuntu-trunk
image: zabbix/zabbix-snmptraps:centos-trunk
ports:
- "162:162/udp"
volumes:

View File

@ -241,8 +241,8 @@ services:
com.zabbix.os: "centos"
zabbix-snmptraps:
build: ./snmptraps/ubuntu
image: zabbix-snmptraps:ubuntu-local
build: ./snmptraps/centos
image: zabbix-snmptraps:centos-local
ports:
- "162:162/udp"
volumes:

View File

@ -234,7 +234,7 @@ services:
com.zabbix.os: "centos"
zabbix-snmptraps:
image: zabbix/zabbix-snmptraps:ubuntu-trunk
image: zabbix/zabbix-snmptraps:centos-trunk
ports:
- "162:162/udp"
volumes:

View File

@ -242,8 +242,8 @@ services:
com.zabbix.os: "centos"
zabbix-snmptraps:
build: ./snmptraps/ubuntu
image: zabbix-snmptraps:ubuntu-local
build: ./snmptraps/centos
image: zabbix-snmptraps:centos-local
ports:
- "162:162/udp"
volumes:

View File

@ -335,7 +335,7 @@ services:
com.zabbix.os: "alpine"
zabbix-snmptraps:
image: zabbix/zabbix-snmptraps:ubuntu-trunk
image: zabbix/zabbix-snmptraps:alpine-trunk
ports:
- "162:162/udp"
volumes:

View File

@ -364,10 +364,10 @@ services:
zabbix-snmptraps:
build:
context: ./snmptraps/ubuntu
context: ./snmptraps/alpine
cache_from:
- ubuntu:trusty
image: zabbix-snmptraps:ubuntu-local
- alpine:3.7
image: zabbix-snmptraps:alpine-local
ports:
- "162:162/udp"
volumes:

View File

@ -335,7 +335,7 @@ services:
com.zabbix.os: "alpine"
zabbix-snmptraps:
image: zabbix/zabbix-snmptraps:ubuntu-trunk
image: zabbix/zabbix-snmptraps:alpine-trunk
ports:
- "162:162/udp"
volumes:

View File

@ -365,10 +365,10 @@ services:
zabbix-snmptraps:
build:
context: ./snmptraps/ubuntu
context: ./snmptraps/alpine
cache_from:
- ubuntu:trusty
image: zabbix-snmptraps:ubuntu-local
- alpine:3.7
image: zabbix-snmptraps:alpine-local
ports:
- "162:162/udp"
volumes:

View File

@ -335,7 +335,7 @@ services:
com.zabbix.os: "centos"
zabbix-snmptraps:
image: zabbix/zabbix-snmptraps:ubuntu-trunk
image: zabbix/zabbix-snmptraps:centos-trunk
ports:
- "162:162/udp"
volumes:

View File

@ -364,10 +364,10 @@ services:
zabbix-snmptraps:
build:
context: ./snmptraps/ubuntu
context: ./snmptraps/centos
cache_from:
- ubuntu:trusty
image: zabbix-snmptraps:ubuntu-local
- centos:centos7
image: zabbix-snmptraps:centos-local
ports:
- "162:162/udp"
volumes:

View File

@ -335,7 +335,7 @@ services:
com.zabbix.os: "centos"
zabbix-snmptraps:
image: zabbix/zabbix-snmptraps:ubuntu-trunk
image: zabbix/zabbix-snmptraps:centos-trunk
ports:
- "162:162/udp"
volumes:

View File

@ -343,8 +343,11 @@ services:
com.zabbix.os: "centos"
zabbix-snmptraps:
build: ./snmptraps/ubuntu
image: zabbix-snmptraps:ubuntu-local
build:
context: ./snmptraps/centos
cache_from:
- centos:centos7
image: zabbix-snmptraps:centos-local
ports:
- "162:162/udp"
volumes:

View File

@ -1,4 +1,4 @@
FROM alpine:3.4
FROM alpine:3.7
LABEL maintainer="Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
ARG BUILD_DATE

View File

@ -0,0 +1 @@
build.sh

View File

@ -0,0 +1,85 @@
FROM alpine:3.7
LABEL maintainer "Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
ARG BUILD_DATE
ARG VCS_REF
ARG APK_FLAGS_COMMON="-q"
ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache"
ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache"
ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL
LABEL org.label-schema.name="zabbix-snmptraps-alpine" \
org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix SNMP traps receiver" \
org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \
org.label-schema.license="GPL 2.0"
ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="1.14" \
org.label-schema.vcs-url="https://anonscm.debian.org/gitweb/?p=collab-maint/snmptrapfmt.git" \
org.label-schema.docker.cmd="docker run --name zabbix-snmptraps --link zabbix-server:zabbix-server -p 162:162/UDP -d zabbix-snmptraps:alpine-${ZBX_VERSION}"
STOPSIGNAL SIGTERM
COPY ["snmptrapfmt_1.14+nmu1ubuntu2.tar.gz", "/tmp/"]
RUN addgroup zabbix && \
adduser -S \
-D -G zabbix \
-h /var/lib/zabbix/ \
zabbix && \
apk update && \
apk add ${APK_FLAGS_PERSISTANT} \
net-snmp \
supervisor && \
apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
alpine-sdk \
autoconf \
automake \
libnsl-dev \
net-snmp-dev && \
mkdir -p /var/lib/zabbix && \
mkdir -p /var/lib/zabbix/snmptraps && \
mkdir -p /var/lib/zabbix/mibs && \
chown --quiet -R zabbix:root /var/lib/zabbix && \
cd /tmp/ && \
tar -zxvf snmptrapfmt_1.14+nmu1ubuntu2.tar.gz && \
ls -lah && \
cd /tmp/snmptrapfmt-1.14+nmu1ubuntu1/ && \
patch -p1 < ./patches/makefile.patch && \
make -j"$(nproc)" -s 1>/dev/null && \
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 1>/dev/null && \
rm -rf /tmp/snmptrapfmt-1.14+nmu1ubuntu1/ 1>/dev/null && \
apk del ${APK_FLAGS_COMMON} --purge \
build-dependencies && \
rm -rf /var/cache/apk/*
EXPOSE 162/UDP
WORKDIR /var/lib/zabbix/snmptraps/
VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/mibs"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["conf/etc/logrotate.d/zabbix_snmptraps", "/etc/logrotate.d/"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]

111
snmptraps/alpine/README.md Normal file
View File

@ -0,0 +1,111 @@
![logo](https://assets.zabbix.com/img/logo/zabbix_logo_500x131.png)
# What is Zabbix?
Zabbix is an enterprise-class open source distributed monitoring solution.
Zabbix is software that monitors numerous parameters of a network and the health and integrity of servers. Zabbix uses a flexible notification mechanism that allows users to configure e-mail based alerts for virtually any event. This allows a fast reaction to server problems. Zabbix offers excellent reporting and data visualisation features based on the stored data. This makes Zabbix ideal for capacity planning.
For more information and related downloads for Zabbix components, please visit https://hub.docker.com/u/zabbix/ and https://zabbix.com
# What is the image?
The image is used to receive SNMP traps, store them to a log file and provide access to Zabbix to collected SNMP trap messsages.
# Zabbix snmptraps images
These are the only official Zabbix snmptraps Docker images. They are based on Alpine Linux v3.4, Ubuntu 14.04 (trusty) and CentOS 7 images. The available versions of Zabbix snmptraps are:
Zabbix snmptraps 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest, centos-3.0-latest)
Zabbix snmptraps 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*, centos-3.0.*)
Zabbix snmptraps 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2-latest)
Zabbix snmptraps 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*, centos-3.2.*)
Zabbix snmptraps 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4-latest, alpine-latest, ubuntu-latest, centos-latest, latest)
Zabbix snmptraps 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*, centos-3.4.*)
Zabbix snmptraps 4.0 (tags: alpine-trunk, ubuntu-trunk, centos-trunk)
Images are updated when new releases are published.
# How to use this image
## Start `zabbix-snmptraps`
Start a Zabbix snmptraps container as follows:
docker run --name some-zabbix-snmptraps -d zabbix/zabbix-snmptraps:tag
Where `some-zabbix-snmptraps` is the name you want to assign to your container and `tag` is the tag specifying the version you want. See the list above for relevant tags, or look at the [full list of tags](https://hub.docker.com/r/zabbix/zabbix-snmptraps/tags/).
## Linking Zabbix server or Zabbix proxy with the container
docker run --name some-zabbix-server --link some-zabbix-snmptraps:zabbix-snmptraps --volumes-from some-zabbix-snmptraps -d zabbix/zabbix-server:tag
## Container shell access and viewing Zabbix snmptraps logs
The `docker exec` command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your `zabbix-snmptraps` container:
```console
$ docker exec -ti some-zabbix-snmptraps /bin/bash
```
The Zabbix snmptraps log is available through Docker's container log:
```console
$ docker logs some-zabbix-snmptraps
```
## Allowed volumes for the Zabbix snmptraps container
### ``/var/lib/zabbix/snmptraps``
The volume contains log file ``snmptraps.log`` named with received SNMP traps.
### ``/var/lib/zabbix/mibs``
The volume allows to add new MIB files. It does not support subdirectories, all MIBs must be placed to ``/var/lib/zabbix/mibs``.
# The image variants
The `zabbix-snmptraps` images come in many flavors, each designed for a specific use case.
## `zabbix-snmptraps:ubuntu-<version>`
This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.
## `zabbix-snmptraps:centos-<version>`
This is the defacto image also. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.
## `zabbix-snmptraps:alpine-<version>`
This image is based on the popular [Alpine Linux project](http://alpinelinux.org), available in [the `alpine` official image](https://hub.docker.com/_/alpine). Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use [musl libc](http://www.musl-libc.org) instead of [glibc and friends](http://www.etalabs.net/compare_libcs.html), so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See [this Hacker News comment thread](https://news.ycombinator.com/item?id=10782897) for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.
To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar).
# Supported Docker versions
This image is officially supported on Docker version 1.12.0.
Support for older versions (down to 1.6) is provided on a best-effort basis.
Please see [the Docker installation documentation](https://docs.docker.com/installation/) for details on how to upgrade your Docker daemon.
# User Feedback
## Documentation
Documentation for this image is stored in the [`snmptraps/` directory](https://github.com/zabbix/zabbix-docker/tree/3.0/snmptraps) of the [`zabbix/zabbix-docker` GitHub repo](https://github.com/zabbix/zabbix-docker/). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/zabbix/zabbix-docker/blob/master/README.md) before attempting a pull request.
## Issues
If you have any problems with or questions about this image, please contact us through a [GitHub issue](https://github.com/zabbix/zabbix-docker/issues).
### Known issues
## Contributing
You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.
Before you start to code, we recommend discussing your plans through a [GitHub issue](https://github.com/zabbix/zabbix-docker/issues), especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.

24
snmptraps/alpine/build.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
os=${PWD##*/}
version=$1
version=${version:-"latest"}
cd ../
app_component=${PWD##*/}
cd $os/
if [[ ! $version =~ ^[0-9]*\.[0-9]*\.[0-9]*$ ]] && [ "$version" != "latest" ]; then
echo "Incorrect syntax of the version"
exit 1
fi
if [ "$version" != "latest" ]; then
VCS_REF=`svn info svn://svn.zabbix.com/tags/$version |grep "Last Changed Rev"|awk '{print $4;}'`
fi
docker build -t zabbix-$app_component:$os-$version --build-arg VCS_REF="$VCS_REF" --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` -f Dockerfile .
#docker rm -f zabbix-$app_component
#docker run --name zabbix-$app_component -t -d zabbix-$app_component:$os-$version

View File

@ -0,0 +1,8 @@
# https://support.zabbix.com/browse/ZBX-9858
/var/lib/zabbix/snmptraps/snmptraps.log {
missingok
daily
rotate 0
minsize 50M notifempty
su zabbix zabbix
}

View File

@ -0,0 +1,32 @@
[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 -f -n -Lo -p /var/run/snmptrapd.pid -c /etc/snmp/%(program_name)s.conf
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

View File

@ -0,0 +1,35 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
critical = critical
user = root
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:///var/run/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.

View File

@ -0,0 +1 @@
build.sh

View File

@ -0,0 +1,94 @@
FROM centos:centos7
LABEL maintainer "Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
ARG BUILD_DATE
ARG VCS_REF
ARG YUM_FLAGS_COMMON="--quiet -y"
ARG YUM_FLAGS_PERSISTANT="${YUM_FLAGS_COMMON}"
ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}"
ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL
LABEL org.label-schema.name="zabbix-snmptraps-centos" \
org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix SNMP traps receiver" \
org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \
org.label-schema.license="GPL 2.0"
ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="1.14" \
org.label-schema.vcs-url="https://anonscm.debian.org/gitweb/?p=collab-maint/snmptrapfmt.git" \
org.label-schema.docker.cmd="docker run --name zabbix-snmptraps --link zabbix-server:zabbix-server -p 162:162/UDP -d zabbix-snmptraps:centos-${ZBX_VERSION}"
STOPSIGNAL SIGTERM
COPY ["snmptrapfmt_1.14+nmu1ubuntu2.tar.gz", "/tmp/"]
RUN groupadd --system zabbix && \
adduser -r --shell /sbin/nologin \
-g zabbix \
-d /var/lib/zabbix/ \
zabbix && \
yum ${YUM_FLAGS_COMMON} makecache && \
yum ${YUM_FLAGS_DEV} install epel-release && \
yum ${YUM_FLAGS_PERSISTANT} install \
net-snmp \
supervisor && \
yum ${YUM_FLAGS_PERSISTANT} install \
autoconf \
automake \
gcc \
patch \
make \
libnsl-devel \
net-snmp-devel && \
mkdir -p /var/lib/zabbix && \
mkdir -p /var/lib/zabbix/snmptraps && \
mkdir -p /var/lib/zabbix/mibs && \
chown --quiet -R zabbix:root /var/lib/zabbix && \
cd /tmp/ && \
tar -zxf snmptrapfmt_1.14+nmu1ubuntu2.tar.gz && \
ls -lah && \
cd /tmp/snmptrapfmt-1.14+nmu1ubuntu1/ && \
patch -p1 < ./patches/makefile.patch && \
make -j"$(nproc)" -s 1>/dev/null && \
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 1>/dev/null && \
rm -rf /tmp/snmptrapfmt-1.14+nmu1ubuntu1/ 1>/dev/null && \
yum history && \
yum ${YUM_FLAGS_COMMON} history undo `yum history | sed -n 4p |column -t | cut -d' ' -f1` 1>/dev/null && \
yum ${YUM_FLAGS_COMMON} clean all && \
rm -rf /etc/udev/hwdb.bin && \
rm -rf /var/cache/yum && \
rm -rf /var/lib/yum/yumdb/* && \
rm -rf /usr/lib/udev/hwdb.d/* && \
rm -rf /root/.pki && \
rm -rf /root/.subversion
EXPOSE 162/UDP
WORKDIR /var/lib/zabbix/snmptraps/
VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/mibs"]
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["conf/etc/logrotate.d/zabbix_snmptraps", "/etc/logrotate.d/"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]

111
snmptraps/centos/README.md Normal file
View File

@ -0,0 +1,111 @@
![logo](https://assets.zabbix.com/img/logo/zabbix_logo_500x131.png)
# What is Zabbix?
Zabbix is an enterprise-class open source distributed monitoring solution.
Zabbix is software that monitors numerous parameters of a network and the health and integrity of servers. Zabbix uses a flexible notification mechanism that allows users to configure e-mail based alerts for virtually any event. This allows a fast reaction to server problems. Zabbix offers excellent reporting and data visualisation features based on the stored data. This makes Zabbix ideal for capacity planning.
For more information and related downloads for Zabbix components, please visit https://hub.docker.com/u/zabbix/ and https://zabbix.com
# What is the image?
The image is used to receive SNMP traps, store them to a log file and provide access to Zabbix to collected SNMP trap messsages.
# Zabbix snmptraps images
These are the only official Zabbix snmptraps Docker images. They are based on Alpine Linux v3.4, Ubuntu 14.04 (trusty) and CentOS 7 images. The available versions of Zabbix snmptraps are:
Zabbix snmptraps 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest, centos-3.0-latest)
Zabbix snmptraps 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*, centos-3.0.*)
Zabbix snmptraps 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2-latest)
Zabbix snmptraps 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*, centos-3.2.*)
Zabbix snmptraps 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4-latest, alpine-latest, ubuntu-latest, centos-latest, latest)
Zabbix snmptraps 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*, centos-3.4.*)
Zabbix snmptraps 4.0 (tags: alpine-trunk, ubuntu-trunk, centos-trunk)
Images are updated when new releases are published.
# How to use this image
## Start `zabbix-snmptraps`
Start a Zabbix snmptraps container as follows:
docker run --name some-zabbix-snmptraps -d zabbix/zabbix-snmptraps:tag
Where `some-zabbix-snmptraps` is the name you want to assign to your container and `tag` is the tag specifying the version you want. See the list above for relevant tags, or look at the [full list of tags](https://hub.docker.com/r/zabbix/zabbix-snmptraps/tags/).
## Linking Zabbix server or Zabbix proxy with the container
docker run --name some-zabbix-server --link some-zabbix-snmptraps:zabbix-snmptraps --volumes-from some-zabbix-snmptraps -d zabbix/zabbix-server:tag
## Container shell access and viewing Zabbix snmptraps logs
The `docker exec` command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your `zabbix-snmptraps` container:
```console
$ docker exec -ti some-zabbix-snmptraps /bin/bash
```
The Zabbix snmptraps log is available through Docker's container log:
```console
$ docker logs some-zabbix-snmptraps
```
## Allowed volumes for the Zabbix snmptraps container
### ``/var/lib/zabbix/snmptraps``
The volume contains log file ``snmptraps.log`` named with received SNMP traps.
### ``/var/lib/zabbix/mibs``
The volume allows to add new MIB files. It does not support subdirectories, all MIBs must be placed to ``/var/lib/zabbix/mibs``.
# The image variants
The `zabbix-snmptraps` images come in many flavors, each designed for a specific use case.
## `zabbix-snmptraps:ubuntu-<version>`
This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.
## `zabbix-snmptraps:centos-<version>`
This is the defacto image also. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.
## `zabbix-snmptraps:alpine-<version>`
This image is based on the popular [Alpine Linux project](http://alpinelinux.org), available in [the `alpine` official image](https://hub.docker.com/_/alpine). Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use [musl libc](http://www.musl-libc.org) instead of [glibc and friends](http://www.etalabs.net/compare_libcs.html), so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See [this Hacker News comment thread](https://news.ycombinator.com/item?id=10782897) for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.
To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar).
# Supported Docker versions
This image is officially supported on Docker version 1.12.0.
Support for older versions (down to 1.6) is provided on a best-effort basis.
Please see [the Docker installation documentation](https://docs.docker.com/installation/) for details on how to upgrade your Docker daemon.
# User Feedback
## Documentation
Documentation for this image is stored in the [`snmptraps/` directory](https://github.com/zabbix/zabbix-docker/tree/3.0/snmptraps) of the [`zabbix/zabbix-docker` GitHub repo](https://github.com/zabbix/zabbix-docker/). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/zabbix/zabbix-docker/blob/master/README.md) before attempting a pull request.
## Issues
If you have any problems with or questions about this image, please contact us through a [GitHub issue](https://github.com/zabbix/zabbix-docker/issues).
### Known issues
## Contributing
You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.
Before you start to code, we recommend discussing your plans through a [GitHub issue](https://github.com/zabbix/zabbix-docker/issues), especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.

24
snmptraps/centos/build.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
os=${PWD##*/}
version=$1
version=${version:-"latest"}
cd ../
app_component=${PWD##*/}
cd $os/
if [[ ! $version =~ ^[0-9]*\.[0-9]*\.[0-9]*$ ]] && [ "$version" != "latest" ]; then
echo "Incorrect syntax of the version"
exit 1
fi
if [ "$version" != "latest" ]; then
VCS_REF=`svn info svn://svn.zabbix.com/tags/$version |grep "Last Changed Rev"|awk '{print $4;}'`
fi
docker build -t zabbix-$app_component:$os-$version --build-arg VCS_REF="$VCS_REF" --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` -f Dockerfile .
#docker rm -f zabbix-$app_component
#docker run --name zabbix-$app_component -t -d zabbix-$app_component:$os-$version

View File

@ -0,0 +1,8 @@
# https://support.zabbix.com/browse/ZBX-9858
/var/lib/zabbix/snmptraps/snmptraps.log {
missingok
daily
rotate 0
minsize 50M notifempty
su zabbix zabbix
}

View File

@ -0,0 +1,32 @@
[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 -f -n -Lo -p /var/run/snmptrapd.pid -c /etc/snmp/%(program_name)s.conf
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

View File

@ -0,0 +1,35 @@
; supervisor config file
[unix_http_server]
file = /var/run/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 = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
critical = critical
user = root
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:///var/run/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.

View File

@ -19,8 +19,8 @@ LABEL org.label-schema.name="zabbix-snmptraps-ubuntu" \
org.label-schema.schema-version="1.0" \
org.label-schema.license="GPL 2.0"
ARG MAJOR_VERSION=3.0
ARG ZBX_VERSION=${MAJOR_VERSION}.14
ARG MAJOR_VERSION=master
ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}

View File

@ -14,13 +14,15 @@ The image is used to receive SNMP traps, store them to a log file and provide ac
# Zabbix snmptraps images
These are the only official Zabbix snmptraps Docker images. They are based on trusty Ubuntu. The available versions of Zabbix snmptraps are:
These are the only official Zabbix snmptraps Docker images. They are based on Alpine Linux v3.4, Ubuntu 14.04 (trusty) and CentOS 7 images. The available versions of Zabbix snmptraps are:
Zabbix snmptraps 3.0 (tags: ubuntu-3.0-latest)
Zabbix snmptraps 3.0.* (tags: ubuntu-3.0.*)
Zabbix snmptraps 3.2 (tags: ubuntu-3.2-latest, ubuntu-latest, latest)
Zabbix snmptraps 3.2.* (tags: ubuntu-3.2.*)
Zabbix snmptraps 3.4 (tags: ubuntu-trunk)
Zabbix snmptraps 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest, centos-3.0-latest)
Zabbix snmptraps 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*, centos-3.0.*)
Zabbix snmptraps 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2-latest)
Zabbix snmptraps 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*, centos-3.2.*)
Zabbix snmptraps 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4-latest, alpine-latest, ubuntu-latest, centos-latest, latest)
Zabbix snmptraps 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*, centos-3.4.*)
Zabbix snmptraps 4.0 (tags: alpine-trunk, ubuntu-trunk, centos-trunk)
Images are updated when new releases are published.
@ -62,6 +64,26 @@ The volume contains log file ``snmptraps.log`` named with received SNMP traps.
The volume allows to add new MIB files. It does not support subdirectories, all MIBs must be placed to ``/var/lib/zabbix/mibs``.
# The image variants
The `zabbix-snmptraps` images come in many flavors, each designed for a specific use case.
## `zabbix-snmptraps:ubuntu-<version>`
This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.
## `zabbix-snmptraps:centos-<version>`
This is the defacto image also. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.
## `zabbix-snmptraps:alpine-<version>`
This image is based on the popular [Alpine Linux project](http://alpinelinux.org), available in [the `alpine` official image](https://hub.docker.com/_/alpine). Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use [musl libc](http://www.musl-libc.org) instead of [glibc and friends](http://www.etalabs.net/compare_libcs.html), so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See [this Hacker News comment thread](https://news.ycombinator.com/item?id=10782897) for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.
To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar).
# Supported Docker versions
This image is officially supported on Docker version 1.12.0.

View File

@ -1,4 +1,4 @@
FROM alpine:3.4
FROM alpine:3.7
LABEL maintainer="Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
ARG BUILD_DATE

View File

@ -1,4 +1,4 @@
FROM alpine:3.4
FROM alpine:3.7
LABEL maintainer="Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
ARG BUILD_DATE

View File

@ -1,4 +1,4 @@
FROM alpine:3.4
FROM alpine:3.7
LABEL maintainer="Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
ARG BUILD_DATE

View File

@ -1,4 +1,4 @@
FROM alpine:3.4
FROM alpine:3.7
LABEL maintainer="Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
ARG BUILD_DATE

View File

@ -84,7 +84,7 @@ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix -p 80:80 -p 10051:10051 -d zabbix:alpine-${ZBX_VERSION}"
org.label-schema.docker.cmd="docker run --name zabbix-appliance -p 80:80 -p 10051:10051 -d zabbix-appliance:alpine-${ZBX_VERSION}"
COPY ["conf/tmp/font-config", "/tmp/font-config"]

View File

@ -83,7 +83,7 @@ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix -p 80:80 -p 10051:10051 -d zabbix:centos-${ZBX_VERSION}"
org.label-schema.docker.cmd="docker run --name zabbix-appliance -p 80:80 -p 10051:10051 -d zabbix-appliance:centos-${ZBX_VERSION}"
COPY ["conf/tmp/font-config", "/tmp/font-config"]

View File

@ -96,7 +96,7 @@ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix -p 80:80 -p 10051:10051 -d zabbix:ubuntu-${ZBX_VERSION}"
org.label-schema.docker.cmd="docker run --name zabbix-appliance -p 80:80 -p 10051:10051 -d zabbix-appliance:ubuntu-${ZBX_VERSION}"
COPY ["conf/tmp/font-config", "/tmp/font-config"]