Dataquery (ex cactiquery) 1.0a released

Announcements concerning Plugins for Cacti

Moderators: Developers, Moderators

User avatar
TheWitness
Developer
Posts: 16897
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Pestilence,

What I was thinking was the end all for Data Query was to take the Graph Syntax and remove all of the AREA, LINE, GPRINT, etc from the syntax and then export the results and display them. I would use the rrdtool export function to perform this. Then the results would appear in XML format, so it would simply be a matter of reformatting (in this version of Cacti) and displaying the results.

Is this what you are currently doing?

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
pestilence
Cacti User
Posts: 207
Joined: Fri Jul 25, 2003 10:37 am
Location: Athens/Greece
Contact:

Post by pestilence »

TheWitness wrote:Pestilence,

What I was thinking was the end all for Data Query was to take the Graph Syntax and remove all of the AREA, LINE, GPRINT, etc from the syntax and then export the results and display them. I would use the rrdtool export function to perform this. Then the results would appear in XML format, so it would simply be a matter of reformatting (in this version of Cacti) and displaying the results.

Is this what you are currently doing?

TheWitness
The plugin queries the datasource for the values of a specified time period, then it takes the output and formats it to a spreadsheet compatible format, adding a title, timestamp, and the datasources available.
So i suppose it does do the same thing you are mentioning although in a different manner.
I would be interested to see that version, so be my guest :)
/* * 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
TheWitness
Developer
Posts: 16897
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Ok, time permitting. Working with Gilles on Manage at the moment.

Larry
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
rbecker
Posts: 26
Joined: Mon Feb 12, 2007 6:17 pm
Location: Bay Area, CA

Bugfix - dataquery times

Post by rbecker »

I noticed when using this that on "normal" i.e. not zoomed graph pages, it doesn't pick up the time range correctly. Here's a patch to make it do that.

I did a bit of digging into why it doesnt show all the datasources on a graph. It turns out that the dataquery picks up all the datasources for a graph, but it sets a single variable to be the last datasource it found, and generates the view based on that. I think the correct solution is that the controller should iterate both the dataquery's datasource processing and the view processing of each datasource. That way if we want to redo the logic on processing multiple datasources, we're only messing with the controller level.

What I'm really interested in getting from this is the ability to look at the data being graphed prior to graph pages being generated. If we can do that, we can sort graphs on a page based on the data they contain. Once I fix the datasource issue, I'll probably start in on that :)

Code: Select all

--- setup.php.old       2006-11-03 06:58:03.000000000 -0800
+++ setup.php   2007-03-05 09:56:21.000000000 -0800
@@ -131,18 +131,26 @@
        {
                $start=$_REQUEST["graph_start"];
        } else {
-               $_REQUEST["graph_start"] = "";
-               $start = time() - 3600;
+        if ( !empty($_SESSION["sess_current_date1"]) ) {
+          $start = strtotime( $_SESSION["sess_current_date1"] );
+        } else {
+                 $_REQUEST["graph_start"] = "";
+                 $start = time() - 3600;
+        }
        }

        if ((isset($_REQUEST["graph_end"])) && (!empty($_REQUEST["graph_end"])))
        {
                $end=$_REQUEST["graph_end"];
        } else {
-               $_REQUEST["graph_end"] = "";
-               $end = time();
+        if ( !empty($_SESSION["sess_current_date1"]) ) {
+          $end = strtotime( $_SESSION["sess_current_date2"] );
+        } else {
+                 $_REQUEST["graph_end"] = "";
+                 $end = time();
+        }
        }
        print '<a href="' .  $config['url_path'] . 'plugins/dataquery/dataquery.php?action=query&local_graph_id='.$local_graph_id.'&rra_id='.$rra_id.'&view_type='.$view_type.'&graph_start=' . $start . '&graph_end=' . $end . '"><img src="' . $config['url_path'] . 'plugins/dataquery/images/graph_query.png" border="0" alt="Query Graph" title="Query Graph" style="padding: 3px;"></a><br>';
 }

-?>
\ No newline at end of file
+?>
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Bugfix - dataquery times

Post by gandalf »

rbecker wrote:I noticed when using this that on "normal" i.e. not zoomed graph pages, it doesn't pick up the time range correctly. Here's a patch to make it do that....
This was on purpose. I discussed this effect some time ago with the developer ...
Reinhard
rbecker
Posts: 26
Joined: Mon Feb 12, 2007 6:17 pm
Location: Bay Area, CA

Post by rbecker »

Hrmm. On purpose?

Too bad it wasn't documented, and nor was how to get the full information. Without documentation, I think the intuitive route is much more appropriate.

I'm not sure I see the reason to return partial information.
User avatar
pestilence
Cacti User
Posts: 207
Joined: Fri Jul 25, 2003 10:37 am
Location: Athens/Greece
Contact:

Post by pestilence »

rbecker wrote:Hrmm. On purpose?

Too bad it wasn't documented, and nor was how to get the full information. Without documentation, I think the intuitive route is much more appropriate.

I'm not sure I see the reason to return partial information.
There is a reason...leave your timespan to a huge period and watch the system resources go down ;)
I left it intentional like that to avoid this kind of behaviour, i accidently had this done once and my cacti server just crawled. :)
/* * 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);
super-hornet
Cacti User
Posts: 175
Joined: Sun May 27, 2007 5:42 pm

Post by super-hornet »

First of all.. thanks for this wonderful plugin.

I now using:
Cacti Version - 0.8.7b
Plugin Architecture - 2.1
OS - openSUSE 10.3
Dataquery (dataquery - v0.1.4a)

But I found a few bugs that I not sure anyone reported it already or not.
Bugs are:
1. Dataquery version is wrong when display in "Host Info". It stated Dataquery (dataquery - v0.1.2a)
2. The suppose to be returning to cacti main page link is wrong in "[Dump to CSV ] [ Return ]".
3. The "File download link" still cannot work for virtual path in apache.

For #1 and #2 bug, I modified the existing v0.1.4a files of "setup.php" and "view/queryview.php"

For #3 bug, the situation is like this:
URL link to cacti is (e.g): http://123.123.123.123/cacti
Actual path for cacti in that system is (e.g): /usr/share/cacti
CSV Export Path in settings are (e.g.): /usr/share/cacti/plugins/dataquery/csv/

By configuring the above setting, I can see the "Dump to CSV" and also can see the actual file store in:
/usr/cacti/plugins/dataquery/csv/
But when click "Download", the Apache reject that link because it actually link to the actual directory path instead. (It became http://123.123.123.123/usr/share/cacti/ ... heFile.csv

I tried configure the CSV path to: "/cacti/plugins/dataquery/csv/", and it is worse because I can't see the "[Dump to CSV ] [ Return ]".

Thus, to walk around this problem, I do this:
1. I create a symbolic link of "ln -s /usr/cacti /cacti"
2. Configure CSV Export Path to "/cacti/plugins/dataquery/csv/"
and it work :)

SH
Attachments
0.1.4a_Modified.zip
(4.09 KiB) Downloaded 465 times
pbickerdyke
Posts: 8
Joined: Wed Jun 18, 2008 4:24 am

Post by pbickerdyke »

Hi,

Is there a way to show multiple datasources?

I have the following graph:

Code: Select all

/opt/rrdtool/bin/rrdtool graph - \
--imgformat=PNG \
--start=-14400 \
--end=-300 \
--title="RGS WL App Connections" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/opt/cacti-0.8.7/rra/apache_to_weblogic_rgs_rgswebtoappconapp01_2251.rrd":RGSWebtoAppConapp01:AVERAGE \
DEF:b="/opt/cacti-0.8.7/rra/apache_to_weblogic_rgs_rgswebtoappconapp02_2252.rrd":RGSWebtoAppConapp02:AVERAGE \
DEF:c="/opt/cacti-0.8.7/rra/apache_to_weblogic_rgs_rgswebtoappconapp03_2253.rrd":RGSWebtoAppConapp03:AVERAGE \
DEF:d="/opt/cacti-0.8.7/rra/apache_to_weblogic_rgs_rgswebtoappconapp04_2254.rrd":RGSWebtoAppConapp04:AVERAGE \
LINE1:a#FF0000:"App01"  \
GPRINT:a:LAST:"%8.2lf %s"  \
LINE1:b#00CF00:"App02"  \
GPRINT:b:LAST:"%8.2lf %s"  \
LINE1:c#0000FF:"App03"  \
GPRINT:c:LAST:"%8.2lf %s"  \
LINE1:d#FF00FF:"App04"  \
GPRINT:d:LAST:"%8.2lf %s" 
When I click the button for dataquery it only shows data for the first data source.

Is there a way to get it to show all of them?
jet755
Posts: 19
Joined: Fri Oct 28, 2011 8:50 pm

Re: Dataquery (ex cactiquery) 1.0a released

Post by jet755 »

If someone want to see the decimal fraction, may modify the line 106 and 108 of queryview.php

the origin:
$value = @sprintf("%8.0lf",$value);

the changed:
$value = @sprintf("%g",$value);

p.s. similarly, the line 342 and 344 in class_cactiquery.php
Last edited by jet755 on Fri Oct 28, 2011 10:35 pm, edited 2 times in total.
jet755
Posts: 19
Joined: Fri Oct 28, 2011 8:50 pm

Re: Dataquery (ex cactiquery) 1.0a released

Post by jet755 »

If someone want to dump .csv file for Excel with individual columns, may modify the line 326 and 346 in class_cactiquery.php

the origin:
$string .= ';' . $column;
$string .= ';'.$value;

the changed:
$string .= ',' . $column;
$string .= ','.$value;
kara
Posts: 1
Joined: Thu Mar 16, 2017 11:33 am

Re: Dataquery (ex cactiquery) 1.0a released

Post by kara »

Hi,

at the point to export to csv I get:
/usr/bin/php /usr/share/cacti/export/gen_salida.php:
<?php
chdir('./csv');
include_once("../../include/global.php");
include_once("../../lib/rrd.php");
include("class_cactiquery.php");

foreach ($graph_ids as $graph_id) {
$id = $graph_id["id"];
print "$id\n";
$Ccactiquery =& cactiquery::get_instance($id, 0,$desde ,$hasta , $type); **LINEA 43

When i run gen_salida.php:
PHP Strict Standards: Non-static method cactiquery::get_instance() should not be called statically in /usr/share/cacti/export/gen_salida.php on line 43
PHP Notice: Undefined index: data in /usr/share/cacti/export/class_cactiquery.php on line 342

help!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest