librenms / docker

LibreNMS Docker image
MIT License
682 stars 278 forks source link

Scheduler is not running when using compose.yml #413

Open abacef opened 10 months ago

abacef commented 10 months ago

Support guidelines

I've found a bug and checked that ...

Description

FAIL: Scheduler is not running with a fix of sudo cp /opt/librenms/dist/librenms-scheduler.cron /etc/cron.d/

Expected behaviour

The scheduler should be started using docker compose without any extra intervention

Actual behaviour

The scheduler is not started

Steps to reproduce

Follow the instructions here https://docs.librenms.org/Installation/Docker/

Docker info

Client: Docker Engine - Community
 Version:    24.0.7
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.21.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 7
  Running: 7
  Paused: 0
  Stopped: 0
 Images: 5
 Server Version: 24.0.7
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: false
  userxattr: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dd1e886e55dd695541fdcd67420c2888645a495
 runc version: v1.1.10-0-g18a0cb0
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
 Kernel Version: 6.1.55-06877-gc83437f2949f
 Operating System: Debian GNU/Linux 11 (bullseye)
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 6.436GiB
 Name: penguin
 ID: 76aaec60-4c0d-46fc-af9d-70722419157b
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

Docker Compose config

name: librenms
services:
  db:
    command:
    - mysqld
    - --innodb-file-per-table=1
    - --lower-case-table-names=0
    - --character-set-server=utf8mb4
    - --collation-server=utf8mb4_unicode_ci
    container_name: librenms_db
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
      MYSQL_DATABASE: librenms
      MYSQL_PASSWORD: asupersecretpassword
      MYSQL_USER: librenms
      TZ: Europe/Paris
    image: mariadb:10.5
    networks:
      default: null
    restart: always
    volumes:
    - type: bind
      source: /home/bacef/ws/librenms/docker-master/examples/compose/db
      target: /var/lib/mysql
      bind:
        create_host_path: true
  dispatcher:
    cap_add:
    - NET_ADMIN
    - NET_RAW
    container_name: librenms_dispatcher
    depends_on:
      librenms:
        condition: service_started
        required: true
      redis:
        condition: service_started
        required: true
    environment:
      CACHE_DRIVER: redis
      DB_HOST: db
      DB_NAME: librenms
      DB_PASSWORD: asupersecretpassword
      DB_TIMEOUT: "60"
      DB_USER: librenms
      DISPATCHER_NODE_ID: dispatcher1
      LIBRENMS_SNMP_COMMUNITY: librenmsdocker
      LIBRENMS_WEATHERMAP: "false"
      LIBRENMS_WEATHERMAP_SCHEDULE: '*/5 * * * *'
      LOG_IP_VAR: remote_addr
      MAX_INPUT_VARS: "1000"
      MEMORY_LIMIT: 256M
      OPCACHE_MEM_SIZE: "128"
      PGID: "1000"
      PUID: "1000"
      REAL_IP_FROM: 0.0.0.0/32
      REAL_IP_HEADER: X-Forwarded-For
      REDIS_HOST: redis
      SESSION_DRIVER: redis
      SIDECAR_DISPATCHER: "1"
      TZ: Europe/Paris
      UPLOAD_MAX_SIZE: 16M
    hostname: librenms-dispatcher
    image: librenms/librenms:latest
    networks:
      default: null
    restart: always
    volumes:
    - type: bind
      source: /home/bacef/ws/librenms/docker-master/examples/compose/librenms
      target: /data
      bind:
        create_host_path: true
  librenms:
    cap_add:
    - NET_ADMIN
    - NET_RAW
    container_name: librenms
    depends_on:
      db:
        condition: service_started
        required: true
      msmtpd:
        condition: service_started
        required: true
      redis:
        condition: service_started
        required: true
    environment:
      CACHE_DRIVER: redis
      DB_HOST: db
      DB_NAME: librenms
      DB_PASSWORD: asupersecretpassword
      DB_TIMEOUT: "60"
      DB_USER: librenms
      LIBRENMS_SNMP_COMMUNITY: librenmsdocker
      LIBRENMS_WEATHERMAP: "false"
      LIBRENMS_WEATHERMAP_SCHEDULE: '*/5 * * * *'
      LOG_IP_VAR: remote_addr
      MAX_INPUT_VARS: "1000"
      MEMORY_LIMIT: 256M
      OPCACHE_MEM_SIZE: "128"
      PGID: "1000"
      PUID: "1000"
      REAL_IP_FROM: 0.0.0.0/32
      REAL_IP_HEADER: X-Forwarded-For
      REDIS_HOST: redis
      SESSION_DRIVER: redis
      TZ: Europe/Paris
      UPLOAD_MAX_SIZE: 16M
    hostname: librenms
    image: librenms/librenms:latest
    networks:
      default: null
    ports:
    - target: 8000
      published: "8000"
      protocol: tcp
    restart: always
    volumes:
    - type: bind
      source: /home/bacef/ws/librenms/docker-master/examples/compose/librenms
      target: /data
      bind:
        create_host_path: true
  msmtpd:
    container_name: librenms_msmtpd
    environment:
      SMTP_AUTH: "on"
      SMTP_FROM: foo@gmail.com
      SMTP_HOST: smtp.gmail.com
      SMTP_PASSWORD: bar
      SMTP_PORT: "587"
      SMTP_STARTTLS: "on"
      SMTP_TLS: "on"
      SMTP_TLS_CHECKCERT: "on"
      SMTP_USER: foo
    image: crazymax/msmtpd:latest
    networks:
      default: null
    restart: always
  redis:
    container_name: librenms_redis
    environment:
      TZ: Europe/Paris
    image: redis:5.0-alpine
    networks:
      default: null
    restart: always
  snmptrapd:
    cap_add:
    - NET_ADMIN
    - NET_RAW
    container_name: librenms_snmptrapd
    depends_on:
      librenms:
        condition: service_started
        required: true
      redis:
        condition: service_started
        required: true
    environment:
      CACHE_DRIVER: redis
      DB_HOST: db
      DB_NAME: librenms
      DB_PASSWORD: asupersecretpassword
      DB_TIMEOUT: "60"
      DB_USER: librenms
      LIBRENMS_SNMP_COMMUNITY: librenmsdocker
      LIBRENMS_WEATHERMAP: "false"
      LIBRENMS_WEATHERMAP_SCHEDULE: '*/5 * * * *'
      LOG_IP_VAR: remote_addr
      MAX_INPUT_VARS: "1000"
      MEMORY_LIMIT: 256M
      OPCACHE_MEM_SIZE: "128"
      PGID: "1000"
      PUID: "1000"
      REAL_IP_FROM: 0.0.0.0/32
      REAL_IP_HEADER: X-Forwarded-For
      REDIS_HOST: redis
      SESSION_DRIVER: redis
      SIDECAR_SNMPTRAPD: "1"
      TZ: Europe/Paris
      UPLOAD_MAX_SIZE: 16M
    hostname: librenms-snmptrapd
    image: librenms/librenms:latest
    networks:
      default: null
    ports:
    - target: 162
      published: "162"
      protocol: tcp
    - target: 162
      published: "162"
      protocol: udp
    restart: always
    volumes:
    - type: bind
      source: /home/bacef/ws/librenms/docker-master/examples/compose/librenms
      target: /data
      bind:
        create_host_path: true
  syslogng:
    cap_add:
    - NET_ADMIN
    - NET_RAW
    container_name: librenms_syslogng
    depends_on:
      librenms:
        condition: service_started
        required: true
      redis:
        condition: service_started
        required: true
    environment:
      CACHE_DRIVER: redis
      DB_HOST: db
      DB_NAME: librenms
      DB_PASSWORD: asupersecretpassword
      DB_TIMEOUT: "60"
      DB_USER: librenms
      LIBRENMS_SNMP_COMMUNITY: librenmsdocker
      LIBRENMS_WEATHERMAP: "false"
      LIBRENMS_WEATHERMAP_SCHEDULE: '*/5 * * * *'
      LOG_IP_VAR: remote_addr
      MAX_INPUT_VARS: "1000"
      MEMORY_LIMIT: 256M
      OPCACHE_MEM_SIZE: "128"
      PGID: "1000"
      PUID: "1000"
      REAL_IP_FROM: 0.0.0.0/32
      REAL_IP_HEADER: X-Forwarded-For
      REDIS_HOST: redis
      SESSION_DRIVER: redis
      SIDECAR_SYSLOGNG: "1"
      TZ: Europe/Paris
      UPLOAD_MAX_SIZE: 16M
    hostname: librenms-syslogng
    image: librenms/librenms:latest
    networks:
      default: null
    ports:
    - target: 514
      published: "514"
      protocol: tcp
    - target: 514
      published: "514"
      protocol: udp
    restart: always
    volumes:
    - type: bind
      source: /home/bacef/ws/librenms/docker-master/examples/compose/librenms
      target: /data
      bind:
        create_host_path: true
networks:
  default:
    name: librenms_default

Logs

Where are these logs?

Additional info

No response

Don-Swanson commented 9 months ago

Check #382

Jellyfrog commented 9 months ago

The problem is that the env is not populated into the php-fpm process for some reason so CACHE_DRIVER (and others?) is different between OS and php-fpm.

vladaman commented 8 months ago

We are experiencing a persistent issue where our vanilla Docker Compose setup fails to pull data. Upon entering the container and manually executing the update command, the data is refreshed. This leads me to believe there may be a malfunction with either the dispatcher or the cron job.

python poller-wrapper.py 4 && sleep 300 && python poller-wrapper.py 4
DRieper commented 2 months ago

Experiencing the same problem. On WebGUI the Error is displayed.

I tried to run the validator on shell and there is no error regarding to the sheduler.

` /opt/librenms $ ./validate.php

=========================================== Component Version
LibreNMS 24.8.0 (2024-08-25T23:45:45+02:00)
DB Schema 2024_07_19_120719_update_ports_stack_table (296)
PHP 8.2.20
Python 3.11.9
Database MariaDB 10.11.9-MariaDB-ubu2204
RRDTool 1.8.0
SNMP 5.9.4

===========================================

[OK] Installed from the official Docker image; no Composer required [OK] Database connection successful [WARN] You have no devices. [FIX]: Consider adding a device such as localhost: https://x.x.x.x:8000/addhost [OK] Database connection successful [OK] Database Schema is current [OK] SQL Server meets minimum requirements [OK] lower_case_table_names is enabled [OK] MySQL engine is optimal [OK] Database and column collations are correct [OK] Database schema correct [OK] MySQL and PHP time match [OK] Locks are functional [OK] No python wrapper pollers found [OK] Redis is functional [WARN] IPv6 is disabled on your server, you will not be able to add IPv6 devices. [OK] rrd_dir is writable [OK] rrdtool version ok [WARN] Updates are managed through the official Docker image /opt/librenms $ `