Thold BUG 0.4.1 with View Graph
Moderators: Developers, Moderators
Thold BUG 0.4.1 with View Graph
Hi together,
I just want to inform you about a bug I recognized.
If you add create a "Threshold from Template" you will find this new created Threshold under the threshold section. There you find a small icon "View Graph" to show the corosponding graph.
The link looks like the following ...
https://x.x.x.x/graph.php?local_graph_i ... rra_id=all
Now, if you edit this threshold and if you uncheck the "Template Propagation Enabled" checkbox and save this configuration you will see that the link graph can not be accesses anymore. The link then looks like the following ...
https://x.x.x.x/graph.php?local_graph_id=0&rra_id=all
As you can see the link looses the ID information.
Does somebody has found a fix for this?
This would be really great!
BR
Benjamin
I just want to inform you about a bug I recognized.
If you add create a "Threshold from Template" you will find this new created Threshold under the threshold section. There you find a small icon "View Graph" to show the corosponding graph.
The link looks like the following ...
https://x.x.x.x/graph.php?local_graph_i ... rra_id=all
Now, if you edit this threshold and if you uncheck the "Template Propagation Enabled" checkbox and save this configuration you will see that the link graph can not be accesses anymore. The link then looks like the following ...
https://x.x.x.x/graph.php?local_graph_id=0&rra_id=all
As you can see the link looses the ID information.
Does somebody has found a fix for this?
This would be really great!
BR
Benjamin
Re: Thold BUG 0.4.1 with View Graph
See the issue with Thold V0.5.0 as well.
I'm not sure there is an automatic fix, but I resolved my issue by changing the values in the database:
mysql -u root -p<mysql root password>
use cacti
#list entries in the thold_data table and note the "id" number - the graph_id will be set to "0"
select id,name,rra_id,data_id,graph_id from thold_data;
Go into Cacti GUI and find the correct graph, hover over with the cursor and look at the status bar in the browser which should show the correct id.
#Then modify the table manually back in mysql
update thold_data set graph_id = <enter graph id from above> where id=<the id number you noted> limit 1;
Then go back to Cacti, go into Thold and the correct graph should be displayed when you click the link.
Additionally, email alerts that get sent out should also be populated correctly.
I'm not sure there is an automatic fix, but I resolved my issue by changing the values in the database:
mysql -u root -p<mysql root password>
use cacti
#list entries in the thold_data table and note the "id" number - the graph_id will be set to "0"
select id,name,rra_id,data_id,graph_id from thold_data;
Go into Cacti GUI and find the correct graph, hover over with the cursor and look at the status bar in the browser which should show the correct id.
#Then modify the table manually back in mysql
update thold_data set graph_id = <enter graph id from above> where id=<the id number you noted> limit 1;
Then go back to Cacti, go into Thold and the correct graph should be displayed when you click the link.
Additionally, email alerts that get sent out should also be populated correctly.
Re: Thold BUG 0.4.1 with View Graph
Hi,
I got a similar issues when I create thresholds. Sometimes the link looks as already described by blugger:
Sometimes o.K. like:
https://x.x.x.x/graph.php?local_graph_i ... rra_id=all
Sometimes local_graph_id=0 like:
https://x.x.x.x/graph.php?local_graph_id=0&rra_id=all
I found a solution which is working to me. I will not say that this is the best solution and maybe it will not cover all of these issues but it's o.K. to me at the moment. By the way: Emails, which are sent out by thold, having the related graph included after this fix. So I am happy at the moment
Pease take care and save your config before you will perform any changes.
What I did:
1.) login as root
2.) backup thold-functions.php: # cp /var/www/html/plugins/thold/thold-functions.php /var/www/html/plugins/thold/thold-functions.php.original
3.) Open /var/www/html/plugins/thold/thold-functions.php with an editor
4.) locate line 2551
(It's the line next of /* Get the Data Template, Graph Template, and Graph */ )
5.) Comment out line 2551
//$rrdsql = db_fetch_row('SELECT id, data_template_id FROM data_template_rrd WHERE local_data_id=' . $save['rra_id'] . ' ORDER BY id');
6.) insert these 3 new lines before line 2551:
$template_rrd = db_fetch_row("select * from data_template_rrd where id=" . $_POST['data_template_rrd_id']);
$mystring = trim($template_rrd['data_source_name']);
$rrdsql = db_fetch_row('SELECT id, data_template_id FROM data_template_rrd WHERE local_data_id=' . $save['rra_id'] . ' and trim(data_source_name)="' . $mystring . '" ORDER BY id');
7.) Check your work:
Line 2550: /* Get the Data Template, Graph Template, and Graph */
Line 2551: $template_rrd = db_fetch_row("select * from data_template_rrd where id=" . $_POST['data_template_rrd_id']);
Line 2552: $mystring = trim($template_rrd['data_source_name']);
Line 2553: $rrdsql = db_fetch_row('SELECT id, data_template_id FROM data_template_rrd WHERE local_data_id=' . $save['rra_id'] . ' and trim(data_source_name)="' . $mystring . '" ORDER BY id');
Line 2554: //$rrdsql = db_fetch_row('SELECT id, data_template_id FROM data_template_rrd WHERE local_data_id=' . $save['rra_id'] . ' ORDER BY id');
8.) save your changes
9.) browser: Go to "Config"-Tab, create a new threshold or open an existing threshold and press "save"
10.)browser: Go to "Threshold"-Tab, click on the graph-Icon and check if the graph will appear
The good thing: I do not have to create the threshold again. Just open the threshold an "save" is enough to update the missing data needed to show the correct link.
One thing which is not clear to me at the moment: I have some thresholds defined for hosts which are not in service at the moment. For these hosts my solution will not work. I have to check it again after the hosts are back in service again.
Maybe my reply can help someone else.
Sorry for my bad english
I got a similar issues when I create thresholds. Sometimes the link looks as already described by blugger:
Sometimes o.K. like:
https://x.x.x.x/graph.php?local_graph_i ... rra_id=all
Sometimes local_graph_id=0 like:
https://x.x.x.x/graph.php?local_graph_id=0&rra_id=all
I found a solution which is working to me. I will not say that this is the best solution and maybe it will not cover all of these issues but it's o.K. to me at the moment. By the way: Emails, which are sent out by thold, having the related graph included after this fix. So I am happy at the moment
Pease take care and save your config before you will perform any changes.
What I did:
1.) login as root
2.) backup thold-functions.php: # cp /var/www/html/plugins/thold/thold-functions.php /var/www/html/plugins/thold/thold-functions.php.original
3.) Open /var/www/html/plugins/thold/thold-functions.php with an editor
4.) locate line 2551
(It's the line next of /* Get the Data Template, Graph Template, and Graph */ )
5.) Comment out line 2551
//$rrdsql = db_fetch_row('SELECT id, data_template_id FROM data_template_rrd WHERE local_data_id=' . $save['rra_id'] . ' ORDER BY id');
6.) insert these 3 new lines before line 2551:
$template_rrd = db_fetch_row("select * from data_template_rrd where id=" . $_POST['data_template_rrd_id']);
$mystring = trim($template_rrd['data_source_name']);
$rrdsql = db_fetch_row('SELECT id, data_template_id FROM data_template_rrd WHERE local_data_id=' . $save['rra_id'] . ' and trim(data_source_name)="' . $mystring . '" ORDER BY id');
7.) Check your work:
Line 2550: /* Get the Data Template, Graph Template, and Graph */
Line 2551: $template_rrd = db_fetch_row("select * from data_template_rrd where id=" . $_POST['data_template_rrd_id']);
Line 2552: $mystring = trim($template_rrd['data_source_name']);
Line 2553: $rrdsql = db_fetch_row('SELECT id, data_template_id FROM data_template_rrd WHERE local_data_id=' . $save['rra_id'] . ' and trim(data_source_name)="' . $mystring . '" ORDER BY id');
Line 2554: //$rrdsql = db_fetch_row('SELECT id, data_template_id FROM data_template_rrd WHERE local_data_id=' . $save['rra_id'] . ' ORDER BY id');
8.) save your changes
9.) browser: Go to "Config"-Tab, create a new threshold or open an existing threshold and press "save"
10.)browser: Go to "Threshold"-Tab, click on the graph-Icon and check if the graph will appear
The good thing: I do not have to create the threshold again. Just open the threshold an "save" is enough to update the missing data needed to show the correct link.
One thing which is not clear to me at the moment: I have some thresholds defined for hosts which are not in service at the moment. For these hosts my solution will not work. I have to check it again after the hosts are back in service again.
Maybe my reply can help someone else.
Sorry for my bad english
Re: Thold BUG 0.4.1 with View Graph
Have you reported this on cacti's GitHub issues section? IF not, I can do that on your behalf and submit your proposed fix.
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Re: Thold BUG 0.4.1 with View Graph
Forget that I've just realised that you are using an old version of thold. However, I will see if the same issue still applies.
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Re: Thold BUG 0.4.1 with View Graph
Hi netniV,
oh yes, sorry. I forgot to say that I am still using thold version 0.5
I think the problem is related to "data_template_rrd". In case you are using more than one or two "data_source_name" only the first entry was found every time I tried to define a threshold.
Using the additional search for the "data_source_name" will select the correct "id" and "data_template_id".
I do not know if this is still the case in newer versions of thold.
netniV, thank you for checking if this is the case in newer versions also
oh yes, sorry. I forgot to say that I am still using thold version 0.5
I think the problem is related to "data_template_rrd". In case you are using more than one or two "data_source_name" only the first entry was found every time I tried to define a threshold.
Using the additional search for the "data_source_name" will select the correct "id" and "data_template_id".
I do not know if this is still the case in newer versions of thold.
netniV, thank you for checking if this is the case in newer versions also
Re: Thold BUG 0.4.1 with View Graph
The only thing I will say after a few more days of thinking on this, you are using the $_POST directly in your code and worse, just appending it unchecked to the SQL string which can lead to SQL injection attacks.
If you check through the code, you'll find how the rest of the system pulls in those fields, so I would recommend using those. For cacti 1.1.30 for example, the routine is get_nfilter_request_var() if I remember rightly. There are also sanitize routines too.
If you check through the code, you'll find how the rest of the system pulls in those fields, so I would recommend using those. For cacti 1.1.30 for example, the routine is get_nfilter_request_var() if I remember rightly. There are also sanitize routines too.
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Re: Thold BUG 0.4.1 with View Graph
This does appear to have been already changed in the latest version of plugins_thold on GitHub:
Not quite the same as your fix, and without your data, i'm not sure whether that means there's still an issue in the current version.
Code: Select all
$rrdsql = db_fetch_row_prepared('SELECT id, data_template_id
FROM data_template_rrd
WHERE local_data_id = ?
ORDER BY id',
array($save['local_data_id']));
$rrdlookup = $rrdsql['id'];
$grapharr = db_fetch_row_prepared('SELECT local_graph_id, graph_template_id
FROM graph_templates_item
WHERE task_item_id = ?
AND local_graph_id <> ""
LIMIT 1',
array($rrdlookup));
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Re: Thold BUG 0.4.1 with View Graph
Hi netniV,
thank you for your replies.
I like to say that I'm not a great specialist in php and I do not know if the latest version of thold will work correctly.
Thold 0.5 will not work for me without the solution described before.
The problem I had found:
Without the solution the process is searching for local_data_id in data_template_rrd only.
In my case the search for local_data_id will result in more than one result.
As an example:
mysql> SELECT id, data_template_id, data_source_name FROM data_template_rrd WHERE local_data_id=10 ORDER BY id;
+------+------------------+---------------------+
| id | data_template_id | data_source_name |
+------+------------------+---------------------+
| 1962 | 71 | AAA |
| 1963 | 71 | BBB |
| 1964 | 71 | CCC |
| 1965 | 71 | DDD |
| 1966 | 71 | EEE |
| 1967 | 71 | FFF |
+------+------------------+---------------------+
6 rows in set (0.00 sec)
Without the changement I did the result was always
id=1962
data_template_id=71
The result, at least: local_graph_id=0
https://x.x.x.x/graph.php?local_graph_id=0&rra_id=all
This search would give you a fine result if you like to define a thold for data_source_name "AAA"
But I wanted to define thresholds for data_source_name "FFF".
My changement is only to inlude the data_source_name into the search:
mysql> SELECT id, data_template_id, data_source_name FROM data_template_rrd WHERE local_data_id=10 and trim(data_source_name)="FFF" ORDER BY id;
+------+------------------+------------------+
| id | data_template_id |data_source_name |
+------+------------------+------------------+
| 1967 | 71 | FFF |
+------+------------------+------------------+
1 row in set (0.00 sec)
Regarding the current version of thold:
If the search will work in the current version of thold I would say thats fine. But I can not verify it at the moment.
By the way: I used $_POST['data_template_rrd_id'] because it was used in the original script some lines before.
I thought it should be secure enough to use this twice. But I agree that the solution could be better / more secure
netniV, thank you very much for your postings
Have a nice weekend
thank you for your replies.
I like to say that I'm not a great specialist in php and I do not know if the latest version of thold will work correctly.
Thold 0.5 will not work for me without the solution described before.
The problem I had found:
Without the solution the process is searching for local_data_id in data_template_rrd only.
In my case the search for local_data_id will result in more than one result.
As an example:
mysql> SELECT id, data_template_id, data_source_name FROM data_template_rrd WHERE local_data_id=10 ORDER BY id;
+------+------------------+---------------------+
| id | data_template_id | data_source_name |
+------+------------------+---------------------+
| 1962 | 71 | AAA |
| 1963 | 71 | BBB |
| 1964 | 71 | CCC |
| 1965 | 71 | DDD |
| 1966 | 71 | EEE |
| 1967 | 71 | FFF |
+------+------------------+---------------------+
6 rows in set (0.00 sec)
Without the changement I did the result was always
id=1962
data_template_id=71
The result, at least: local_graph_id=0
https://x.x.x.x/graph.php?local_graph_id=0&rra_id=all
This search would give you a fine result if you like to define a thold for data_source_name "AAA"
But I wanted to define thresholds for data_source_name "FFF".
My changement is only to inlude the data_source_name into the search:
mysql> SELECT id, data_template_id, data_source_name FROM data_template_rrd WHERE local_data_id=10 and trim(data_source_name)="FFF" ORDER BY id;
+------+------------------+------------------+
| id | data_template_id |data_source_name |
+------+------------------+------------------+
| 1967 | 71 | FFF |
+------+------------------+------------------+
1 row in set (0.00 sec)
Regarding the current version of thold:
If the search will work in the current version of thold I would say thats fine. But I can not verify it at the moment.
By the way: I used $_POST['data_template_rrd_id'] because it was used in the original script some lines before.
I thought it should be secure enough to use this twice. But I agree that the solution could be better / more secure
netniV, thank you very much for your postings
Have a nice weekend
Re: Thold BUG 0.4.1 with View Graph
I would stick with the version you have as that is compatible with 0.8.8, the latest thold would require a minimum of 1.0.4.
Thanks for the fuller explanation.
Thanks for the fuller explanation.
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Who is online
Users browsing this forum: No registered users and 3 guests