Time Shifter

Addons for Cacti and discussion about those addons

Moderators: Developers, Moderators

Post Reply
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Time Shifter

Post by gandalf »

The cacti user Instigater proposed a new feature, see Timespan browsing. Due to some experience with cacti we made last few days, I realized this to be a very nice feature. So I decided to implement this based on current 0.8.6h svn branch.
Luckily, this patch only changes two files, include/html/inc_timespan_settings.php and include/html/inc_timespan_selector.php. Two new files for the images are needed, images/move_left.gif and images/move_right.gif.

Installing
Copy attached files to your current cacti directory.

Code: Select all

tar -zxf cacti_patch_time_shifter_images.tar.gz
will expand the images to the images/ directory.

Code: Select all

patch -p1 < cacti_patch_time_shifter.patch
will patch both mentioned php files. That's all.

Using
This patch extends the time selection bar with a new feature, see

Image


It features time shifting left and time shifting right. In each case, Start and End Time of the Graph(s) are shifted by the current interval size (= time difference between start and end). Using the Default timespan of one day, shifting left will shift one day to the past. You may shift multiple times, of course.

Image


If you do not want to only shift for one day, please select first a new Preset, e.g. one week.


Image


Now, shifting left will shift for one week (actually, I shifted left TWO times, because my graphs did not contain any data for one week backwards)


Image


Please notice: when shifting right, no times exceeding the actual time() are allowed. When shifting beyond that time, end time will automatically be set to the actual timestamp. Start time will be set to end time - interval.
Time Shifter will not only work in Tree Mode but also in Preview Mode


Image


Due to the fact, that changes are little, it may be possible to apply this patch to other versions of cacti.
As always Use this at your own risk

happy cactiing
Reinhard
Attachments
cacti_patch_time_shifter.patch
Download to cacti dir and apply using
patch -p1 &lt; cacti_patch_time_shifter.patch
(5 KiB) Downloaded 598 times
cacti_patch_time_shifter_images.tar.gz
Download to cacti dir and apply using
tar -zxf cacti_patch_time_shifter_images.tar.gz
(314 Bytes) Downloaded 569 times
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Thanks a lot, this feature is VERY useful :)
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

I'm getting:

Code: Select all

/usr/share/cacti # patch -pl < cacti_patch_time_shifter.patch
patch: **** strip count l is not a number
Ideas?
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Hi

it's "patch minus P ONE" (not L) :wink:
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

LOL - oops
keen
Posts: 11
Joined: Mon Jan 09, 2006 3:09 am

Post by keen »

thanks for added functionality :)

However I realised, if I specify a time period such as:

Begin: 00:00hrs
End: 23:59hrs

I will end up with the following after clicking shift right 4 times:

2006-02-01 00:00 2006-02-01 23:59
2006-02-01 23:59 2006-02-02 23:58
2006-02-02 23:58 2006-02-03 23:57
2006-02-03 23:57 2006-02-04 23:56
2006-02-04 23:56 2006-02-05 23:55

I realised if using both start and end as 00:00 would be ok:

2006-02-01 00:00 2006-02-02 00:00
2006-02-02 00:00 2006-02-03 00:00
2006-02-03 00:00 2006-02-04 00:00
2006-02-04 00:00 2006-02-05 00:00
2006-02-05 00:00 2006-02-06 00:00

Is there a way to supposedly shift right, but the next time period would be exactly 00:00 - 23:59 ?

For example if it is now displaying:

Start: A Day BB:CC
End: X Day YY:ZZ

after clicking shift right, the displayed range would start from X Day YY:ZZ+1 ?

Anyway to implement this or would this be not useful?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

keen wrote:thanks for added functionality :)

However I realised, if I specify a time period such as:

Begin: 00:00hrs
End: 23:59hrs
damn it. I knew someone would find this. This "feature" is called "programmers lazyness".
Is there a way to supposedly shift right, but the next time period would be exactly 00:00 - 23:59 ?

For example if it is now displaying:

Start: A Day BB:CC
End: X Day YY:ZZ

after clicking shift right, the displayed range would start from X Day YY:ZZ+1 ?

Anyway to implement this or would this be not useful?
This was not implemented on purpose. I thought that shifting right beyond the latest timestamp would be "strange". In fact, I did not try this but feared rrdtool would complain about that. So I made a special test that shifting right will not exceed time() (as explained above).

Currently I'm "working" (alias for: perhaps I'll do it, perhaps not) on V0.2. This should include a "Time Shift Selector" as a copy of the "Preset" Dropdown and initialised to the same value as the Preset. So you would be able to have a Preset of "Last Day" but Shift e.g. "1 Week". I think this should stop at time() as well when shifting right.
Another "feature" might me some "lock at 00:00" feature which would automatically set the left boundary to "first date currently displayed, but starting at 00:00" and keeping the actual timespan. But I need a GIF picture for that. Would a circle be good?
Reinhard
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Find my new work at [revisitied] Time Shifter V0.2
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests