librenms / docker

LibreNMS Docker image
MIT License
692 stars 280 forks source link

Docker image need to support new scheduler #350

Closed Jellyfrog closed 1 year ago

Jellyfrog commented 1 year ago

Basically need to add another cronjob that runs php artisan schedule:run every minute https://github.com/librenms/librenms/pull/14987

hugalafutro commented 1 year ago

I presume this is this validate error? I am getting that since updating the docker images to librenms 23.5.0 - Thu Jun 15 2023 03:54:54 GMT+0100

SchedulerFailure
FAIL: Scheduler is not running
Fix:
cp /opt/librenms/dist/librenms-scheduler.service /opt/librenms/dist/librenms-scheduler.timer /etc/systemd/system/
systemctl enable librenms-scheduler.timer
systemctl start librenms-scheduler.timer

however I cannot run those commands in the docker as:

pi@pi-docker:~ $ docker exec -it librenms bash
librenms:/opt/librenms# cp /opt/librenms/dist/librenms-scheduler.service /opt/librenms/dist/librenms-scheduler.timer /etc/systemd/system/
cp: target '/etc/systemd/system/': No such file or directory

So then as workaround I can run this from host's cron every minute?

pi@pi-docker:~ $ docker exec -t librenms php artisan schedule:run

   INFO  No scheduled commands are ready to run.
viptampa commented 1 year ago

I have the same issue. Whats the recommended solution?

hugalafutro commented 1 year ago

I tried the solution I mentioned, but when I checked just now it was FAIL again, so I've no idea. However for what it's worth I do not observe any adverse effects either.

viptampa commented 1 year ago

Groovy, I'll try that to get around.

viptampa commented 1 year ago

Yea, that "docker exec -t librenms php artisan schedule:run" runs.... but of course needs to be then run setup to run when server boots.

Scheduler still doesn't validate.

viptampa commented 1 year ago

So after some working through several iterations... one has to import the cron file under /opt/libernms/dist into the crontab (for librenms user) AND also the php artisan schedule:run. I can't seem an easy way to automatic that within the container itself. However, once those are all imported into the crontab, about 3 minutes later, the config DOES validate each and every time for the scheduler.

stanthewizzard commented 1 year ago

same issue here

exptom commented 1 year ago

I'm trying to do a new install (I want to move from observium) and have hit this same issue.

viptampa commented 1 year ago

I posted a work around here. https://community.librenms.org/t/docker-container-install-scheduler-not-running-and-servername/21835/2 All things validate.

viptampa commented 1 year ago

@crazy-max Trying to set this up on a brand new linux box, and the scheduler is still not running / validating.

crazy-max commented 1 year ago

@crazy-max Trying to set this up on a brand new linux box, and the scheduler is still not running / validating.

If you're looking for logs they are discarded: https://github.com/librenms/docker/blob/a88f2d0b1c2e4bd3d9604fb8f54efbd65bb726cb/rootfs/etc/cont-init.d/07-svc-cron.sh#L34

and cron runs fine on my side

viptampa commented 1 year ago

Understood. Looks like validation works via command line, but does not validate via gui. Suggestions?