Can Cacti branch Github admin look into reported bugs please

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
ikorzha758
Cacti User
Posts: 164
Joined: Thu Jan 21, 2010 8:41 pm

Can Cacti branch Github admin look into reported bugs please

Post by ikorzha758 »

Guys, I have opened 4 cases in GitHub under Thold, describing THOLD bugs discovered by me. Can someone like Cigamit work with me on resolving these issues. I would love to provide testing and feedback in timely manner.
Attachments
Open bugs.
Open bugs.
github.jpeg (124.54 KiB) Viewed 2348 times
Glass17
Posts: 7
Joined: Thu Mar 23, 2017 4:56 pm

Re: Can Cacti branch Github admin look into reported bugs pl

Post by Glass17 »

Hi thold developers,

For me it looks thold lost kind of synchronization with Cacti:

For example, if we configure few thold templates for one data template then thold will be created for the only last one in XXXh data template

mysql> SELECT tt.data_template_id, tt.id
-> FROM thold_template AS tt
-> INNER JOIN plugin_thold_host_template AS ptht
-> ON tt.id=ptht.thold_template_id
-> WHERE ptht.host_template_id = 5;
+------------------+----+
| data_template_id | id |
+------------------+----+
| 38 | 4 |
| 38 | 5 |
| 38 | 3 |
| 60 | 21 |
| 41 | 16 |
| 41 | 15 |
| 27 | 7 |
| 49 | 8 |
| 38 | 6 |
+------------------+----+
9 rows in set (0.01 sec)

Probably problem somewhere in array_rekey() which will return only (60/21; 41/15; 27/7; 49,8; 38,6)

After that auto creation will start to create tholds for XXXh one template for anyone for localhost!!!:

Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source 'errors_out'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source 'int_status'
Created threshold for the Graph 'XXX-C2A-SRV - Traffic - Te1/0/24 (XXX-C2A-MEZZANINE Te1/0/1 TRENDME)' using the Data Source 'traffic_out'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source '5min_cpu'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source 'poolUsed'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source 'errors_out'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source 'int_status'
Created threshold for the Graph 'XXX-C2A-SRV - Traffic - Te9/0/22 (XXX-C2A-STAGE-A Te8/0/1 TRENDME)' using the Data Source 'traffic_out'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source '5min_cpu'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source 'poolUsed'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source 'errors_out'
Created threshold for the Graph 'XXX-C2A-SRV - Status - Te1/0/22 (XXX-C2A-STAGE-A Te1/0/1 TRENDME)' using the Data Source 'int_status'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source 'traffic_out'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source '5min_cpu'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source 'poolUsed'
Created threshold for the Graph 'XXX-C2A-SRV - Errors - Te1/0/22 (XXX-C2A-STAGE-A Te1/0/1 TRENDME) ' using the Data Source 'errors_out'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source 'int_status'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source 'traffic_out'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source '5min_cpu'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source 'poolUsed'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source 'errors_out'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source 'int_status'
Created threshold for the Graph 'XXX-C2A-SRV - Traffic - Te1/0/22 (XXX-C2A-STAGE-A Te1/0/1 TRENDME)' using the Data Source 'traffic_out'
Created threshold for the Graph 'XXX-NETADMIN (localhost) - Load Average' using the Data Source '5min_cpu'
...

And then when you take a list in of thold in GUI it will clean up thold for localhost.
Probably it is the reason why numbers of created tholds are not consiquent when you look on them.

Section of cli_thresholds.php for creating particular graph template absent at all.

I am not a programmer. I can see some problems here, but unfortunately, I am not able to correct it
Glass17
Posts: 7
Joined: Thu Mar 23, 2017 4:56 pm

Re: Can Cacti branch Github admin look into reported bugs pl

Post by Glass17 »

I created patch wich looks resolved a couple of my problems (probably it covers bugs #92 and #93):

Will check what else can do

Code: Select all

--- /usr/share/cacti/plugins/thold/thold_functions.php.orig     2017-06-28 21:21:35.513491692 -0700
+++ /usr/share/cacti/plugins/thold/thold_functions.php  2017-06-28 21:23:17.683561146 -0700
@@ -3314,14 +3314,14 @@
                FROM thold_template AS tt
                INNER JOIN plugin_thold_host_template AS ptht
                ON tt.id=ptht.thold_template_id
-               WHERE ptht.host_template_id = ?', array($host_template_id)), 'data_template_id', 'id');
+               WHERE ptht.host_template_id = ?', array($host_template_id)), 'id', 'data_template_id');

        if (!sizeof($template_list)) {
                $_SESSION['thold_message'] = '<font size=-2>' . __('No Thresholds Templates associated with the Host\'s Template.') . '</font>';
                return 0;
        }

-       foreach($template_list as $data_template_id => $thold_template_id) {
+       foreach($template_list as $thold_template_id => $data_template_id) {
                $data_templates[$data_template_id] = $data_template_id;
                $thold_template_ids[$thold_template_id] = $thold_template_id;
        }
@@ -3359,7 +3359,7 @@
                                                WHERE local_data_id = ?
                                                AND data_source_name = ?
                                                ORDER BY id LIMIT 1', array($local_data_id, $template['data_source_name']));
-
+if("" != $data_template_rrd_id) {
                                        $graph  = db_fetch_row_prepared('SELECT local_graph_id, graph_template_id
                                                FROM graph_templates_item
                                                WHERE task_item_id = ?
@@ -3439,6 +3439,7 @@
                                                        $created++;
                                                }
                                        }
+}
                                }
                        }
                }
ikorzha758
Cacti User
Posts: 164
Joined: Thu Jan 21, 2010 8:41 pm

Re: Can Cacti branch Github admin look into reported bugs pl

Post by ikorzha758 »

Glass17, thank you so much for your patch work, I was able to successfully test it and YES it definitely resolves issues reported in #92 and #93
Now question becomes how to incorporate your changes in thold github!
I will do my best to "alert them" of required changes.
Glass17
Posts: 7
Joined: Thu Mar 23, 2017 4:56 pm

Re: Can Cacti branch Github admin look into reported bugs pl

Post by Glass17 »

One more patch which is solving for me the issue with reapplying suggested names:

Code: Select all

--- /usr/share/cacti/plugins/thold/thold.php.orig       2017-07-18 12:38:14.106184521 -0700
+++ /usr/share/cacti/plugins/thold/thold.php    2017-07-18 12:40:02.645261122 -0700
@@ -254,7 +254,7 @@
                                                        array($thold['thold_template_id']));

                                                $name = thold_format_name($template, $thold['local_graph_id'],
-                                                       $thold['data_template_rrd_id'], $template['data_source_name']);
+                                                       $thold['local_data_id'], $template['data_source_name']);

                                                plugin_thold_log_changes($del, 'reapply_name', array('id' => $del));

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests