thold not working with own templates

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
TChiverto
Posts: 5
Joined: Thu May 18, 2006 9:51 am

thold not working with own templates

Post by TChiverto »

I can't get auto create to work (says none created), and adding one by hand (click on the template name in the last but one column of the Data Sources screen) lists nothing under 'Associated Graph'.

The templates etc. that came with thold seem fine however :-/

Both the data source and graph are templated, and all looks OK.
The RRA is id 12, and this appears in the URL OK.
I've pulled out what I think are the right queries from plugins/thold/thold.php:

Code: Select all

mysql> select id,data_source_name from data_template_rrd where local_data_id=12
    -> ;
+-----+------------------+
| id  | data_source_name |
+-----+------------------+
| 109 | time             |
| 108 | statusCode       |
| 110 | md5sum           |
+-----+------------------+
3 rows in set (0.00 sec)

mysql> SELECT id FROM data_template_rrd WHERE local_data_id=12
    -> ;
+-----+
| id  |
+-----+
| 109 |
| 108 |
| 110 |
+-----+
3 rows in set (0.00 sec)

mysql> SELECT DISTINCT local_graph_id FROM graph_templates_item WHERE task_item_id=109
    -> ;
+----------------+
| local_graph_id |
+----------------+
|              8 |
+----------------+
1 row in set (0.00 sec) 
The problem may be that the "SELECT id FROM data_template_rrd WHERE local_data_id=$rra order by id asc limit 1" in the code (line 83) returns the first ds in the data template. The graph actualy only uses the 2nd (of three).

If I hard-code the correct rrdlookup value (one greater than the one if finds itself it all goes well, on the setup GUI, but the 'current' value never appears on the thold summary page, even though the graph is up dateing.

Umm ?
ahouston
Posts: 6
Joined: Wed Jul 12, 2006 5:41 am

Post by ahouston »

Not sure if this really helps, but I had the same problem and resolved it like so (please forgive my php - I normally use perl so I'm learning it out of a PHP in 10 minutes book :o )

In the thold.php file, I changed this:

Code: Select all



$rrdsql = mysql_fetch_array(mysql_query("SELECT id FROM data_template_rrd WHERE local_data_id=$rra ORDER BY id ASC LIMIT 1"));
$rrdlookup = $rrdsql["id"];

$template_data_rrds = db_fetch_assoc("select id,data_source_name from data_template_rrd where local_data_id=" . $rra . " order by id");
$grapharr = db_fetch_assoc("SELECT DISTINCT local_graph_id FROM graph_templates_item WHERE task_item_id=$rrdlookup");


To this:

Code: Select all

$new_sql = "SELECT id FROM data_template_rrd WHERE local_data_id=$rra ORDER BY id ASC LIMIT 16";
$result = mysql_query($new_sql);
$lookup = '';

while ($rrdsql=mysql_fetch_array($result)) {
                $rrdlookup = $rrdsql["id"];
                $lookup.= " or task_item_id=$rrdlookup ";
}

$template_data_rrds = db_fetch_assoc("select id,data_source_name from data_template_rrd where local_data_id=" . $rra . " order by id");
$grapharr = db_fetch_assoc("SELECT DISTINCT local_graph_id FROM graph_templates_item WHERE task_item_id=$rrdlookup $lookup");

Now if you go back into the data source and save the page, the graph shows.

I'm still getting no current data for my SAA stats tho :cry:
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests