Problems with Monitor plugins

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
w800
Posts: 2
Joined: Tue Jun 29, 2010 8:55 am

Problems with Monitor plugins

Post by w800 »

Hi,
Situation following

Graph Trees --> create New Trees ( example all, office)

Tree Items for "all" trees - one host!!!
Trre Items for "office" trees - two hosts

Other host not included in Graph Trees.

Next step -->Settings-Misc-Grouping-Tree

Monitor tab, I saw that only appears one group of PCs that includes a PC with all Graph Trees and the other PCs in the group Other

See results.... :(
Attachments
2.png
2.png (62.6 KiB) Viewed 1477 times
5.png
5.png (64.56 KiB) Viewed 1477 times
4.png
4.png (41.66 KiB) Viewed 1477 times
3.png
3.png (40.44 KiB) Viewed 1477 times
1.png
1.png (22.24 KiB) Viewed 1477 times
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Post by noname »

Probably you faced this situation...

Case 1)
Image

Case 2)
Image

Detecting separation of tree items depends on 'order_key' field in 'graph_tree_items' table.
To put it simply, when the parent of one tree item is next to the parent another item, they will be gathered to the same group.
(It seems to be occur between top-level items that have no subtrees.)

I made one patch experimentally for monitor.php (from monitor-v1.1-1.tgz).
But that was not fully tested.

Code: Select all

--- monitor.php.org     2010-06-06 08:14:06.000000000 +0900
+++ monitor.php 2010-08-17 18:55:33.899693000 +0900
@@ -419,6 +419,8 @@

        $current_tier = 0;
        $previous_tier = 0;
+       $current_tree_id = 0;
+       $previous_tree_id = 0;

        $current_tree_name = "";
        $tree_names = array();
@@ -428,6 +430,7 @@

                if (array_key_exists('order_key',$leaf)) {
                        $current_tier = tree_tier($leaf['order_key']);
+                       $current_tree_id = $leaf['graph_tree_id'];
                }

                if (array_key_exists( intval($current_tier-1) ,$tree_names)) {
@@ -437,7 +440,7 @@
                }

                if (array_key_exists("host_id",$leaf) && $leaf["host_id"] > 0) {
-                       if (sizeof($leafs) > 0 && ($previous_tier != $current_tier) ) {
+                       if (sizeof($leafs) > 0 && (($previous_tier != $current_tier) || ($previous_tree_id != $current_tree_id)) ) {
                                $result .= render_branch($leafs);
                                /* start next branch */
                                $leafs = array();
@@ -457,6 +460,9 @@
                if ($previous_tier != $current_tier) {
                        $previous_tier = $current_tier;
                }
+               if ($previous_tree_id != $current_tree_id) {
+                       $previous_tree_id = $current_tree_id;
+               }

                /* Last leaf, process what what's left  */
                if ($i == sizeof($heirarchy)-1) {
@@ -838,6 +844,7 @@
        if (sizeof($tree_list) > 0) {
                foreach ($tree_list as $tree) {
                        $heirarchy = db_fetch_assoc("select
+                               graph_tree_items.graph_tree_id,
                                graph_tree_items.title,
                                graph_tree_items.order_key,
                                graph_tree_items.host_id,
The results:
Image
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest