librenms / docker

LibreNMS Docker image
MIT License
691 stars 278 forks source link

Fix issue with alerts not functioning correctly. #298

Closed Aterfax closed 2 years ago

Aterfax commented 2 years ago

This should address the issues mentioned in https://github.com/librenms/docker/issues/297

Does not look like I can link the PR to the issue to close it however.

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.

murrant commented 2 years ago

Hmm, I wonder why that would be. Upstream it already should default to tcp. https://github.com/librenms/librenms/blob/master/config/database.php#L213

Aterfax commented 2 years ago

Yes, it is a bit odd as I read that in the docs for it too, At least for now setting it manually populates this correctly so we don''t have the error but I am not sure if this needs to be upstreamed to LibreNMS in general or predis as some kind of bug.

murrant commented 2 years ago

@Aterfax what do you have set for REDIS_HOST? when I just run docker compose up -d in the examples/compose from here, it doesn't have an issue.

Aterfax commented 2 years ago

How odd, as it stands I have:

MEMORY_LIMIT=256M
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=remote_addr

CACHE_DRIVER=redis
SESSION_DRIVER=redis
REDIS_HOST=redis
REDIS_SCHEME=tcp

LIBRENMS_SNMP_COMMUNITY=REDACTED

LIBRENMS_WEATHERMAP=false
LIBRENMS_WEATHERMAP_SCHEDULE=*/5 * * * *

Which would have been prior to my edit / fix:

MEMORY_LIMIT=256M
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=remote_addr

CACHE_DRIVER=redis
SESSION_DRIVER=redis
REDIS_HOST=redis

LIBRENMS_SNMP_COMMUNITY=REDACTED

LIBRENMS_WEATHERMAP=false
LIBRENMS_WEATHERMAP_SCHEDULE=*/5 * * * *

The majority of any edits I have made are swapping the docker volumes for volume bind mounts to the host but I can't see how that could cause this?

crazy-max commented 2 years ago

@murrant Oh I think I found why, we are setting an empty var if not defined: https://github.com/librenms/docker/blob/3c84a0a6b505e155165ddbb698c1f0c025559c02/rootfs/etc/cont-init.d/05-svc-dispatcher.sh#L101

I guess librenms checks just the env var existence but not its value and therefore applies an empty val in our case and does not use the default value.