[smokeping-users] any problem with setting display timezome for smokeping graphs?

G.W. Haywood ged at jubileegroup.co.uk
Sat Jun 14 10:42:39 CEST 2008

Hi there,

On Fri, 13 Jun 2008, Phillip Moore wrote:

> I am using smokeping master/slaves with hosts all over the place

Networks are often like that.  :)

> and my hosts are in GMT time.

It isn't clear to me what you mean by that.  I'll bet money that, if
you sit and think about it for a few minutes, you find that it isn't
as clear as you thought it was either.

> However, for display to a real human

Hehe.  There are some un-real ones around here too... :)

> I'd like to display in a local time zone the graphs so that
> correlations can easily be made with other graphing systems.  Is
> there any problem with just changing the time zone in smokeping.cgi?

Here be dragons.

'Local time' can be different for different users on the same machine,
so trying to set it in the server scripts might not be as simple as it
first appears.  For example I can log into a server in California and
use it just as if it were here in my office.  Is the 'local time' as
far as the server is concerned the same as my local time?  What time
is to be displayed if it's displayed by some Web interface used to set
system parameters in the machine?

> I've had mixed success changing $ENV{TZ} in a running perl script in
> the past.

Strange and unexpected things can happen when you start messing around
with things like TZ.  Here I am in the UK, it's summer, we're on BST:

tornado:~$ >>> date
Sat Jun 14 09:52:47 BST 2008
tornado:~$ >>> export TZ='PDT'
tornado:~$ >>> date
Sat Jun 14 08:52:59 PDT 2008

Ah.  Not at all what I expected.  Why isn't it two in the morning on
the pacific coast?  Because there isn't a 'PDT' in /usr/share/zoneinfo
on this particular machine.  Ooops.

tornado:~$ >>> date
Sat Jun 14 09:53:02 BST 2008
tornado:~$ >>> export TZ='PST8PDT'
tornado:~$ >>> date
Sat Jun 14 01:53:05 PDT 2008

Ah, that's better.

> I also don't want to cause confusion with the slaves sending data in
> GMT and then the master (smokeping.cgi) getting confused because it
> is US/ Pacific for instance just so graphs display in a friendly
> timezone.

I suppose you really want the GUI to know the locale of the particular
user who happens to be using his browser to look at Smokeping graphs.
It would give me nightmares.

Take a look at

perldoc perllocale


perldoc POSIX

to get an idea of what you might be letting yourself in for.

When you've finally got it all working how it should, you'll probably
find that you're the only one who has, and all the tools that you're
trying to use for comparisons do it differently...

FWIW I generally don't believe any time information I see anywhere
unless it's in the logs.  I've taken some trouble to make sure that
there, they are what I expect them to be.  It takes up too much time
to do that everywhere else.  On my networks, most of the time there
are some more-or-less periodic traffic features.  For example nightly
backups are started by 'cron' using the system clock as a reference.
They chew up quite a lot of resources, and make it easy to see the
relative timescales:


If you don't have features like that in your network traffic it might
well be worth creating some.



More information about the smokeping-users mailing list