GithubHelp home page GithubHelp logo

Comments (13)

sni avatar sni commented on August 23, 2024
  1. Is it displayed wrong only on one page or everywhere? Can you try a
    %> perl -e 'print scalar localtime()."\n"'
    does it print the correct time? Have you checked the "datetime_format*" settings?
  2. Yes it should. I will fix this.

from thruk.

fancy-rabbit avatar fancy-rabbit commented on August 23, 2024

everywhere.
[@zjm_20_201 Thruk]# perl -e 'print scalar localtime()."\n"'
Sun Oct 17 17:01:08 2010

datetime_format = %Y-%m-%d %H:%M:%S
datetime_format_today = %H:%M:%S
datetime_format_long = %a %b %e %H:%M:%S %Z %Y
datetime_format_log = %B %d, %Y %H
datetime_format_trends = %a %b %e %H:%M:%S %Y

from thruk.

sni avatar sni commented on August 23, 2024
  1. seems like these are the default values. Is the time correct when you issue the command?
  2. its fixed in the latest git version.

from thruk.

fancy-rabbit avatar fancy-rabbit commented on August 23, 2024

yes, issuing the print scalar localtime command in perl gives the correct time. but everywhere in Thruk it's 14 hours ago.

from thruk.

sni avatar sni commented on August 23, 2024

Perl uses the TZ environment to determine the timezone, is it set somewhere?
%>TZ=EST perl -e 'print scalar localtime()."\n"'
Mon Oct 18 02:19:33 2010

Or could you set it for Thruk? For example in the ./script/thruk_fastcgi.pl. Depending on what script you use to start Thruk.
Just add a line at the top of the file after the #!.../perl
$ENV{'TZ'} = 'EST';

from thruk.

fancy-rabbit avatar fancy-rabbit commented on August 23, 2024

I tried
%>TZ='Asia/Shanghai' perl -e 'print scalar localtime() . "\n"'
and it gives the correct time.
i then added a line $ENV{'TZ'} = 'Asia/Shanghai' to ./script/thruk_fastcgi.pl, after restarting httpd, nothing has been changed.

but I noticed one exception, in status.cgi, it's correct time at the upperleft corner(curr network status):
Last Updated: Mon Oct 18 16:04:27 CST 2010
Updated every 90 seconds
Thruk 0.72 - www.thruk.org

but in the table below and in extinfo.cgi, the times are 14 hours ago.

from thruk.

sni avatar sni commented on August 23, 2024

Do you use the "use_timezone" in your nagios.cfg? Does Nagios display the correct time and which timezone does Nagios use? Is Nagios on the same box as Thruk?
When you take a look at the status.dat, are the times correct?
You can convert the timestamps with:
perl -le "print scalar localtime 123456789"

from thruk.

fancy-rabbit avatar fancy-rabbit commented on August 23, 2024

I didn't use 'use_timezone' in nagios.cfg. Nagios CGIs display the correct time.
Nagios and Thruk are on the same box.
timestamps are correct in status.dat

from thruk.

sni avatar sni commented on August 23, 2024

Ok, i found something. Could you try the latest git version? You can now set the timezone in your thruk_local.conf by adding:
use_timezone=Asia/Shanghai

from thruk.

fancy-rabbit avatar fancy-rabbit commented on August 23, 2024

latest version works well without use_timezone=Asia/Shanghai in thruk_local.conf.
thanks very much for fixing this:)

from thruk.

sni avatar sni commented on August 23, 2024

The "use_timezone" replaces the temporary workaround with adding the ENV{'TZ'} in your start script.
Thanks for reporting this issue.

from thruk.

fancy-rabbit avatar fancy-rabbit commented on August 23, 2024

in 'Event Log' /'Notifications'/'Alerts' pages, the navigation default period is from 14:00 to 14:00 tomorrow, which is weird. I remembered of this 14 hours ago problem and wondering if they're related with each other.

changing use_timezone doesn't help.

from thruk.

fancy-rabbit avatar fancy-rabbit commented on August 23, 2024

Hello sni,
I've found this problem is caused by Date::Manip for improperly translating Asia/Shanghai.
trying replacing Asia/Shanghai by Asia/Hong_Kong resolve this. I've submmited a bug report to the author of Date::Manip.
==UPDATE==
oh no, it is fixed when perl version>=5.10, but I've 5.8.8......

from thruk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.