Skip to content

Commit d8683f3

Browse files
committed
initial commit
1 parent 75eb96d commit d8683f3

28 files changed

+3427
-1
lines changed

.github/workflows/main.yml

+444
Large diffs are not rendered by default.

.github/workflows/manual.yml

+442
Large diffs are not rendered by default.

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.0.1 2021-07-08 <ryanwclark>
2+
3+

Dockerfile

+192
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
FROM debian:buster-slim
2+
LABEL maintainer="ryanwclark (github.com/ryanwclark)"
3+
4+
### Set defaults
5+
ARG FLUENTBIT_VERSION
6+
ARG S6_OVERLAY_VERSION
7+
ARG ZABBIX_VERSION
8+
ARG GO_VERSION=1.16.5
9+
10+
ENV FLUENTBIT_VERSION=${FLUENTBIT_VERSION:-"1.7.9"} \
11+
S6_OVERLAY_VERSION=${S6_OVERLAY_VERSION:-"v2.2.0.3"} \
12+
ZABBIX_VERSION=${ZABBIX_VERSION:-"5.4.2"} \
13+
CONTAINER_ENABLE_SCHEDULING=TRUE \
14+
CONTAINER_ENABLE_MESSAGING=TRUE \
15+
CONTAINER_ENABLE_MONITORING=TRUE \
16+
DEBUG_MODE=FALSE \
17+
TIMEZONE=Etc/GMT \
18+
DEBIAN_FRONTEND=noninteractive \
19+
ZABBIX_HOSTNAME=debian
20+
21+
RUN debArch=$(dpkg --print-architecture) && \
22+
case "$debArch" in \
23+
amd64) fluentbit='true' ; FLUENTBIT_BUILD_DEPS="bison cmake flex libssl-dev libsasl2-dev libsystemd-dev zlib1g-dev " ;; \
24+
*) : ;; \
25+
esac; \
26+
set -ex && \
27+
if [ $(cat /etc/os-release |grep "VERSION=" | awk 'NR>1{print $1}' RS='(' FS=')') != "jessie" ] ; then zstd=zstd; fi ; \
28+
apt-get update && \
29+
apt-get upgrade -y && \
30+
ZABBIX_BUILD_DEPS=' \
31+
autoconf \
32+
automake \
33+
autotools-dev\
34+
build-essential \
35+
g++ \
36+
pkg-config \
37+
libpcre3-dev \
38+
libssl-dev \
39+
zlib1g-dev \
40+
' && \
41+
apt-get install -y --no-install-recommends \
42+
apt-transport-https \
43+
apt-utils \
44+
aptitude \
45+
bash \
46+
ca-certificates \
47+
curl \
48+
dirmngr \
49+
dos2unix \
50+
gnupg \
51+
less \
52+
logrotate \
53+
msmtp \
54+
nano \
55+
net-tools \
56+
netcat-openbsd \
57+
procps \
58+
sudo \
59+
tzdata \
60+
vim-tiny \
61+
${zstd} \
62+
${ZABBIX_BUILD_DEPS} ${FLUENTBIT_BUILD_DEPS} \
63+
&& \
64+
\
65+
mkdir -p /usr/local/go && \
66+
echo "Downloading Go ${GO_VERSION}..." && \
67+
curl -sSL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar xvfz - --strip 1 -C /usr/local/go && \
68+
ln -sf /usr/local/go/bin/go /usr/local/bin/ && \
69+
ln -sf /usr/local/go/bin/godoc /usr/local/bin/ && \
70+
ln -sf /usr/local/go/bin/gfmt /usr/local/bin/ && \
71+
\
72+
rm -rf /etc/timezone && \
73+
ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && \
74+
echo "${TIMEZONE}" > /etc/timezone && \
75+
dpkg-reconfigure -f noninteractive tzdata && \
76+
## Zabbix Agent Install
77+
addgroup --gid 10050 zabbix && \
78+
adduser --uid 10050 \
79+
--gid 10050 \
80+
--gecos "Zabbix Agent" \
81+
--home /dev/null \
82+
--no-create-home \
83+
--shell /sbin/nologin \
84+
--disabled-login \
85+
--disabled-password \
86+
zabbix \
87+
&& \
88+
mkdir -p /etc/zabbix && \
89+
mkdir -p /etc/zabbix/zabbix_agentd.d && \
90+
mkdir -p /var/lib/zabbix && \
91+
mkdir -p /var/lib/zabbix/enc && \
92+
mkdir -p /var/lib/zabbix/modules && \
93+
chown --quiet -R zabbix:root /var/lib/zabbix && \
94+
rm -rf /etc/zabbix/zabbix-agentd.conf.d/* && \
95+
mkdir -p /usr/src/zabbix && \
96+
curl -sSLk https://github.com/zabbix/zabbix/archive/${ZABBIX_VERSION}.tar.gz | tar xfz - --strip 1 -C /usr/src/zabbix && \
97+
cd /usr/src/zabbix && \
98+
sed -i "s|{ZABBIX_REVISION}|${ZABBIX_VERSION}|g" include/version.h && \
99+
./bootstrap.sh 1>/dev/null && \
100+
export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \
101+
./configure \
102+
--prefix=/usr \
103+
--silent \
104+
--sysconfdir=/etc/zabbix \
105+
--libdir=/usr/lib/zabbix \
106+
--datadir=/usr/lib \
107+
--enable-agent \
108+
--enable-agent2 \
109+
--enable-ipv6 \
110+
--with-openssl && \
111+
make -j"$(nproc)" -s 1>/dev/null && \
112+
cp src/zabbix_agent/zabbix_agentd /usr/sbin/zabbix_agentd && \
113+
cp src/zabbix_sender/zabbix_sender /usr/sbin/zabbix_sender && \
114+
cp src/go/bin/zabbix_agent2 /usr/sbin/zabbix_agent2 && \
115+
strip /usr/sbin/zabbix_agentd && \
116+
strip /usr/sbin/zabbix_sender && \
117+
mkdir -p /etc/zabbix/zabbix_agentd.conf.d && \
118+
mkdir -p /var/log/zabbix && \
119+
chown -R zabbix:root /var/log/zabbix && \
120+
chown --quiet -R zabbix:root /etc/zabbix && \
121+
rm -rf /usr/src/zabbix && \
122+
\
123+
### Fluentbit compilation
124+
mkdir -p /usr/src/fluentbit && \
125+
curl -sSL https://github.com/fluent/fluent-bit/archive/v${FLUENTBIT_VERSION}.tar.gz | tar xfz - --strip 1 -C /usr/src/fluentbit && \
126+
cd /usr/src/fluentbit && \
127+
cmake \
128+
-DCMAKE_INSTALL_PREFIX=/usr \
129+
-DCMAKE_INSTALL_LIBDIR=lib \
130+
-DCMAKE_BUILD_TYPE=None \
131+
-DFLB_JEMALLOC=Yes \
132+
-DFLB_RELEASE=Yes \
133+
-DFLB_SIGNV4=Yes \
134+
-DFLB_BACKTRACE=No \
135+
-DFLB_HTTP_SERVER=Yes \
136+
-DFLB_EXAMPLES=No \
137+
-DFLB_IN_SERIAL=No \
138+
-DFLB_IN_SYSTEMD=No \
139+
-DFLB_IN_WINLOG=No \
140+
-DFLB_IN_WINSTAT=No \
141+
-DFLB=FLB_IN_KMSG=No \
142+
-DFLB_IN_SYSTEMD=No \
143+
-DFLB_OUT_AZURE=No \
144+
-DFLB_OUT_AZURE_BLOB=No \
145+
-DFLB_OUT_BIGQUERY=No \
146+
-DFLB_OUT_DATADOG=No \
147+
-DFLB_OUT_COUNTER=No \
148+
-DFLB_OUT_INFLUXDB=No \
149+
-DFLB_OUT_NRLOGS=No \
150+
-DFLB_OUT_LOGDNA=No \
151+
-DFLB_OUT_KAFKA=No \
152+
-DFLB_OUT_KAFKA_REST=No \
153+
-DFLB_OUT_KINESIS_FIREHOSE=No \
154+
-DFLB_OUT_KINESIS_STREAMS=No \
155+
-DFLB_OUT_PGSQL=No \
156+
-DFLB_OUT_SLACK=No \
157+
-DFLB_OUT_SPLUNK=No \
158+
. && \
159+
if [ "$debArch" = "amd64" ] ; then make -j"$(nproc)" ; make install ; mv /usr/etc/fluent-bit /etc/fluent-bit ; strip /usr/bin/fluent-bit ; if [ "$debArch" = "amd64" ] && [ "$no_upx" != "true "]; then upx /usr/bin/fluent-bit ; fi ; fi ; \
160+
\
161+
### S6 installation
162+
debArch=$(dpkg --print-architecture) && \
163+
case "$debArch" in \
164+
amd64) s6Arch='amd64' ;; \
165+
armel) s6Arch='arm' ;; \
166+
armhf) s6Arch='armhf' ;; \
167+
arm64) s6Arch='aarch64' ;; \
168+
ppc64le) s6Arch='ppc64le' ;; \
169+
*) echo >&2 "Error: unsupported architecture ($debArch)"; exit 1 ;; \
170+
esac; \
171+
curl -sSLk https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-${s6Arch}.tar.gz | tar xfz - --strip 0 -C / && \
172+
\
173+
### Cleanup
174+
mkdir -p /assets/cron && \
175+
apt-get purge -y ${ZABBIX_BUILD_DEPS} ${FLUENTBIT_BUILD_DEPS} && \
176+
apt-get autoremove -y && \
177+
apt-get clean -y && \
178+
rm -rf /usr/local/go && \
179+
rm -rf /usr/local/bin/go* && \
180+
rm -rf /usr/src/* && \
181+
rm -rf /root/go && \
182+
rm -rf /root/.cache && \
183+
rm -rf /var/lib/apt/lists/* /root/.gnupg /var/log/* /etc/logrotate.d
184+
185+
### Networking configuration
186+
EXPOSE 10050/TCP
187+
188+
### Add folders
189+
ADD install /
190+
191+
### Entrypoint configuration
192+
ENTRYPOINT ["/init"]

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2021 Ryan Clark
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)