Ad Widget

Collapse

Zabbix displaying wrong time after setting the right timezone in the php.ini file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dawidp
    Junior Member
    • May 2020
    • 12

    #1

    Zabbix displaying wrong time after setting the right timezone in the php.ini file

    Hey. I am using a dockerized version of zabbix with several connected agents and I want to set the right time for the incoming data.

    What was the issue? Zabbix is displaying wrong time in the Monitoring -> Latest data section. It's one hour later than should be. The clock widget on the dashboard shows correct time though.

    What did I do? I checked the dockerfile and found that there are several possible locations for the php.ini file, I found it in /etc/php7/php.ini and changed the timezone. After restarting the zabbix server container the time is still wrong.

    I am now wondering what is the problem?
  • icol
    Member
    • Aug 2014
    • 31

    #2
    Hi!

    I have exactly the same problem as you have. The only difference is me having one hour less. The clock widget is showing the correct time. The OS is showing the correct time. I am using the api to send the alarms and here time is also correct.

    Did you solve your problem?

    Comment

    • dawidp
      Junior Member
      • May 2020
      • 12

      #3
      Yes! I actually do remember Just notice that in my case the agents were also running on docker containers.
      https://github.com/zabbix/zabbix-doc...-entrypoint.sh
      Search here for "PHP_TZ" and manually do the same regarding the configuration, after you're done just restart and it should be working.

      Hope it helps!
      Last edited by dawidp; 04-01-2021, 16:36.

      Comment

      • icol
        Member
        • Aug 2014
        • 31

        #4
        Thank you for the reply!
        I just correct the error and in my case i had to change the /etc/php.ini (rhel8) and se the date.timezone to my zone. and then i had to "systemctl restart php-fpm httpd"

        Questions i would like zabbix to answer:

        Why don't zabbix documents this behavior?
        Why is it necessary to have the timezone in 2 files: php.ini and zabbix.conf.

        Comment


        • set_monitos
          set_monitos commented
          Editing a comment
          Hi All,

          Agreed with icol. Search in /etc/php.ini for line date.timezone the following and set your timezone, see below. Save changes and restart php-fpm.


          Step 1 - Set your timedatectl set-timezone yourtimezone
          # timedatectl set-timezone America/Los_Angeles

          Step 2 - FIX time in /etc/php.ini
          [Date]
          ; Defines the default timezone used by the date functions
          ; http://php.net/date.timezone
          ;date.timezone =
          date.timezone = "America/Los_Angeles"

          Step 3 - restart php-fpm
          #systemctl restart php-fpm

          Step 4 - Refresh browser and your correct local time will display in graphs! !!
      Working...