graphs 2 hours behind system time

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
rafchumley
Posts: 19
Joined: Tue Jan 25, 2005 2:17 pm

graphs 2 hours behind system time

Post by rafchumley »

Heya All,

I recently installed cacti on a new server (CentOS) and imported all my old cacti server's data etc. That seemed to go quite well and everything was hunky-dory.
I then realized that my new server had both the time and timezone set wrong. It was set to Central Time and was also 1 hour wrong (behind) at that. So I fixed that by changing the symlink for the time zone (I am EST) and then used webmin to adjust the hardware/system time to be correct. Now all my graphs are 2 hours behind, meaning that if I look at my graphs at 1 PM the graphs only show up until 11am. I have rebooted to no avail. When I use the CLI 'clock' command it shows the correct time/date/zone but cacti seems to think it is 2 hours earlier (still on the old settings it seems).

Any thoughts or help would be greatly appreciated!

Regards,

Chumley
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Re: graphs 2 hours behind system time

Post by Linegod »

--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
Dranrev
Posts: 3
Joined: Tue Nov 02, 2010 8:46 am

Re: graphs 2 hours behind system time

Post by Dranrev »

I changed the php.ini timezone. The graph is updated but the cacti logs is still the same.
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Re: graphs 2 hours behind system time

Post by Linegod »

And you restarted apache after reseting php.ini?
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
Dranrev
Posts: 3
Joined: Tue Nov 02, 2010 8:46 am

Re: graphs 2 hours behind system time

Post by Dranrev »

Yes I already started the Apache and even restarted the PC.
rafchumley
Posts: 19
Joined: Tue Jan 25, 2005 2:17 pm

Re: graphs 2 hours behind system time

Post by rafchumley »

Heya Linegod and Dranrev,

Linegod: Thanks for putting me on the path to salvation :)

I fixed the issue on my CactiEZ 0.6 box like so:

Using the fix Linegod suggested seemed to have issues when I researched it FOR THE CACTIEZ VERSION OF PHP (5.1.6). You may have a newer version if you are running a different install of Cacti (i.e. not CactiEZ) and so this 'fix' may not apply. Specifically, setting the timezone manually would cause it to have to be redone when Daylight Savings Time ends for me (I am EST -5 "America/New York" where DST is observed). Since that is just this coming Sunday I didn't want to re-do it. So I installed the 'timezone.db' extension for PHP. This, my research suggested, would automagically adjust for DST etc. I installed it like so:

Prerequisites: CactiEZ is stripped down and so has no c++ compiler and is also missing 'phpize'. I fixed it all with the following:

Fix phpize issue with:

Code: Select all

yum install php-devel
Fix compiler issues with:

Code: Select all

yum install gcc gcc-cpp gcc-c++
Now I was ready to install the timezonedb.so module with:

Code: Select all

php /usr/share/pear/peclcmd.php install timezonedb
When that completed I added the module to php by:

Change to the correct dir:

Code: Select all

cd /etc/php.d
Create the file timezonedb.ini:

Code: Select all

touch timezonedb.ini
Now I edited the timezonedb.ini file with vi so it looks like:

Code: Select all

;enable timezonedb module so
;daylight savings correction is automagic
extension=timezonedb.so
Save and exit vi.

Now make sure your system clock is correct (this step may not be necessary but I did it anyway):

Code: Select all

date -s "D Mo Yr Hr:Min:Sec"
Now restart Apache:

Code: Select all

/ect/init.d/httpd restart
You can also verify that timezonedb is a loaded PHP module with:

Code: Select all

php -m
You should find timezonedb listed.

Now my graphs are showing they go up to the correct time. It should also automagically adjust for DST.

Hope that helps!

Regards,

Chum
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest