New plugin: Timeshift (v0.1)

Announcements concerning Plugins for Cacti

Moderators: Moderators, Developers

Author
Message
rvd
Posts: 34
Joined: Wed Nov 21, 2007 10:09 am
Location: France

New plugin: Timeshift (v0.1)

#1 Post by rvd » Fri Oct 14, 2011 8:18 am

Hi all,
I was wondering how have a visual graph evolution from one timespan to next. As an example, understand in a glance that load average which was very high each monday is this week much lower.
My purpose was to be able to have this evolution on a screen, vertically, starting from last timespan ans going backwards.
So I created a plugin :
http://docs.cacti.net/userplugin:timeshift
Easy to use, just enter host and then graph, timespan (hour, day, week, month, year) and number of timespans to see in addition to last one
See attached screenshot
s_timeshift2.png
LA now and 2 weeks before
s_timeshift2.png (53.12 KiB) Viewed 5962 times

User avatar
Linegod
Developer
Posts: 1630
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Re: New plugin: Timeshift (v0.1)

#2 Post by Linegod » Fri Oct 14, 2011 7:04 pm

Very nice.
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca

bakkapo
Posts: 15
Joined: Fri Oct 21, 2011 3:04 am

Re: New plugin: Timeshift (v0.1)

#3 Post by bakkapo » Fri Oct 21, 2011 3:16 am

Hi,
the idea is very simple, but at the same the plugin can be very useful. Thank you for sharing it.
I would like to ask, what version of Cacti it is tested with, because with the 0.8.7e and PIA 2.5 I meet some problems:
When i go to the Timeshift Tab, the following messages are noticed and the plugin is not working. If you have any ideas , any piece of advice will be appreciated.

With the latest version of Cacti and PIA, the issue is not visible.
--------------------------------------------------------------------------------------------------------------------------------------------
Notice: Undefined index: timeshift.php: in /usr/share/cacti/site/lib/functions.php on line 1743

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/cacti/site/plugins/timeshift/timeshift.php:22) in /usr/share/cacti/site/include/global.php on line 135

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/cacti/site/plugins/timeshift/timeshift.php:22) in /usr/share/cacti/site/include/global.php on line 136

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/cacti/site/plugins/timeshift/timeshift.php:22) in /usr/share/cacti/site/include/global.php on line 137

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/cacti/site/plugins/timeshift/timeshift.php:22) in /usr/share/cacti/site/include/global.php on line 138

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/cacti/site/plugins/timeshift/timeshift.php:22) in /usr/share/cacti/site/include/global.php on line 139

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/cacti/site/plugins/timeshift/timeshift.php:22) in /usr/share/cacti/site/include/global.php on line 141

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /usr/share/cacti/site/plugins/timeshift/timeshift.php:22) in /usr/share/cacti/site/include/global.php on line 145
----------------------------------------------------------------------------------------------------------------------
Notice: Undefined index: timeshift_res.php: in /usr/share/cacti/site/lib/functions.php on line 1743
Logged in as glakovski (Logout)
ce: Undefined variable: timespan_name in /usr/share/cacti/site/plugins/timeshift/timeshift_res.php on line 54
Viewing Graph Aggregate eBSCs GbIP Traffic for last 10


BR,
Georgi

rvd
Posts: 34
Joined: Wed Nov 21, 2007 10:09 am
Location: France

Re: New plugin: Timeshift (v0.1)

#4 Post by rvd » Fri Oct 21, 2011 3:49 am

Hi Georgi,
Cacti version is 0.8.7g and PIA 2.8
It seems to be an issue with headers, could you please send me the page source code with 0.8.7e ? (my email is in plugin page)
Regards

rvd
Posts: 34
Joined: Wed Nov 21, 2007 10:09 am
Location: France

Re: New plugin: Timeshift (v0.1)

#5 Post by rvd » Thu Oct 27, 2011 4:08 am

To get rid of these messages
bakkapo wrote: Notice: Undefined index: timeshift.php: in /usr/share/cacti/site/lib/functions.php on line 1743
Notice: Undefined index: timeshift_res.php: in /usr/share/cacti/site/lib/functions.php on line 1743
- Uninstall plugin
- Add one line in setup.php (in function timeshift_draw_navigation_text), see below :
# diff setup.php setup.php.old
71d70
< return $nav;
- Reinstall plugin

jet755
Posts: 19
Joined: Fri Oct 28, 2011 8:50 pm

Re: New plugin: Timeshift (v0.1)

#6 Post by jet755 » Mon Nov 21, 2011 12:53 am

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\cacti\plugins\timeshift\timeshift.php:22) in C:\AppServ\www\cacti\include\global.php on line 141

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\cacti\plugins\timeshift\timeshift.php:22) in C:\AppServ\www\cacti\include\global.php on line 142

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\cacti\plugins\timeshift\timeshift.php:22) in C:\AppServ\www\cacti\include\global.php on line 143

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\cacti\plugins\timeshift\timeshift.php:22) in C:\AppServ\www\cacti\include\global.php on line 144

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\cacti\plugins\timeshift\timeshift.php:22) in C:\AppServ\www\cacti\include\global.php on line 145

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\cacti\plugins\timeshift\timeshift.php:22) in C:\AppServ\www\cacti\include\global.php on line 148

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\cacti\plugins\timeshift\timeshift.php:22) in C:\AppServ\www\cacti\include\global.php on line 152

jet755
Posts: 19
Joined: Fri Oct 28, 2011 8:50 pm

Re: New plugin: Timeshift (v0.1)

#7 Post by jet755 » Mon Nov 21, 2011 12:55 am

Windows Server 2003
Apache Web Server Version 2.2.4
PHP Script Language Version 5.2.3
MySQL Database Version 5.0.45

Cacti 0.8.7.h
PIA 3.0
Timeshift 0.1
Last edited by jet755 on Mon Nov 21, 2011 1:30 am, edited 1 time in total.

jet755
Posts: 19
Joined: Fri Oct 28, 2011 8:50 pm

Re: New plugin: Timeshift (v0.1)

#8 Post by jet755 » Mon Nov 21, 2011 12:58 am

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<SCRIPT TYPE="text/javascript" SRC="./js/jquery-latest.min.js">
</SCRIPT>
<!-- JavaScript function to display #graphs to select in nb_t zone
starting from 1 to a value depending on timespan
daily : 6, weekly: 3, monthly: 11, yearly: 4 hourly: 23
You may want to change that here -->
<SCRIPT TYPE="text/javascript">
function listNbint( rra_chosen ) {
var optnb=document.laforme.nb_t;
var incr =0;
var i =0;
optnb.options.length=0;
switch ( rra_chosen ) {
case "1":
incr=6;
break;
case "2":
incr=3;
break;
case "3":
incr=11;
break;
case "4":
incr=4;
break;
case "7":
incr=23;
break;
}
for ( i=1; i<=incr; i++ ) {
optnb.options[optnb.options.length]=new Option( i, i );
}
}
</SCRIPT>
</HEAD>
<!-- onLoad : display hourly (7 in rra table). You may change that -->
<BODY onLoad="listNbint('7');">
<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\cacti\plugins\timeshift\timeshift.php:22) in <b>C:\AppServ\www\cacti\include\global.php</b> on line <b>141</b><br />
<br />
......

jet755
Posts: 19
Joined: Fri Oct 28, 2011 8:50 pm

Re: New plugin: Timeshift (v0.1)

#9 Post by jet755 » Mon Nov 21, 2011 12:59 am

......

<b>Warning</b>: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\cacti\plugins\timeshift\timeshift.php:22) in <b>C:\AppServ\www\cacti\include\global.php</b> on line <b>148</b><br />
<br />
<b>Warning</b>: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\cacti\plugins\timeshift\timeshift.php:22) in <b>C:\AppServ\www\cacti\include\global.php</b> on line <b>152</b><br />
<html>
<head>
<title>Cacti</title>
<meta http-equiv=refresh content='300'>
<link href="/cacti/include/main.css" rel="stylesheet">
<link href="/cacti/images/favicon.ico" rel="shortcut icon"/>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<a name='page_top'></a>

<table width="100%" height="100%" cellspacing="0" cellpadding="0">
<tr height="37" bgcolor="#a9a9a9" class="noprint">
<td colspan="2" valign="bottom" nowrap>
<table width="100%" cellspacing="0" cellpadding="0">
<tr>

......

jet755
Posts: 19
Joined: Fri Oct 28, 2011 8:50 pm

Re: New plugin: Timeshift (v0.1)

#10 Post by jet755 » Mon Nov 21, 2011 1:27 am

Hi rvd,

Thanks for the timeshift plugin, It works!
But I got some warning lines on the top of the page,
Could you help me to get rid of them?

Best regards.

rvd
Posts: 34
Joined: Wed Nov 21, 2007 10:09 am
Location: France

Re: New plugin: Timeshift (v0.1)

#11 Post by rvd » Mon Nov 21, 2011 4:51 am

Hi jet755,
To get rid of "Warning: Cannot modify header information - headers already sent by..." you may try something like:
error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING
in php.ini (then restart apache)
Regards
jet755 wrote:Hi rvd,

Thanks for the timeshift plugin, It works!
But I got some warning lines on the top of the page,
Could you help me to get rid of them?

Best regards.

jet755
Posts: 19
Joined: Fri Oct 28, 2011 8:50 pm

Re: New plugin: Timeshift (v0.1)

#12 Post by jet755 » Mon Nov 21, 2011 7:32 am

Thanks! After modify and restart apache, I get the same warning lines, why
rvd wrote:Hi jet755,
To get rid of "Warning: Cannot modify header information - headers already sent by..." you may try something like:
error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING
in php.ini (then restart apache)
Regards
jet755 wrote:Hi rvd,

Thanks for the timeshift plugin, It works!
But I got some warning lines on the top of the page,
Could you help me to get rid of them?

Best regards.

rvd
Posts: 34
Joined: Wed Nov 21, 2007 10:09 am
Location: France

Re: New plugin: Timeshift (v0.1)

#13 Post by rvd » Mon Nov 21, 2011 7:48 am

Please send me a screen copy as PM

jet755
Posts: 19
Joined: Fri Oct 28, 2011 8:50 pm

Re: New plugin: Timeshift (v0.1)

#14 Post by jet755 » Mon Nov 21, 2011 7:29 pm

Sorry, My PC is behind a proxy server that forbid to upload any attachment and image.

When I click the 'Timeshift' menuitem, the warning lines are displayed just above the main menu bar, with the white color background.

I got the same warnings with IE8 and FireFox 7.
Last edited by jet755 on Mon Nov 21, 2011 8:13 pm, edited 3 times in total.

jet755
Posts: 19
Joined: Fri Oct 28, 2011 8:50 pm

Re: New plugin: Timeshift (v0.1)

#15 Post by jet755 » Mon Nov 21, 2011 7:56 pm

Whenever I click the "Timeshift" menuitem, the warning lines appear.

After I choose the "Host,Graph,RRA,Timeshifts" and click the "Go" button, the graph page is OK, and the warning lines disappeared.

Post Reply