Cactiquery 0.8.6g

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

torstentfk
Cacti User
Posts: 367
Joined: Tue Apr 05, 2005 9:52 am
Location: Munich, Germany

Post by torstentfk »

Hi,

the automatic timespan selection in the cactiquery does not work, because in the graph.php in line 97 there is hardcoded the timespan of 1 hour.
I changed it to:

Code: Select all

Line 85:
switch ($_REQUEST["action"]) {
case 'view':
        ?>
        <tr bgcolor='#<?php print $colors["header_panel"];?>'>
                <td colspan='3' class='textHeaderDark'>
                        <strong>Viewing Graph</strong> '<?php print $graph_title;?>'
                </td>
        </tr>
        <?php

        $i = 0;
        if (sizeof($rras) > 0) {
        foreach ($rras as $rra) {

        /*NEW*/
        $rraq = db_fetch_row("select timespan,steps,name from rra where id=$rra[id]");

        /* define the time span, which decides which rra to use */
        $querytimespan = ($rraq["timespan"]);
      /*NEW END*/

an the original query code in line 97 to:

Code: Select all

/********************* CACTIQUERY ADDITION *****************************/
                                                ?>
                                                        <a href='graph.php?action=query&local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $rra["id"];?>&view_type=<?php print $_REQUEST["view_type"];?>&graph_start=<?php echo time()-$querytimespan;?>&graph_end=<?php echo time();?>'><img src='images/graph_query.png' border='0' alt='Query Graph' title='Query Graph' style='padding: 3px;'></a><br>

                                                <?php
                                                        /********************* END CACTIQUERY ADDITION *****************************/
Now the timespan for the query is read from the actual graph width.


Torsten
User avatar
Pumpi
Cacti User
Posts: 259
Joined: Wed Jan 14, 2004 3:23 am
Location: Germany

Post by Pumpi »

Will be there a solution integrated with cigamit's grear plugin architecture ??
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Pumpi wrote:Will be there a solution integrated with cigamit's grear plugin architecture ??
Actually, I have been thinking of making a quick port of this myself, as I have been working on something along these lines already (not near as complete). No promises on how fast it will go, as I currently already have a fairly full plate.
geertn444
Posts: 44
Joined: Fri Dec 02, 2005 3:24 am

Post by geertn444 »

Hi all,

I am running CACTIQUERY in a Windows environment and - at first - it didnt work for me either. After some debugging i found that this was caused by line 538 in rrd.php:

$data_source_path = str_replace(":", "\:", $data_source_path);

This changed my path to something illegal (as seen in the log file):

12/21/2005 10:30:52 PM - WEBLOG: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe fetch C\:/Inetpub/wwwroot/cacti-0.8.6g/rra/draytek_router_traffic_in_8.rrd AVERAGE -r 300 -s 1135193442 -e 1135200642


After commenting out the line, the path variable was valid and CACTIQUERY worked:

12/21/2005 10:44:23 PM - WEBLOG: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe fetch C:/Inetpub/wwwroot/cacti-0.8.6g/rra/draytek_router_traffic_in_8.rrd AVERAGE -r 300 -s 1134596657 -e 1135201457

So maybe this needs to be fixed for Windows compatibility....

Geert
geertn444
Posts: 44
Joined: Fri Dec 02, 2005 3:24 am

Post by geertn444 »

pestilence wrote:
sg wrote:I really like cactiquery; it's funcationality I need from Cacti.

Some issues/suggestions/requests:

1) I can't download the data -- the filename is always "/path/to/csvdir/-.csv" and the file is always empty
2) I have many combined graphs; I need all the datasources, not just the first one
3) Suggest that AVERAGE/MIN/MAX/LAST variable on line 524 of rrd.php be changed to either a setting (as with the csv export directory) or something you can pick on the export screen

Thanks,
sg
Sorry for the late reply

1) Hmm i have to check this, filenames are parsed from the graph title.

2) Combined graphs is something i will try to work on (implement cdef functions) it is a bit of trouble...but we are going to try our best :)

3) Yap i was planning to add this in this release...but i forgot...i will do so in the next release :)
Regarding the filename, there is a bug present in CACTIQUERY. The filename is derived from the hostname and graph_template, but these
variables are not always defined. It is perfectly possible to create a graph based on "None" as host and "None" as graph template.

In this case you get an invalid filename........... (see lines 661-670 of rrd.php)

A possible workaround for the filename issue is to use the graph title as filename if no host or template is defined:
$if_host = @eregi_replace('[-:\/]',"",$host);
$if_stat = @eregi_replace('[" "-:\/]',"",$stat_name);
if(!$host or !stat_name)
{ $file = get_graph_title($local_graph_id).".csv";
} else {
$file = $if_host."-".$if_stat.".csv";
}
if(!$file)
{
//We could not determine proper information falling back...
return;
However, still one bug is present, because the file remains empty and i still receive one error:
Notice: Undefined offset: 2 in C:\Inetpub\wwwroot\cacti-0.8.6g\lib\rrd.php on line 919
[/quote]
geertn444
Posts: 44
Joined: Fri Dec 02, 2005 3:24 am

Post by geertn444 »

Notice: Undefined offset: 2 in C:\Inetpub\wwwroot\cacti-0.8.6g\lib\rrd.php on line 919
This error is caused when you use backslashes in the CSV path definition.
So use only forward slashes:

NOT

C:\Inetpub\wwwroot\cacti-0.8.6g\csv

BUT

C:/Inetpub/wwwroot/cacti-0.8.6g/csv
torstentfk
Cacti User
Posts: 367
Joined: Tue Apr 05, 2005 9:52 am
Location: Munich, Germany

Post by torstentfk »

Hello cigamit/pestilence,

will this feature "QUERY" go into the official release?
Everytime a new version is pushed out I must change the cacti-files.


Torsten
ioiioi
Cacti User
Posts: 52
Joined: Mon Mar 28, 2005 8:57 am

Post by ioiioi »

torstentfk wrote:Hello cigamit/pestilence,

will this feature "QUERY" go into the official release?
Everytime a new version is pushed out I must change the cacti-files.


Torsten
Hi pestilence,
since cigamit develop the plugin arch, and he is the official developer now, any possible to integrate your plugin into plugin arch 0.27, from a user's point of view, that would be the best result.
:D
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

We can do as a plugin, but I have wanted to get this "Integrated" into the zoom view for some time. There are issues though due some miscellaneous issues. The largest issue being getting this feature up on my priorities list.

So, I guess a plugin is good for now.

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?
ioiioi
Cacti User
Posts: 52
Joined: Mon Mar 28, 2005 8:57 am

Post by ioiioi »

TheWitness wrote:We can do as a plugin, but I have wanted to get this "Integrated" into the zoom view for some time. There are issues though due some miscellaneous issues. The largest issue being getting this feature up on my priorities list.

So, I guess a plugin is good for now.

TheWitness
Hmm, why not utilize the mysql to store the current data when cmd.php polling the target?
PRTG have been implement this feature, It might be utilize the plain txt file.
http://www.paessler.com/prtg
I am not developer, it is just a suggestion. :-?
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

It does, but for only 1 cycle. The idea is to move all the information into the Round Robin Database format post polling. The reason that the query data is not supported because of certain development issues. I just don't have time to implement to be 100% transparent to the user.

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
Pumpi
Cacti User
Posts: 259
Joined: Wed Jan 14, 2004 3:23 am
Location: Germany

Post by Pumpi »

Hello,

has anybody running cactiquery together with plugin architecture on Cacti 0.8.6h (Linux) ?

Can someone post the modified files:

/graph.php
/lib/functions.php
/lib/html.php
/lib/rrd.php
/include/config_settings.php

Any updates on this in general ??
User avatar
psyber
Cacti User
Posts: 84
Joined: Tue Aug 02, 2005 7:18 pm

Post by psyber »

Here's the patch for 0.8.6h with the plugin arch installed (tested on the CactiEZ cd).
You will need to put the graph_query.png file in your images directory.
Attachments
cacti0.8.6h_with_plugins_to_cactiquery.patch
(30.81 KiB) Downloaded 739 times
graph_query.png
graph_query.png (876 Bytes) Viewed 7214 times
Last edited by psyber on Tue Feb 14, 2006 12:27 pm, edited 2 times in total.
User avatar
Pumpi
Cacti User
Posts: 259
Joined: Wed Jan 14, 2004 3:23 am
Location: Germany

Post by Pumpi »

psyber,

thanks for the patch.

Littlebit strange, but I see only this output (example)

Timestamp 5min_cpu
13/Feb/2006 15:50:00 4
13/Feb/2006 15:55:00 4
13/Feb/2006 16:00:00 5
13/Feb/2006 16:05:00 4
13/Feb/2006 16:10:00 5
13/Feb/2006 16:15:00 4
13/Feb/2006 16:20:00 4
13/Feb/2006 16:25:00 4
13/Feb/2006 16:30:00 3
13/Feb/2006 16:35:00 3
13/Feb/2006 16:40:00 3
13/Feb/2006 16:45:00 3

Where are the other values ?
prokart53
Posts: 6
Joined: Mon Feb 13, 2006 10:55 am

Post by prokart53 »

I seem to be having issues with this patch.

This is a fresh install of Cacti 0.8.6h. I have installed the plugin arch and downloaded the cactiquery-0.8.6g tarball from the OP.

I extracted the cactiquery-0.8.6g tarball to a tmp dir and copied the patch into the same dir. Then ran the following command

Code: Select all

patch -p1 -N < cacti0.8.6h_with_plugins_to_cactiquery.patch
I then get 4 failed hunks. What am I doing wrong here?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest