librenms / docker

LibreNMS Docker image
MIT License
673 stars 278 forks source link

change poller settings #153

Open ziodona85 opened 3 years ago

ziodona85 commented 3 years ago

Hi, i have created a cluster of 5 server with docker for test with casual ip addresses. It's a sort of distribuited poller project. The server are:

Server 1 (10.63.132.30)

librenms_rrdcached | healthy |   | librenms | crazymax/rrdcached  port exposed: 42217:42217 tcp
librenms_msmtpd | healthy |   | librenms | crazymax/msmtpd:latest
librenms | running |   | librenms | librenms/librenms:latest  port exposed:  514:514 tcp  514:514 udp  8000:8000
librenms_redis | running |   | librenms | redis:5.0-alpine |  port exposed: 6379:6379 tcp
librenms_memcached | running |   | librenms | memcached:alpine   port exposed: 11211:11211 tcp

Docker-compose.yml

version: "3.5"

services:
  memcached:
    image: memcached:alpine
    container_name: librenms_memcached
    ports:
      - 11211:11211
    environment:
      - "TZ=${TZ}"
    restart: always

  redis:
    image: redis:5.0-alpine
    container_name: librenms_redis
    ports:
      - 6379:6379
    environment:
      - "TZ=${TZ}"
    restart: always

  rrdcached:
    image: crazymax/rrdcached
    container_name: librenms_rrdcached
    ports:
      - 42217:42217
    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: always

  msmtpd:
    image: crazymax/msmtpd:latest
    container_name: librenms_msmtpd
    env_file:
      - "./msmtpd.env"
    restart: always

  librenms:
    image: librenms/librenms:latest
    container_name: librenms
    hostname: librenms
    cap_add:
      - NET_ADMIN
      - NET_RAW
    ports:
      - 8000:8000
      - 514:514
      - 514:514/udp
    depends_on:
      - memcached
      - rrdcached
      - msmtpd
    volumes:
      - "./librenms:/data"
    env_file:
      - "./librenms.env"
    environment:
      - "TZ=${TZ}"
      - "PUID=${PUID}"
      - "PGID=${PGID}"
      - "DB_HOST=10.63.132.33"
      - "DB_NAME=${MYSQL_DATABASE}"
      - "DB_USER=${MYSQL_USER}"
      - "DB_PASSWORD=${MYSQL_PASSWORD}"
      - "DB_TIMEOUT=60"
    restart: always

Server 2 (10.63.132.33)

oxidized_oxidized_1 | running |   | oxidized | oxidized/oxidized:latest port exposed:  8888:8888
librenms_db | running |   | librenms | mariadb:10.4  port exposed:  3306:3306
version: "3.5"

services:
  db:
    image: mariadb:10.4
    container_name: librenms_db
    command:
      - "mysqld"
      - "--innodb-file-per-table=1"
      - "--lower-case-table-names=0"
      - "--character-set-server=utf8"
      - "--collation-server=utf8_unicode_ci"
      - "--max-connections=3000"
    ports:
      - "0.0.0.0:3306:3306"
    volumes:
      - "./db:/var/lib/mysql"
    environment:
      - "TZ=${TZ}"
      - "MYSQL_ALLOW_EMPTY_PASSWORD=yes"
      - "MYSQL_DATABASE=${MYSQL_DATABASE}"
      - "MYSQL_USER=${MYSQL_USER}"
      - "MYSQL_PASSWORD=${MYSQL_PASSWORD}"
    restart: always

 oxidized:
  restart: always
  image: oxidized/oxidized:latest
  ports:
    - 0.0.0.0:8888:8888/tcp
  environment:
    CONFIG_RELOAD_INTERVAL: 600
  volumes:
    - /opt/Docker/oxidized/Backup:/root/.config/oxidized

Server 3 (10.63.132.34)

librenms_dispatcher | running |   | librenms | librenms/librenms:latest 
librenms | running |   | librenms | librenms/librenms:latest
version: "3.5"

services:
  librenms:
    image: librenms/librenms:latest
    container_name: librenms
    hostname: librenms
    cap_add:
      - NET_ADMIN
      - NET_RAW
    volumes:
      - "./librenms:/data"
    env_file:
      - "./librenms.env"
    environment:
      - "TZ=${TZ}"
      - "PUID=${PUID}"
      - "PGID=${PGID}"
      - "DB_HOST=10.63.132.33"
      - "DB_NAME=${MYSQL_DATABASE}"
      - "DB_USER=${MYSQL_USER}"
      - "DB_PASSWORD=${MYSQL_PASSWORD}"
      - "DB_TIMEOUT=60"
    restart: always

  dispatcher:
    image: librenms/librenms:latest
    container_name: librenms_dispatcher
    hostname: librenms-dispatcher-porg
    cap_add:
      - NET_ADMIN
      - NET_RAW
    volumes:
      - "./librenms:/data"
    env_file:
      - "./librenms.env"
    environment:
      - "TZ=${TZ}"
      - "PUID=${PUID}"
      - "PGID=${PGID}"
      - "DB_HOST=10.63.132.33"
      - "DB_NAME=${MYSQL_DATABASE}"
      - "DB_USER=${MYSQL_USER}"
      - "DB_PASSWORD=${MYSQL_PASSWORD}"
      - "DB_TIMEOUT=60"
      - "DISPATCHER_NODE_ID=dispatcher34"
      - "REDIS_HOST=10.63.132.30"
      - "REDIS_PORT=6379"
      - "REDIS_DB=0"
      - "SIDECAR_DISPATCHER=1"
    restart: always

Server 4 (10.63.132.35)

librenms_dispatcher | running |   | librenms | librenms/librenms:latest 
version: "3.5"

services:
  dispatcher1:
    image: librenms/librenms:latest
    container_name: librenms_dispatcher
    hostname: librenms-dispatcher-dartfener
    cap_add:
      - NET_ADMIN
      - NET_RAW
    volumes:
      - "./librenms:/data"
    env_file:
      - "./librenms.env"
    environment:
      - "TZ=${TZ}"
      - "PUID=${PUID}"
      - "PGID=${PGID}"
      - "DB_HOST=10.63.132.33"
      - "DB_NAME=${MYSQL_DATABASE}"
      - "DB_USER=${MYSQL_USER}"
      - "DB_PASSWORD=${MYSQL_PASSWORD}"
      - "DB_TIMEOUT=60"
      - "DISPATCHER_NODE_ID=dispatcher35"
      - "REDIS_HOST=10.63.132.30"
      - "REDIS_PORT=6379"
      - "REDIS_DB=0"
      - "SIDECAR_DISPATCHER=1"
    restart: always

Server 5 (10.63.132.37)

librenms_dispatcher | running |   | librenms | librenms/librenms:latest 
version: "3.5"

services:
  dispatcher1:
    image: librenms/librenms:latest
    container_name: librenms_dispatcher
    hostname: librenms-dispatcher-dartfener
    cap_add:
      - NET_ADMIN
      - NET_RAW
    volumes:
      - "./librenms:/data"
    env_file:
      - "./librenms.env"
    environment:
      - "TZ=${TZ}"
      - "PUID=${PUID}"
      - "PGID=${PGID}"
      - "DB_HOST=10.63.132.33"
      - "DB_NAME=${MYSQL_DATABASE}"
      - "DB_USER=${MYSQL_USER}"
      - "DB_PASSWORD=${MYSQL_PASSWORD}"
      - "DB_TIMEOUT=60"
      - "DISPATCHER_NODE_ID=dispatcher37"
      - "REDIS_HOST=10.63.132.30"
      - "REDIS_PORT=6379"
      - "REDIS_DB=0"
      - "SIDECAR_DISPATCHER=1"
    restart: always

They works correctly with docker-compose rrdcached example (only in the server 3 i have created also the container librenms, i don't know why but it doesn't work without it. However in this mode works). All server point to Server 1 for rrdcached, redis and at server 2 for mariadb. For oxidized i have configured manually the config.php file in the server 1 and works correctly.

In Librenms i can see the 3 dispatcher in the menu' Poller Cluster Health GUI. https://ibb.co/zHMhSpb I would want to modify parameters of these 3 pollers from poller settings but it doesn't work. https://ibb.co/JcyGNHL The parameters that i can change are the number of workers, ping and whatchdog enable. If i change the number of workers i can see the new number in the Poller Cluster Health. If i try to modify in advanced mode other option they aren't applied to 3 poller. For example i have Poller Frequency (Seconds) 35, i woul want to reset to default 300, or 60. If i change and wait 5 minutes or i try to restart the container dispatcher, values remain the same before. If i try to change the group assegnation, the value is always General. If i change after after 5 minutes Librenms returns to old configuration. I have tried to modify php file from CLI but the problem is the same before.

Could you help me to find the problem? Or proposal for changing docker-compose files for distribution poller or config.php file?

If you can, can you tell me how to use nfsen integration, i haven't found it. My project is install another docker container with nfsen and after redirect LibreNMS configuration on it. Or another idea is install in alpine librenms container nfdump module, maybe should it work with this module?

And for last, how can i save definitely the docker containers, with php file modified?

Thanks for your help, and congratulations for your great work :).

Regards.

rfdrake commented 2 years ago

I think the problems you're facing is because the volume mount - "./librenms:/data" normally shares data between the different docker containers. My guess is that there are certain variables that are stored in files rather than the database. For those variables you would need to copy a config file to the other machines.

Having said that, I looked at the code and the poller frequency seemed to be a variable that is stored in the database. Maybe things have changed since you first posted your question, or maybe I'm barking up the wrong tree.

I'm about to go down the same path you are, splitting my pollers into separate machines.