docker-zabbix icon indicating copy to clipboard operation
docker-zabbix copied to clipboard

Add a way to set the Timezone

Open The-Judge opened this issue 9 years ago • 3 comments

Hi everyone,

"out-of-the-box", zabbix (and it's incident alarms) use UTC timezone. I live in CET (UTC+1 or +2 when daylight saving) and had to implement the following workarrount to have Zabbix run in "my" Timezone:

  1. Set Environment Variable "ZABBIX_TZ" when starting Docker container
  2. Mount a folder, containing the following script (set_tz_to_CET.sh):
#!/bin/bash
if [ ! -L /etc/localtime ] && [ ! -z "${ZABBIX_TZ}" ]; then
  ln -sf /usr/share/zoneinfo/${ZABBIX_TZ} /etc/localtime
  sed -i'' "s#UTC#${ZABBIX_TZ}#g" /etc/httpd/conf.d/zabbix.conf
  monit restart httpd
fi
  1. Add the following file to /etc/monit.d/timezone:
check program timezone
        with path /helper_scripts/set_tz_to_CET.sh
        every "* * * * *"

It would be very more comfortable if such a "TZ Select by Env" would be implemented in the image without such Foo necessary.

PS: It is also necessary to remove the overriding php.value line from /etc/httpd/conf.d/zabbix.conf and restart httpd afterwards. I added this to the script above.

The-Judge avatar Jul 20 '15 10:07 The-Judge

@The-Judge makes sense. I think we could add the contents of the script set_tz_to_CET.sh to [scripts/entrypoint.sh]. If we execute the contents of that script as we start the service through monit we don't need to add /etc/monit.d/timezone do we?

berngp avatar Jul 21 '15 18:07 berngp

Hey berngp,

that's right. The only reason for that kind of awkward monit-workarround is that I did not want to mess up with your entrypoint - script. If you would adopt that, this would be great.

The-Judge avatar Jul 22 '15 06:07 The-Judge

@The-Judge I don't see why we shouldn't. We can support ZABBIX_TZ as en env variable and zabbix-tz as an option for the entrypoint script.

berngp avatar Jul 24 '15 19:07 berngp