shinken-monitoring / mod-webui

Shinken Web User Interface
GNU Affero General Public License v3.0
79 stars 71 forks source link

Graph time issue #284

Closed Simage closed 9 years ago

Simage commented 9 years ago

Graphs appear to be generating timestamps in GMT+0200

generated graph url for the 4 hour graph is

http://graphite/render/?width=1617&height=539&fontSize=10&lineMode=connected&from=04:58_20150731&until=08:58_20150731&tz=America/Edmonton&title=bomar-pismo_coast/**HOST**%20-%20rtmin&target=alias(color(bomar.pismo_coast.shinken.**HOST**.rtmin,%22green%22),%22rtmin%22)

local time is GMT-0600 = 0058 Server time is GMT+0000 = 0658 until time in graph URL = 0858

Of course since the timezone in the URL is set at America/Edmonton (GMT+0600) the times are all apparently in the future and no graph is generated

Math all appears to be done in UTC, so where is the 0858 coming from?

Easiest solution may be to just use relative times and lose the absolute times. the above url would then read

http://graphite/render/?width=1617&height=539&fontSize=10&lineMode=connected&from=-4hours&tz=America/Edmonton&title=bomar-pismo_coast/**HOST**%20-%20rtmin&target=alias(color(bomar.pismo_coast.shinken.**HOST**.rtmin,%22green%22),%22rtmin%22)

which does work, however other graphing engines may not support this format. possibly force the graph module to convert from relative to absolute if the backing engine does not support relative times?

mohierf commented 9 years ago

As far as I understand, the 0858 comes from the WebUI when it requests graphs from its graph module. The graphs are requested with a start and end range. See eltdetail.tpl, around lines 1130 and lines 1160 ...

It will be interesting to change this behavior if the ui-graphite and ui-pnp modules were able to provide an interface with a duration rather than with a fixed range ...

I will propose a modification in the WebUI to remove the fixed date range.

mohierf commented 9 years ago

@Simage : I made some modifications in the WebUI to use only durations for graphs (see my latest commits). The idea is that the WebUI do not set start/end date anymore, but requests for the last 24 hours ...

If the ui-graphite module implements a _get_relative_graphuris function this function is called with the requested duration, else the _get_graphuris function is called with start/end date computed with the duration and time.time().

I will also commit a modification in the refactored branch of ui-graphite for the _get_relative_graphuris function ...

Simage commented 9 years ago

The get graphs url should work as is... the design behind it is to convert a unix timestamp to a compliant string and just pass anything else through. My bigger concern is for those using other graphing backends. Particularly pnp, does it support relative times, or will this change beak graphs for people using PNP

Simage commented 9 years ago

Actually.. you're doing something slightly different than I expected... I'll put together an alternate when I get to the office.. 10 or 15 minutes

mohierf commented 9 years ago

Please feel free to make some modifications ... no problem with this. I simply proposed something that will allow the WebUI to not use absolute time.

Simage commented 9 years ago

I was thinking something more like Simage/mod-webui@cb20b3069adcd08ebf07cd1f3b3a2f2d5c02d726

1 minute untested example, I'll try fleshing it out more when I get home tonight

mohierf commented 9 years ago

@Simage : any news about this issue ?

Simage commented 9 years ago

I have a solution thats working for us internally at this time, not quite certain how safe it is to integrate into mainline tho...

On 01/09/15 11:21 AM, Frédéric MOHIER wrote:

@Simage https://github.com/Simage : any news about this issue ?

— Reply to this email directly or view it on GitHub https://github.com/shinken-monitoring/mod-webui/issues/284#issuecomment-136801873.

mohierf commented 9 years ago

So I close