nectar report items using tree type not always work

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
jeffpage
Posts: 3
Joined: Tue Dec 06, 2011 12:30 am

nectar report items using tree type not always work

Post by jeffpage »

nectar report : items using tree type not always work .
after selecting tree and tree branch node .
and whether choosing Cascade to Branches or not .
the report preview will not always show what branch I select .
how to tracking this kind of problem ,any idea ?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: nectar report items using tree type not always work

Post by TheWitness »

What version is this? 0.35a?
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?
jeffpage
Posts: 3
Joined: Tue Dec 06, 2011 12:30 am

Re: nectar report items using tree type not always work

Post by jeffpage »

yes I have upgrade to cacti 0.8.7h with nectar version 0.35a
by the way I also choose ithems by graphs one by one, it works fine ,but it is very inconvenient the way when I need lots of graph in a branch or in a node
Attachments
2011-12-07_094915.png
2011-12-07_094915.png (23.46 KiB) Viewed 5081 times
2011-12-07_094532.png
2011-12-07_094532.png (38.01 KiB) Viewed 5081 times
alvarino
Posts: 1
Joined: Tue Jan 03, 2012 5:27 am

Re: nectar report items using tree type not always work

Post by alvarino »

I'm facing the same problem after upgrade from Nectar 0.28b to 0.35a.

Cacti version 0.8.7g.

Installed plugins:
* Settings: 0.7
* Nectar
* PIA: 2.8
cpttab311
Posts: 4
Joined: Fri Aug 03, 2012 2:27 pm

Re: nectar report items using tree type not always work

Post by cpttab311 »

Hi, same issue.

I've recently upgraded to 0.88a and nectar 0.35a with settings 0.71.

My Nectar reports that are built with individual graphs work fine, however any reports built via tree are broken (ie. the graphs simply don't appear).

Has anyone identified the problem?
cpttab311
Posts: 4
Joined: Fri Aug 03, 2012 2:27 pm

Re: nectar report items using tree type not always work

Post by cpttab311 »

Anyone have any other input on this issue? Any fixes? I see nectar is still on 0.35a. Hoping other people have had some luck.

Thanks!

cpttab311 wrote:Hi, same issue.

I've recently upgraded to 0.88a and nectar 0.35a with settings 0.71.

My Nectar reports that are built with individual graphs work fine, however any reports built via tree are broken (ie. the graphs simply don't appear).

Has anyone identified the problem?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: nectar report items using tree type not always work

Post by gandalf »

Please post your exact settings for that very report. I'll try to reproduce the issue
R.
cpttab311
Posts: 4
Joined: Fri Aug 03, 2012 2:27 pm

Re: nectar report items using tree type not always work

Post by cpttab311 »

Hi Gandalf -

Here's a screenshot of my exact settings.
Attachments
Nectar Graph Tree Report
Nectar Graph Tree Report
cactiNectar.JPG (167.59 KiB) Viewed 4636 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: nectar report items using tree type not always work

Post by gandalf »

jeffpage wrote:after selecting tree and tree branch node .
and whether choosing Cascade to Branches or not .
- it's a tree problem
- it occures only, when selecting subtrees
- UNCLEAR: does the problem change whether cascading has been chosen or not??? <=== Please make this point clear!

R.
TrickyTrix
Posts: 9
Joined: Sat Apr 16, 2011 4:22 am

Re: nectar report items using tree type not always work

Post by TrickyTrix »

I can confirm that tree report many times doesn't generate any graph at all. It looks like it is random... I'll explain on one example in the picture below.
Attachments
nectarbug.png
nectarbug.png (65.26 KiB) Viewed 4575 times
geno
Posts: 11
Joined: Tue Jan 04, 2011 5:52 pm

Re: nectar report items using tree type not always work

Post by geno »

Any update to this issue?
I'm running 0.8.8b with nectar 0.35a as well and experience the same issue: I have 1 report working fine with tree items but any new report refuses to work with tree items.
I did migrate to a new server and upgrade. Are there perhaps left overs in the database causing this? I had to recreate all my reports after migrating.

Regards,
HenkeZan
Posts: 1
Joined: Thu Mar 13, 2014 4:40 am

Re: nectar report items using tree type not always work

Post by HenkeZan »

Hello!
Experiencing the same issue here with Cacti 0.8.8a and Nectar 0.35a.
Any news on investigation of this issue? Anyone of earlier posters found a solution? (Downgrade maybe?)

Thanks!

/HenkeZan
geno
Posts: 11
Joined: Tue Jan 04, 2011 5:52 pm

Re: nectar report items using tree type not always work

Post by geno »

HenkeZan wrote:Hello!
Experiencing the same issue here with Cacti 0.8.8a and Nectar 0.35a.
Any news on investigation of this issue? Anyone of earlier posters found a solution? (Downgrade maybe?)

Thanks!

/HenkeZan
The issue still remains.
Well, what I did was use the top branch in the report and this included all the graphs (a few I didn't want) and this works.

Regards,
gianlucagiacometti
Posts: 1
Joined: Sun May 04, 2014 8:46 pm

Re: nectar report items using tree type not always work

Post by gianlucagiacometti »

Ok guys,
there are 2 problems connected to a wrong evaluation of cascade in nectar_functions.php.

1.
Function nectar_tree_has_graphs() needs anyway the branch id (line 628)

Code: Select all

---                             if (nectar_tree_has_graphs($item["tree_id"], 0, $nectar["user_id"], $item["graph_name_regexp"])) {
+++                             if (nectar_tree_has_graphs($item["tree_id"], $item["branch_id"], $nectar["user_id"], $item["graph_name_regexp"])) {
                                        $outstr .= nectar_expand_tree($nectar, $item, $output, $format_ok);
                                        }

2.
Function rtrim($order_key, '0') strips all zeros from the right. Since in the order_key field each tree level is given by three digits, the function fails to evaluate the right level when a level or sub-level is a mulple of 10.

example:
010 001
011 001
level 010 becomes 01 and not 010, so the item 011 001 is wrongly considered as child of the first one instead of a same level item.

We need to add zeros up to a sting length of 3.

So, a trivial patch can be (2 lines added around line 632):

Code: Select all

                                 if ($item['tree_cascade'] == 'on') {
                                        $order_key  = db_fetch_cell("SELECT order_key FROM graph_tree_items WHERE graph_tree_id=" . $item['tree_id'] . " AND id=" . $item['branch_id']);
                                        $corder_key = rtrim($order_key, '0');

// patch for right cascade
                                        if (strlen($corder_key) == 1) { $corder_key = $corder_key . "00"; }
                                        elseif (strlen($corder_key) == 2) { $corder_key = $corder_key . "0"; }
//

                                        $tree_branches = db_fetch_assoc("SELECT id FROM graph_tree_items WHERE graph_tree_id=" . $item['tree_id'] . " AND order_key LIKE '" . $corder_key . "%' AND order_key!='$order_key' ORDER BY order_key");
                                        if (sizeof($tree_branches)) {
                                          foreach ($tree_branches as $branch) {
                                                $item["branch_id"] = $branch["id"];
                                                if (nectar_tree_has_graphs($item["tree_id"], $item["branch_id"], $nectar["user_id"], $item["graph_name_regexp"])) {
                                                        $outstr .= nectar_expand_tree($nectar, $item, $output, $format_ok, true);
                                                }
                                          }
                                        }
all the best

G
tbilan
Posts: 15
Joined: Fri Sep 14, 2012 6:57 pm

Re: nectar report items using tree type not always work

Post by tbilan »

This solution worked great for me. Thanks!

To make it easier for people I made a patch file for both edits. Save this code in a file called 'nectarpatch' in the nectar directory and run 'patch nectar_funcations.php < nectarpatch'.

Code: Select all

--- backup/nectar_functions.php 2014-05-29 09:53:45.410574651 -0400
+++ nectar_functions.php        2014-05-29 09:58:14.500245813 -0400
@@ -623,14 +623,19 @@
                                /* start a new section */
                                $column = 0;
                        } elseif ($item['item_type'] == NECTAR_ITEM_TREE) {
-                               if (nectar_tree_has_graphs($item["tree_id"], 0, $nectar["user_id"], $item["graph_name_regexp"])) {
-                                       $outstr .= nectar_expand_tree($nectar, $item, $output, $format_ok);
-                               }
+                                if (nectar_tree_has_graphs($item["tree_id"], $item["branch_id"], $nectar["user_id"], $item["graph_name_regexp"])) {
+                                        $outstr .= nectar_expand_tree($nectar, $item, $output, $format_ok);
+                                        }
 
                                if ($item['tree_cascade'] == 'on') {
                                        $order_key  = db_fetch_cell("SELECT order_key FROM graph_tree_items WHERE graph_tree_id=" . $item['tree_id'] . " AND id=" . $item['branch_id']);
                                        $corder_key = rtrim($order_key, '0');
 
+
+                                        if (strlen($corder_key) == 1) { $corder_key = $corder_key . "00"; }
+                                        elseif (strlen($corder_key) == 2) { $corder_key = $corder_key . "0"; }
+
+
                                        $tree_branches = db_fetch_assoc("SELECT id FROM graph_tree_items WHERE graph_tree_id=" . $item['tree_id'] . " AND order_key LIKE '" . $corder_key . "%' AND order_key!='$order_key' ORDER BY order_key");
                                        if (sizeof($tree_branches)) {
                                        foreach ($tree_branches as $branch) {
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests