Cactiquery-Cactistoric Release

Addons for Cacti and discussion about those addons

Moderators: Developers, Moderators

User avatar
pestilence
Cacti User
Posts: 207
Joined: Fri Jul 25, 2003 10:37 am
Location: Athens/Greece
Contact:

Cactiquery-Cactistoric Release

Post by pestilence »

Ok here goes the first release of cactistoric-cactiquery addon for cacti.
Thanks to Bruno once again for inspiring and his code.
Attachments
cactiquery-cactistoric-0.8.5-0.02-en.tar.gz
(33.41 KiB) Downloaded 909 times
Last edited by pestilence on Sat May 08, 2004 2:28 am, edited 1 time in total.
/* * Oops. The kernel tried to access some bad page. We'll have to * terminate things with extreme prejudice. */ die_if_kernel("Oops", regs, error_code);
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 pestilence

thanks for combining cactiquery & cactistoric :)

I've tried it with Cacti 0.8.5a (Gentoo Linux, Apache 2.0.49, PHP 4.3.6RC2, MySQL 4.0.18, rrdtool 1.0.45) but it didn't work :

Code: Select all

No data was found for the given device and timespan
Here's the command that cactiquery was running :

Code: Select all

rrdtool fetch /path/to/dir/file.rrd LAST -r 300 -s 1083477600 -e 1083564000
Running this command by hand returned this :

Code: Select all

ERROR: the RRD does not contain an RRA matching the chosen CF
I'm using the following RRAs :
daily (modified to keep 51840 rows), with CF AVERAGE and MAX
weekly with CF AVERAGE and MAX
montly with CF AVERAGE and MAX
yearly with CF AVERAGE and MAX
So I've tried the following command :

Code: Select all

rrdtool fetch /path/to/dir/file.rrd AVERAGE -r 300 -s 1083477600 -e 1083564000
and it worked :

Code: Select all

cpu_idle

1082008800: 1.9531167991e+01
1082009100: 1.8342991318e+01
1082009400: 2.0238037904e+01
1082009700: 1.9606805113e+01
I've then add a quick and dirty fix to lib/rrd.php :

Code: Select all

$type = "AVERAGE";
before the line running rrdtool, and it works.

My second problem is that I can't export to a CSV file; here's what I get :

Code: Select all

Notice: Undefined variable: regexps in /cacti/cacti-0.8.5a/lib/rrd.php on line 619
Viewing Query for 'Sauvegardes - Hermes - Consommation CPU' 
 
Writting to file: /var/www/localhost/htdocs/cacti_csv/10.50.50.50-SteriaCPUidle.csv 
Warning: Invalid argument supplied for foreach() in /cacti/cacti-0.8.5a/lib/rrd.php on line 656

Notice: Undefined index: values in /cacti/cacti-0.8.5a/lib/rrd.php on line 665
 [Download][Return] 
Notice: Undefined variable: regexps in /cacti/cacti-0.8.5a/lib/rrd.php on line 619
Do you know how to solve this ?

Many thanks in advance.

Edit : BTW, I don't have the drop down list "Type" as shown in your screenshot; is it normal / related to my problem ?

Regards,

Frédéric
User avatar
pestilence
Cacti User
Posts: 207
Joined: Fri Jul 25, 2003 10:37 am
Location: Athens/Greece
Contact:

Post by pestilence »

I know this issue, i had a menu for allowing the user to choose if he wanted the values for Min, Last, Max or Average..but because i always use only with last values i removed it for practical purposes...if you want it i will add it in the next release of cactiquery.
Thanks for the response :)
/* * Oops. The kernel tried to access some bad page. We'll have to * terminate things with extreme prejudice. */ die_if_kernel("Oops", regs, error_code);
User avatar
pestilence
Cacti User
Posts: 207
Joined: Fri Jul 25, 2003 10:37 am
Location: Athens/Greece
Contact:

Post by pestilence »

My second problem is that I can't export to a CSV file; here's what I get :

Code: Select all

Notice: Undefined variable: regexps in /cacti/cacti-0.8.5a/lib/rrd.php on line 619
Viewing Query for 'Sauvegardes - Hermes - Consommation CPU' 
 
Writting to file: /var/www/localhost/htdocs/cacti_csv/10.50.50.50-SteriaCPUidle.csv 
Warning: Invalid argument supplied for foreach() in /cacti/cacti-0.8.5a/lib/rrd.php on line 656

Notice: Undefined index: values in /cacti/cacti-0.8.5a/lib/rrd.php on line 665
 [Download][Return] 
Notice: Undefined variable: regexps in /cacti/cacti-0.8.5a/lib/rrd.php on line 619
Do you know how to solve this ?

Many thanks in advance.

Edit : BTW, I don't have the drop down list "Typ
e" as shown in your screenshot; is it normal / related to my problem ?

Regards,

Frédéric

I am looking for your problem right now, i will try to find out why you get this error.
/* * Oops. The kernel tried to access some bad page. We'll have to * terminate things with extreme prejudice. */ die_if_kernel("Oops", regs, error_code);
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

In fact my 2 problems where related; I've changed

Code: Select all

print " <tr><td colspan='3' align='center'><strong>[<a href='cactidump.php?local_graph_id=$local_graph_id&rra_id=$rra_id&query_start=$query_start&query_end=$query_end&typeq=LAST'>Dump to CSV</a>]</strong></td></tr>";
to

Code: Select all

print " <tr><td colspan='3' align='center'><strong>[<a href='cactidump.php?local_graph_id=$local_graph_id&rra_id=$rra_id&query_start=$query_start&query_end=$query_end&typeq=AVERAGE'>Dump to CSV</a>]</strong></td></tr>";
in cactiquery.php, and now I can export to CSV :D
DeepInTrouble

Cacti-query/Cactistoric messed up my Interface traffic graph

Post by DeepInTrouble »

Hello,
After installing cactiquery-cactistoric, I am unable to get graphs for traffic on my interfaces.
Cacti - 0.8.5a
Win 2K server
IIS5
Perl 5.8
Mysql
PHP

Errors: From the "source link":
Notice: Undefined offset: 2 in C:\Inetpub\wwwroot\cacti-0.8.5a\lib\rrd.php on line 735

Notice: Undefined offset: 2 in C:\Inetpub\wwwroot\cacti-0.8.5a\lib\rrd.php on line 739

Notice: Undefined offset: 2 in C:\Inetpub\wwwroot\cacti-0.8.5a\lib\rrd.php on line 743

c:/rrdtool/rrdtool.exe graph - \
--imgformat=PNG \
--start=end-86400 \
--end=1083714093 \
COMMENT:"From 2004-05-03 19:41:33 to 2004-05-04 19:41:33\c" \
COMMENT:"Graph Generated at 2004-05-04 19:41:33\c" \
--title="Cisco3640 - Traffic - Se0/0" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bits per second" \
DEF:a="C\:\Inetpub\wwwroot\cacti-0.8.5a/rra/cisco3640_traffic_in_42.rrd":traffic_in:AVERAGE \
DEF:b="C\:\Inetpub\wwwroot\cacti-0.8.5a/rra/cisco3640_traffic_in_42.rrd":traffic_out:AVERAGE \
CDEF:cdefa=a,8,* \
CDEF:cdeff=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" \
COMMENT:"Total In: 0 bytes\n" \
LINE1:cdeff#002A97:"Outbound" \
GPRINT:cdeff:LAST:"Current\:%8.2lf %s" \
GPRINT:cdeff:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdeff:MAX:"Maximum\:%8.2lf %s" \
COMMENT:"Total Out: 0 bytes"

What is wrong here? I have changed the rows for all the .rrd files. Infact I deleted my old .rrd files and started off brand new.
----------------------------------------------------------------------------
2. I tried to use the cactiquery on other graph that I was getting but the query did not give any data. I saw the post by "fmangeant" where he said adding the line "$type = "AVERAGE"; solved the problem. It did not for me. Could some one please tell me where to add the line? Or "pestilence" is it possible for you to send me the php file with the menu that let users choose what values they wanted to - min, max, average or last?


Thank you in advance for any help

Take care
Deepak
User avatar
pestilence
Cacti User
Posts: 207
Joined: Fri Jul 25, 2003 10:37 am
Location: Athens/Greece
Contact:

Post by pestilence »

New cactiquery-cactistoric release.
I have fixed the issue with the form, now you can select what you want to query from the Data source (MIN,LAST,MAX,AVERAGE).
Attachments
cactiquery-cactistoric-0.8.5-0.02-en.tar.gz
(33.41 KiB) Downloaded 743 times
Last edited by pestilence on Fri May 07, 2004 4:01 am, edited 1 time in total.
/* * Oops. The kernel tried to access some bad page. We'll have to * terminate things with extreme prejudice. */ die_if_kernel("Oops", regs, error_code);
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 pestilence

thanks for this new release :D

I had an error when exporting to CSV :

Code: Select all

Parse error: parse error, unexpected ')', expecting ']' in /cacti/cacti-0.8.5a/cactidump.php on line 89
There seems to miss one bracket :

Code: Select all

if(isset($_GET['typeq'))
instead of

Code: Select all

if(isset($_GET['typeq']))
And could you just add one line in include/config_arrays.php :

Code: Select all

$hash_version_codes = array(
        "0.8.4" => "0000",
        "0.8.5" => "0001",
        "0.8.5a" => "0002"
        );
instead of

Code: Select all

$hash_version_codes = array(
        "0.8.4" => "0000",
        "0.8.5" => "0001"
        );
Thanks in advance.

Frédéric
User avatar
pestilence
Cacti User
Posts: 207
Joined: Fri Jul 25, 2003 10:37 am
Location: Athens/Greece
Contact:

Post by pestilence »

Ok i have fixed the problems, thanks for the help :) The fixed tarball has replaced the old one in the above post.
Regards.
/* * Oops. The kernel tried to access some bad page. We'll have to * terminate things with extreme prejudice. */ die_if_kernel("Oops", regs, error_code);
jrewing
Posts: 3
Joined: Tue May 04, 2004 4:48 am
Location: Prague, Czech Rep

Post by jrewing »

Hi Pestilence,

thank you for fixes,impossibility to export data from the database more

than 24 h back was my mistake. Sorry,now it works fine.

Only solution for combined graphs would be nice.

Thx.
jrewing
Posts: 3
Joined: Tue May 04, 2004 4:48 am
Location: Prague, Czech Rep

Post by jrewing »

Hi Pestilence,

thank you for fixes,impossibility to export data from the database more

than 24 h back was my mistake. Sorry,now it works fine.

Only solution for combined graphs would be nice.

Thx.
karunesh
Posts: 15
Joined: Mon Feb 02, 2004 1:25 pm
Location: India

error

Post by karunesh »

Pestilence.

I upgraded cacti from 0.8.4 to 0.8.5a and installed cactiquery as per the instruction.Now when I click the [Zoom] or [Query] button on interface. I get the following error.

Zoom
------
Parse error: parse error, unexpected $ in /var/www/html/cacti/cactistoric.php on line 265

Query
------
Parse error: parse error, unexpected $ in /var/www/html/cacti/cactiquery.php on line 245

Any clue..

Karunesh
__Kårunesh__
User avatar
pestilence
Cacti User
Posts: 207
Joined: Fri Jul 25, 2003 10:37 am
Location: Athens/Greece
Contact:

Re: error

Post by pestilence »

karunesh wrote:Pestilence.

I upgraded cacti from 0.8.4 to 0.8.5a and installed cactiquery as per the instruction.Now when I click the [Zoom] or [Query] button on interface. I get the following error.

Zoom
------
Parse error: parse error, unexpected $ in /var/www/html/cacti/cactistoric.php on line 265

Query
------
Parse error: parse error, unexpected $ in /var/www/html/cacti/cactiquery.php on line 245

Any clue..

Karunesh
Thats wierd that lines mark the EOF of each file. Gonna check it again tonight...
/* * Oops. The kernel tried to access some bad page. We'll have to * terminate things with extreme prejudice. */ die_if_kernel("Oops", regs, error_code);
karunesh
Posts: 15
Joined: Mon Feb 02, 2004 1:25 pm
Location: India

graph crop

Post by karunesh »

One more issue.When I run the following script to resize the existing rrd graphs from 600 to 17280 rows, it resizes the rrd but unfortunatly it deleted the rrd data earlier then 2 weeks.I lost the data older then 2 weeks :(.

for f in `find . -maxdepth 1 -name \*\.rrd`
do
echo "-- Working on $f"
echo " Growing RRA 0"
rrdtool resize $f 0 GROW 16680
mv resize.rrd $f
echo " Growing RRA 4"
rrdtool resize $f 4 GROW 16680
mv resize.rrd $f
echo "Done."
done

What happen to my old data :(.
__Kårunesh__
User avatar
MagnaChef
Cacti User
Posts: 164
Joined: Tue Nov 25, 2003 3:58 pm
Location: Buffalo, NY

Post by MagnaChef »

Allow me to redirect you to a thread that will hopefully come to some conclusions about how to resolve this. From what I read, when you're adding A LOT of rows to your RRA's (such as you do here) it can cause consolidation problems when you try and graph the data. This is due to the large amounts of rows that contains "NaN" that have been added. It is best to resize the RRA's a little every week or two. Quite a pain, but hopefully we'll come up with a better solution.

http://www.raxnet.net/board/viewtopic.php?t=4038

Perhaps this can clear some things up (Referenced from: http://www.ee.ethz.ch/~slist/rrd-users/msg05809.html )
If you add rows to the 5-minute RRA these rows will contain NaN values.
If you add enough rows to satisfy a request for a complete year, you
will fetch the 5-minute rows and thus see unknown data. You expect to
see known data thus RRDtool doesn't seem to match your expectations.

This can be circumvented: If you ask for "--end hh:mm" "--start
end-365days"
where "hh:mm" is midnight UTC represented in your local time, RRDtool
will use the original 1-day RRA and thus will not use the freshly added
5-minute rows.

In general: RRDtool will try to match your request as close as possible.

For MRTG-compatible RRDs this means RRDtool won't use the "daily" RRA
to graph a full year. It cannot use the "weekly" or "monthly" RRAs
either so the only choice is to use the "yearly" RRA.

If you alter the amount of rows in the "daily" RRA to, for instance,
120000 rows (more than a year) RRDtool has to choose between the
"daily" RRA and the "yearly" RRA as both contain enough rows to
satisfy your request. RRDtool will then look at the start and end
time of the data to fetch. The "yearly" RRA contains rows that start
and end on 00:00 UTC. The "daily" RRA contains rows that start and
end on multiples of 5 minutes.

If you request "now" it is highly likely the "daily" RRA will be
selected. If you request n*86400 (for example: 1040947200) as the
end time and "--start end-400days" for the start time, RRDtool will
select the "yearly" RRA.
It probably couldn't hurt to comb the list archives: http://www.ee.ethz.ch/~slist/
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests