Cool zoom/history feature for cacti :)

Addons for Cacti and discussion about those addons

Moderators: Developers, Moderators

Post Reply
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

this is a part of source code my http://10.200.11.20/cacti/graph_view.ph ... &tree_id=1 web page:
(I cannot see the graph)

Code: Select all

<td><a href='graph.php?local_graph_id=9&rra_id=all'><img align='middle' alt='Localhost - Disk Space - /dev/cciss/c0d0'
				src='graph_image.php?local_graph_id=9&rra_id=1&graph_start=-86400&graph_height=100&graph_width=300&graph_nolegend=true' border='0' alt=''></a></td>
This is a part of source code of my http://10.200.11.20/cacti/graph.php?loc ... rra_id=all web page:
(I can see the graph)

Code: Select all

<td valign="top">
<table width='98%' style='background-color: #f5f5f5; border: 1px solid #bbbbbb;' align='center' cellpadding='3'><tr bgcolor='#6d88ad'><td colspan='3' class='textHeaderDark'><strong>Viewing Graph 'Localhost - Disk Space - /dev/cciss/c0d0'</strong></td></tr><tr><td>	<div align='center'><img src='graph_image.php?local_graph_id=9&rra_id=1' border='0' alt='Localhost - Disk Space - /dev/cciss/c0d0'></div>
This is a part of source code of my http://10.200.11.20/cacti/cactistoric.p ... 9&rra_id=1 web page:
(I can see this graph)

Code: Select all

<img src='graph_image.php?local_graph_id=9&rra_id=1' border='0' alt='Localhost - Disk Space - /dev/cciss/c0d0'>
And this is a part of source code of my http://10.200.11.20/cacti/cactistoric.p ... 9&rra_id=1 web page after query:
(I cannot see the graph)

Code: Select all

<img src='graph_image.php?local_graph_id=9&rra_id=1&graph_start=1061291918&graph_end=1061378318&graph_height=192&graph_width=800' border='0' alt='Localhost - Disk Space - /dev/cciss/c0d0'>
And,my php.ini (settings /usr/local/lib/php.ini) settings are :

Code: Select all

register_globals = On
register_argc_argv = On
DomFrance
Posts: 10
Joined: Mon Aug 18, 2003 5:05 am

Post by DomFrance »

Hi,

I got the same problem with "Undefined variable ..."

I solved it by modifying the cactistoric code (from the one based on 0.8.2a posted here) :

Code: Select all

>diff cactistoric.php cactistoric.php.new
49c49
< if ($start_year != "") {
---
> if (isset($start_year)) {


>diff rrd_functions.php rrd_functions.php.new
440c440
<                       if ($graph_data_array["graph_end"] != "") {             // Added for Cactistoric
---
>                       if (isset($graph_data_array["graph_end"])) {            // Added for Cactistoric

I'm not a pro in PHP, so I don't know exactly why I had to do that, but it works now. Seems like a PHP configuration parameter, or a PHP restriction on variable declarations in different versions.

Cacti 0.8.2a, W2K, PHP 4.3.0, rrdtool 1.0.40, mysql 3.23.55-nt, apache 2.0.47

Dom
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

DomFrance wrote:Hi,

I got the same problem with "Undefined variable ..."

I solved it by modifying the cactistoric code (from the one based on 0.8.2a posted here) :

Code: Select all

>diff cactistoric.php cactistoric.php.new
49c49
< if ($start_year != "") {
---
> if (isset($start_year)) {


>diff rrd_functions.php rrd_functions.php.new
440c440
<                       if ($graph_data_array["graph_end"] != "") {             // Added for Cactistoric
---
>                       if (isset($graph_data_array["graph_end"])) {            // Added for Cactistoric

I'm not a pro in PHP, so I don't know exactly why I had to do that, but it works now. Seems like a PHP configuration parameter, or a PHP restriction on variable declarations in different versions.

Cacti 0.8.2a, W2K, PHP 4.3.0, rrdtool 1.0.40, mysql 3.23.55-nt, apache 2.0.47

Dom
I dont understand which file and which lines must be changed ??? Explain please
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

Hey,
this code works for graph.php :)
But when I click zoom, I get this messagein my browser:

Code: Select all

Parse error: parse error in /www/htdocs/cacti/cactistoric.php on line 71
And cactistoric.php line 71 is:

Code: Select all

print "<table width='98%' style='background-color: #f5f5f5; border: 1px solid #bbbbbb;' align='center' cellpadding='3'>";
DomFrance
Posts: 10
Joined: Mon Aug 18, 2003 5:05 am

Post by DomFrance »

Hi,

I posted an answer yesterday for your previous question, but can't see it this morning :evil:
Did you find out how to modify the files ? In fact, in each file cactistoric.php and rrd_functions.php, you just have to replace one line (line 49 for the first one, line 440 for the other one).

Regarding your new problem, your line 71 seems correct, and I don't think my modification on line 49 is the cause. I suggest :
- check your line 70
or
- start over from the original cactistoric.php, as given in this forum, then apply again my modifications

Dom
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

Hi,
I configure my cactistoric.phpline 49 and rrd_functions.php line 440.
And my line 70 is empty.
Additionally, in tis forum, there is no modification is suggested about cactistoric. php :)
Bruno Prigent
Cacti User
Posts: 68
Joined: Tue Apr 22, 2003 5:51 am

Post by Bruno Prigent »

Hi,

Thanks DomFrance for your help. I corrected the code and upoaded it again on http://linkdown.org/download/cactistoric-0.8.2a.tar.gz
I think there is other similar bugs and (like I already said in a previous post) I recommend users to turn off the display_errors variable in php.ini file.
DomFrance
Posts: 10
Joined: Mon Aug 18, 2003 5:05 am

So useful

Post by DomFrance »

Hi Bruno,

Thanks for having updated your tool. In fact, I removed some of your changes (like the date of creation of the graph), but didn't include them in my post because I think many people want to keep them.

And I forgot to thank you very much for this *so useful* functionnality. Is it going to be included in official CACTI ? Do you want I vote for you ? :wink:

DomFrance
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

My vote for you.
Tomorrow i'm gonna change new cactistoric code. I just want cactistoric runs correctlyin my cacti ..
Guest

Post by Guest »

everything works untill i click on zoom and i get

Notice: Undefined variable: rra_id in /usr/local/www/data-dist/cacti/cactistoric.php on line 76



Here is what is on line 76

$graph_title = get_graph_title($_GET["local_graph_id"]);


Any ideas?
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

Bruno Prigent wrote:Hi,

Thanks DomFrance for your help. I corrected the code and upoaded it again on http://linkdown.org/download/cactistoric-0.8.2a.tar.gz
I think there is other similar bugs and (like I already said in a previous post) I recommend users to turn off the display_errors variable in php.ini file.
Hi Bruno,
Updated cactistoric works correctly :)
Everything seems fine.
Thank you for your assistances ...
But, I wanna say something to develop cactistoric.
As raX said, cactid is gonna substitute for cmd.php.
I try to use cactid because I have many rrd files. And cmd.php can't handle all in 5 min. So cactid do this procces in 6 sec.
I observe that when I use cactistoric and cactid at the same time graphs shown as 30 min average, not 5 min average. I mean shown in below:
Image
For this grap, I run

Code: Select all

./rrdtool  info /www/htdocs/cacti/rra/maltepe_gsm_7500_traffic_in_79.rrd
and I get:
...

Code: Select all

rra[1].rows=17280
...
rra[5].rovs=17280
...
Finally source of this graph is.

Code: Select all

/usr/local/rrdtool-1.0.35/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=1061882753 \
COMMENT:"From 2003-08-25 10:25:53 to 2003-08-26 10:25:53\c" \
COMMENT:"Graph Generated at 2003-08-26 10:25:53\c" \
--title="Maltepe GSM 7500 - Traffic -YENIBOSNA_TT (Se4/0/0:11)" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bits per second" \
DEF:a="/www/htdocs/cacti/rra/maltepe_gsm_7500_traffic_in_79.rrd":traffic_in:AVERAGE \
DEF:b="/www/htdocs/cacti/rra/maltepe_gsm_7500_traffic_in_79.rrd":traffic_out:AVERAGE \
CDEF:cdefa=a,8,* \
CDEF:cdefe=b,8,* \
AREA:cdefa#00CF00:"Inbound"  \
GPRINT:cdefa:LAST:" Current\:%8.2lf %s"  \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s\n"  \
LINE1:cdefe#002A97:"Outbound"  \
GPRINT:cdefe:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefe:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefe:MAX:"Maximum\:%8.2lf %s" 
As last, If cactistoric can be useful with cactid, I think we have a perfect, fast tool.
User avatar
pestilence
Cacti User
Posts: 207
Joined: Fri Jul 25, 2003 10:37 am
Location: Athens/Greece
Contact:

Post by pestilence »

Some people (like me) might have stumbled upon variable problems in the cactistoric file, i made a small addition to the file so that the posted variables are actually parsed within the file (this is a problem with the register_globals) parameter in the php.ini file.
So if you are experiencing problems such as the history graphs not being created add this line to the cactistoric.php (you could add this right under the include_once lines):
@import_request_variables("gpc");
(use the @ to suppress any warning messages about security hazards).
User avatar
pestilence
Cacti User
Posts: 207
Joined: Fri Jul 25, 2003 10:37 am
Location: Athens/Greece
Contact:

Post by pestilence »

Another small addition it seems the graph_end is missing from the graph_image.php (of the new tarball posted).
If your graphs do not end at the given date add the following line in the graph_image.php file:
(add it inside the if(!$empty($_GET["graph_start"])) part of the code)
:
//This will make sure we dont break the preview...
if(!empty($_GET["graph_end"]))
{
$graph_data_array["graph_end"] = $_GET["graph_end"];
}

After this you should be able to see the graph as it should be.
Guest

Post by Guest »

pestilence THANK YOU VERY MUCH

I did exactly as you said and my graphs are golden. Thanks again!
Bruno Prigent
Cacti User
Posts: 68
Joined: Tue Apr 22, 2003 5:51 am

Post by Bruno Prigent »

Thanks, I modified the tarball.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest