mirror of
https://github.com/librenms/docker.git
synced 2026-01-23 10:15:22 +00:00
rrdcached sidecar/included.
This commit is contained in:
parent
fcbfee1b58
commit
4fc86317c8
4 changed files with 79 additions and 2 deletions
|
|
@ -60,6 +60,7 @@ RUN apk --update --no-cache add \
|
|||
python3 \
|
||||
py3-pip \
|
||||
rrdtool \
|
||||
rrdtool-cached \
|
||||
runit \
|
||||
shadow \
|
||||
syslog-ng=3.30.1-r4 \
|
||||
|
|
@ -109,7 +110,7 @@ RUN apk --update --no-cache add -t build-dependencies \
|
|||
linux-headers \
|
||||
musl-dev \
|
||||
python3-dev \
|
||||
&& git clone --branch ${LIBRENMS_VERSION} https://github.com/librenms/librenms.git . \
|
||||
&& git clone --depth 1 --branch ${LIBRENMS_VERSION} https://github.com/librenms/librenms.git . \
|
||||
&& pip3 install --ignore-installed -r requirements.txt --upgrade \
|
||||
&& COMPOSER_CACHE_DIR="/tmp" composer install --no-dev --no-interaction --no-ansi \
|
||||
&& mkdir config.d \
|
||||
|
|
@ -129,7 +130,7 @@ RUN apk --update --no-cache add -t build-dependencies \
|
|||
|
||||
COPY rootfs /
|
||||
|
||||
EXPOSE 8000 514 514/udp 162 162/udp
|
||||
EXPOSE 8000 42217 514 514/udp 162 162/udp
|
||||
VOLUME [ "/data" ]
|
||||
|
||||
ENTRYPOINT [ "/init" ]
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ services:
|
|||
- "DB_USER=${MYSQL_USER}"
|
||||
- "DB_PASSWORD=${MYSQL_PASSWORD}"
|
||||
- "DB_TIMEOUT=60"
|
||||
- "RRDCACHED_SERVER=rrdcached:42217"
|
||||
- "REDIS_HOST=redis"
|
||||
- "REDIS_PORT=6379"
|
||||
- "REDIS_DB=0"
|
||||
|
|
@ -89,6 +90,7 @@ services:
|
|||
- "DB_USER=${MYSQL_USER}"
|
||||
- "DB_PASSWORD=${MYSQL_PASSWORD}"
|
||||
- "DB_TIMEOUT=60"
|
||||
- "RRDCACHED_SERVER=rrdcached:42217"
|
||||
- "DISPATCHER_NODE_ID=dispatcher1"
|
||||
- "REDIS_HOST=redis"
|
||||
- "REDIS_PORT=6379"
|
||||
|
|
@ -162,3 +164,28 @@ services:
|
|||
- "DB_TIMEOUT=60"
|
||||
- "SIDECAR_SNMPTRAPD=1"
|
||||
restart: always
|
||||
|
||||
rrdcached:
|
||||
image: librenms/librenms:latest
|
||||
container_name: librenms_rrdcached
|
||||
hostname: librenms-rrdcached
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
- NET_RAW
|
||||
depends_on:
|
||||
- librenms
|
||||
ports:
|
||||
- target: 42217
|
||||
published: 42217
|
||||
protocol: tcp
|
||||
volumes:
|
||||
- "./librenms:/data"
|
||||
env_file:
|
||||
- "./librenms.env"
|
||||
environment:
|
||||
- "TZ=${TZ}"
|
||||
- "PUID=${PUID}"
|
||||
- "PGID=${PGID}"
|
||||
- "SIDECAR_RRDCACHED=1"
|
||||
- "RRDCACHED_SERVER=rrdcached:42217"
|
||||
restart: always
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ LISTEN_IPV6=${LISTEN_IPV6:-true}
|
|||
REAL_IP_FROM=${REAL_IP_FROM:-"0.0.0.0/32"}
|
||||
REAL_IP_HEADER=${REAL_IP_HEADER:-"X-Forwarded-For"}
|
||||
LOG_IP_VAR=${LOG_IP_VAR:-remote_addr}
|
||||
STANDALONE=${STANDALONE:-0}
|
||||
|
||||
MEMCACHED_PORT=${MEMCACHED_PORT:-11211}
|
||||
|
||||
|
|
@ -172,6 +173,10 @@ EOL
|
|||
fi
|
||||
|
||||
# Config : RRDcached
|
||||
if [ -n "${STANDALONE}" ]; then
|
||||
RRDCACHED_SERVER="127.0.0.1:42217"
|
||||
fi
|
||||
|
||||
if [ -n "${RRDCACHED_SERVER}" ]; then
|
||||
cat > ${LIBRENMS_PATH}/config.d/rrdcached.php <<EOL
|
||||
<?php
|
||||
|
|
|
|||
44
rootfs/etc/cont-init.d/09-svc-rrdcached.sh
Normal file
44
rootfs/etc/cont-init.d/09-svc-rrdcached.sh
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/with-contenv sh
|
||||
|
||||
STANDALONE=${STANDALONE:-0}
|
||||
SIDECAR_RRDCACHED=${SIDECAR_RRDCACHED:-0}
|
||||
|
||||
# Continue only if sidecar rrdcached container
|
||||
if [ "$STANDALONE" == "1" ]; then
|
||||
echo "Configuring rrdcached in stand-alone mode"
|
||||
elif [ "$SIDECAR_RRDCACHED" != "1" ]; then
|
||||
exit 0
|
||||
else
|
||||
echo ">>"
|
||||
echo ">> Sidecar rrdcached container detected"
|
||||
echo ">>"
|
||||
fi
|
||||
|
||||
RRDCACHED_WRITE_TIMEOUT=${RRDCACHED_WRITE_TIMEOUT:-1800}
|
||||
RRDCACHED_WRITE_JITTER=${RRDCACHED_WRITE_JITTER:-1800}
|
||||
RRDCACHED_WRITE_THREADS=${RRDCACHED_WRITE_THREADS:-4}
|
||||
RRDCACHED_FLUSH_INTERVAL=${RRDCACHED_FLUSH_INTERVAL:-3600}
|
||||
|
||||
mkdir -p /data/rrdcached /var/lib/rrdcached /run/rrdcached
|
||||
chown -R librenms. /data/rrdcached /run/rrdcached
|
||||
|
||||
# Create service
|
||||
mkdir -p /etc/services.d/rrdcached
|
||||
cat > /etc/services.d/rrdcached/run <<EOL
|
||||
#!/usr/bin/execlineb -P
|
||||
with-contenv
|
||||
/usr/sbin/rrdcached \
|
||||
-g -B -R -F \
|
||||
-w ${RRDCACHED_WRITE_TIMEOUT} \
|
||||
-z ${RRDCACHED_WRITE_JITTER} \
|
||||
-f ${RRDCACHED_FLUSH_INTERVAL} \
|
||||
-t ${RRDCACHED_WRITE_THREADS} \
|
||||
-U librenms -G librenms \
|
||||
-p /run/rrdcached/rrdcached.pid \
|
||||
-j /var/lib/rrdcached/journal/ \
|
||||
-V LOG_DEBUG \
|
||||
-l 0:42217 \
|
||||
-b /data/rrd/
|
||||
EOL
|
||||
chmod +x /etc/services.d/rrdcached/run
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue