1

I have two instances of zabbix running on two different RHEL servers. Data presented in web user interface on one are off by 2 hours and on the other by 3 hours (ahead). For example instead of 15:00 it says 17:00. Timezone in /etc/php.ini is set properly to America/Vancouver (the same as settings on my desktop). I use MySQL and database settings are ok as well. calling 'select now() from dual' test returns correct time.

date

returns correct time and I also created link

ln -sf /usr/share/zoneinfo/America/Vancouver /etc/localtime

and restarted zabbix server and the agent. Time in graphs is still two hours ahead.

Any help?

Tomas
  • 111
  • 1
  • 2

3 Answers3

1

Since none of the answers on this board helped me, I thought I'd tell you what worked for me.

The RHEL Zabbix installer will create an httpd configuration file that includes the DocumentRoot and a bunch of other settings. This file is copied (either by you or the installer) to a sub-directory under your httpd root (usually /etc/httpd), to either the sites-available or conf.d sub-directory. Many web servers contain multiple virtual hosts, so you must find the configuration file that contains the Zabbix DocumentRoot entry. In that file, look for the entry php_admin_value date.timezone 'UTC' -- change 'UTC' to the time zone you need then type service httpd restart.

Note: sites-available entries override the conf.d entries, so make sure modify the correct virtual hosts definition.

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
Andrew S
  • 510
  • 4
  • 7
0

You issue could be similar to this bug.
https://support.zabbix.com/browse/ZBX-1247

Sameer
  • 4,118
  • 2
  • 17
  • 11
  • It's not. Both server and the client are in the same timezone. We have another Zabbix server setup and it works fine. I just can't figure out which part of setup is different and why it works. – Tomas Mar 22 '11 at 20:37
0

I know Richlv already asked for Zabbix version. But What RHEL version?

Here is something to try. Create a php file in the zabbix web root and add the contents:

<?php
        echo date('M jS, H:i');
?>

Then load the filename in the browser. This will help confirm if it is a PHP issue or not. Is it possible there are multiple php.ini files and one is being overlooked?

Andy Shinn
  • 4,211
  • 8
  • 40
  • 55
  • Andy, time is off by two hours. It seems like you are right. Where else can php.ini be? Is zone setting also somewhere in Zabbix itself? I am not much of PHP expert. – Tomas Mar 31 '11 at 18:19
  • In this case it wouldn't be related to Zabbix at all. Can you scan your system for php.ini? Also, what is the php version (php -v)? – Andy Shinn Mar 31 '11 at 19:29
  • `php -v` returns 'PHP 5.1.6 (cli) (built: Nov 13 2010 16:05:12)' and when I ran `find / -name php.ini -print` it returns only /etc/php.ini. My /etc/php.ini has line date.timezone = 'America/Vancouver'. When I get timezone in PHP using `date_default_timezone_get()` it returns 'America/Chicago' – Tomas Mar 31 '11 at 20:42
  • And I am using Apache with mod_php if it helps. – Tomas Mar 31 '11 at 20:49
  • Check commands: `php -i | grep ini` and `php -i | grep timezone` to see what they return. You may also want to try creating a php file in the webroot containing `` and see what the values for ini files and timezone is. Command line PHP and mod_php could be different. – Andy Shinn Apr 01 '11 at 00:09
  • I did phpinfo() last week. I got `Default timezone America/Chicago` but `date.timezone America/Vancouver`. Then I noticed that Environment lists `_ENV["TZ"] America/Chicago`. Could other modules change environment? Thanks again for all help. I know this is more PHP than Zabbix issue now. When I manually set timezone using `date_default_timezone_set('America/Vancouver');` then I get `Default timezone America/Vancouver` but `_ENV["TZ"] America/Chicago`. I am so confused. I tried to Google who and when changes environment information (_ENV) but didn't have too much time to spend on it last week. – Tomas Apr 04 '11 at 16:37
  • Could also be Apache. Grep for SetEnv in your apache configurations (/etc/apache2). See http://httpd.apache.org/docs/2.2/mod/mod_env.html – Andy Shinn Apr 07 '11 at 02:11