Cacti Pi – Correcting Cacti Timezone

Correcting Cacti Timezone

Battled a super annoying issue with what appeared to be Cacti not displaying graphs, which after half a day of messing around ended up being a timezone setting…..grrrrrrrrrrrr

After discovering Cacti was indeed graphing my expected values, just 4 hours ahead of my local time (EDT, America/Toronto) I realized cacti.log was showing UTC timestamps.

After confirming my Linux system time:

pi@raspberrypi ~ $ date
Fri Aug 17 04:39:13 EDT 2012

I dug around on cacti.net and found instructions on updating php.ini with timezone values:

http://docs.cacti.net/faq#time_zone_warning

I had seen this warning while checking the apache2 error log earlier and corrected the php.ini file accordingly:

sudo vi /etc/php5/apache2/php.ini

/timezone

date.timezone = America/Toronto

:wq

The list of supported php timezones can be found here

No luck. Cacti’s log still tracked in UTC and graph timezones were still off. I read about mysql and rrdtool timezone altering etc…but both tools were fine, showing the correct system time.

finally i decided to search for any other php.ini file that might exist on my system:

sudo find / -name php.ini

/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini

what do you know…..

updated the alternate php.ini file accordingly, restarted apache….and we’re live!

wow…i need a beer.

 

 

 

 

 

9 thoughts on “Cacti Pi – Correcting Cacti Timezone”

  1. Thanks a ton for this post, fixed my exact problem. I spent hours trying to figure out why it wasn’t getting data, then found out it was just offset by 7 hours. Editing php.ini did the trick, thanks again.

  2. None of this worked for me. However, adding this line to the top of graph_image.php worked! Under <?php

    <?php
    putenv('TZ=Europe/London');

    It's 2015. Can't believe this still isn't fixed!

  3. hey, I have the same problem and I’ve tried all things
    I have corrected the date.timezone=Asia/Jakarta in php.ini file
    I added putenv in graph_image.php and still have the trouble

    1. Hey Farras!

      So let’s review.

      1. What is the output of your the date command on your machine?

      2. Did you update both php.ini files?

      3. What timezone is cacti.log showing?

  4. 1. The date from the machine Sun Apr 24 22:20:19 WIB 2016

    2. I just had one php.ini file because I run the cacti on CentOS 7

    3. Date Sun, 24 Apr 2016 15:19:31 +0000
    thats what I found on cacti tech support

Leave a Reply

Your email address will not be published. Required fields are marked *