Closed sebastianhelbig closed 3 months ago
That's an old version of M/Monit.
Can you provide some debugging info?
docker compose logs | grep TZ
Then docker compose exec mmonit /bin/bash
and run the commands echo $TZ
and date
?
Thanks.
Jeff
Unfortunately we currently only have a license for 3.x.
> docker compose logs | grep TZ
mmonit.… | TZ=Europe/Berlin
mmonit.… | TZ=Europe/Berlin
> echo $TZ
Europe/Berlin
> date
Thu May 16 22:19:22 CEST 2024
The date on the system seems correct. But M/Monit is not using it when sending the alert mails. I am not sure if this may fix it, but /etc/localtime is not present; see https://wiki.alpinelinux.org/wiki/Setting_the_timezone
I just tried it. When setting the timezone as explained here https://wiki.alpinelinux.org/wiki/Setting_the_timezone the dates in the alert mails show the correct timezone.
One more thing to check. Does it look like M/Monit log entries are in UTC or CEST?
I just saw your second response...
I've build the image backup-4.2.2
with the fix. It works for setting /etc/localtime:
root@mmonit:/opt# ls -Flas /etc/localtime
1 lrwxrwxrwx 1 root root 36 May 16 17:26 /etc/localtime -> /usr/share/zoneinfo/America/New_York
The only other changes in this image are for adding support for mysql backups.
Please test to see if this works for you.
As it is simple and works for me, I applied it to master where it will rebuild 4.2.2.
Thanks a lot. It is working :-)
We recently switched from "traditional hosting" of M/Monit to the docker container. But there is one issue which previously worked, so it is not a bug in M/Monit itself.
The dates in alert mails M/Monit is sending are in UTC instead of our set timezone. The TZ param seems to have no influence on M/Monit. We have set the following in a docker-compose.yml: