Hi everyone,
I’m using LibreNMS in Docker, using the officiel github repo.
I’ve enabled the rrdcached container with the env RRDCACHED_SERVER=rrdcached:42217
.
Everything is working fine and my LibreNMS is rather fast.
Now I’ve been using it for a year and a half and I’m going to have to do something, because the rrd_purge 183
option doesn’t work, and LNMS is using ~750GB of RRD data…
Indeed, in the doc, the mount point of librenms and rrdcached is not the same for RRD files.
I quote:
rrdcached:
volumes:
- "./rrd/db:/data/db"
librenms:
volumes:
- "./librenms:/data"
I tried to put the same mount point for RRDs, LibreNMS did the cleaning, but I had problems displaying graphs:
So, I restored a snapshot to recover the graphs (yes because before trying, I had made a snapshot).
Does anyone have the solution to be able to use the rrd_purge
option with rrdcached?
Or, that rrdcached itself does the cleaning.
My docker-compose.yml
:
services:
traefik:
container_name: traefik
image: traefik:latest
ports:
- 80:80
- 443:443
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./traefik/traefik.yml:/etc/traefik/traefik.yml:ro"
- "./traefik/dynamic.yml:/etc/traefik/dynamic.yml:ro"
- "/usr/local/etc/ssl/:/etc/ssl-custom/:ro"
labels:
- "traefik.enable=true"
- "traefik.http.middlewares.traefik-dashboard-auth.basicauth.users=traefik:xxx"
- "traefik.http.middlewares.traefik-dashboard-redirect-https.redirectscheme.scheme=https"
- "traefik.http.routers.traefik-dashboard-http.entrypoints=http"
- "traefik.http.routers.traefik-dashboard-http.rule=Host(`xxx.fqdn`)"
- "traefik.http.routers.traefik-dashboard-http.middlewares=traefik-dashboard-redirect-https"
- "traefik.http.routers.traefik-dashboard-https.entrypoints=https"
- "traefik.http.routers.traefik-dashboard-https.rule=Host(`xxx.fqdn`)"
- "traefik.http.routers.traefik-dashboard-https.tls=true"
- "traefik.http.routers.traefik-dashboard-https.service=api@internal"
- "traefik.http.routers.traefik-dashboard-https.middlewares=onlylan@file,traefik-dashboard-auth"
restart: unless-stopped
rrdcached:
image: crazymax/rrdcached
container_name: librenms_rrdcached
volumes:
- "./rrd/db:/data/db"
- "./rrd/journal:/data/journal"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "LOG_LEVEL=LOG_INFO"
- "WRITE_TIMEOUT=1800"
- "WRITE_JITTER=1800"
- "WRITE_THREADS=4"
- "FLUSH_DEAD_DATA_INTERVAL=3600"
restart: unless-stopped
db:
image: mariadb:10.5
container_name: librenms_db
command:
- "mysqld"
- "--innodb-file-per-table=1"
- "--lower-case-table-names=0"
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
volumes:
- "./db:/var/lib/mysql"
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"
environment:
- "TZ=${TZ}"
- "MYSQL_ALLOW_EMPTY_PASSWORD=yes"
- "MYSQL_DATABASE=${MYSQL_DATABASE}"
- "MYSQL_USER=${MYSQL_USER}"
- "MYSQL_PASSWORD=${MYSQL_PASSWORD}"
restart: unless-stopped
redis:
image: redis:5.0-alpine
container_name: librenms_redis
environment:
- "TZ=${TZ}"
restart: unless-stopped
msmtpd:
image: crazymax/msmtpd:latest
container_name: librenms_msmtpd
env_file:
- "./msmtpd.env"
restart: unless-stopped
librenms:
image: librenms/librenms:latest
container_name: librenms
hostname: librenms
depends_on:
- db
- redis
- msmtpd
volumes:
- "./librenms:/data"
labels:
- "traefik.enable=true"
- "traefik.http.services.librenms-http8000.loadbalancer.server.port=8000"
- "traefik.http.middlewares.librenms-redirect-https.redirectscheme.scheme=https"
- "traefik.http.routers.librenms-http.entrypoints=http"
- "traefik.http.routers.librenms-http.rule=Host(`xxx.fqdn`)"
- "traefik.http.routers.librenms-http.middlewares=librenms-redirect-https"
- "traefik.http.routers.librenms-https.entrypoints=https"
- "traefik.http.routers.librenms-https.rule=Host(`xxx.fqdn`)"
- "traefik.http.routers.librenms-https.tls=true"
- "traefik.http.routers.librenms-https.service=librenms-http8000"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
restart: unless-stopped
dispatcher:
image: librenms/librenms:latest
container_name: librenms_dispatcher
hostname: librenms-dispatcher
depends_on:
- librenms
- redis
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "DISPATCHER_NODE_ID=dispatcher1"
- "SIDECAR_DISPATCHER=1"
restart: unless-stopped
syslogng:
image: librenms/librenms:latest
container_name: librenms_syslog
hostname: librenms-syslogng
depends_on:
- librenms
- redis
ports:
- target: 514
published: 514
protocol: tcp
- target: 514
published: 514
protocol: udp
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "SIDECAR_SYSLOGNG=1"
restart: unless-stopped
logrotate:
container_name: logrotate
build:
context: './logrotate'
volumes:
- ./librenms/logs/:/var/log/librenms/:rw
- /var/run/docker.sock:/var/run/docker.sock:rw
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
depends_on:
- syslogng
restart: unless-stopped
snmptrapd:
image: librenms/librenms:latest
container_name: librenms_snmptrapd
hostname: librenms-snmptrapd
depends_on:
- librenms
- redis
ports:
- target: 162
published: 162
protocol: tcp
- target: 162
published: 162
protocol: udp
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "SIDECAR_SNMPTRAPD=1"
restart: unless-stopped
My .env
file:
MEMORY_LIMIT=8G
MAX_INPUT_VARS=1000
UPLOAD_MAX_SIZE=16M
OPCACHE_MEM_SIZE=128
REAL_IP_FROM=0.0.0.0/32
REAL_IP_HEADER=X-Forwarded-For
LOG_IP_VAR=http_x_forwarded_for
LISTEN_IPV6=false
CACHE_DRIVER=redis
SESSION_DRIVER=redis
REDIS_HOST=redis
LIBRENMS_SNMP_COMMUNITY=public
RRDCACHED_SERVER=rrdcached:42217
LIBRENMS_WEATHERMAP=false
LIBRENMS_WEATHERMAP_SCHEDULE=*/5 * * * *
Thanks !