Cacti SQL Query Problem
Moderators: Developers, Moderators
Cacti SQL Query Problem
I've got the netapp template (http://forums.cacti.net/viewtopic.php?t=11446) installed and a netapp device configured. I created the graphs for the device based on the templates, but the data sources were never created and the graphs were never drawn. I created the data sources manually by copying and pasting the data source debug info for the netapp data sources into the command line. Now the graphs are drawn, but there is no data. The message below and several similar ones are logged.
CMDPHP: ERROR: SQL Assoc Failed "select snmp_query_graph_rrd.snmp_field_name, data_template_rrd.id as data_template_rrd_id from (snmp_query_graph_rrd,data_template_rrd) where snmp_query_graph_rrd.data_template_rrd_id=data_template_rrd.local_data_template_rrd_id and snmp_query_graph_rrd.snmp_query_graph_id= and snmp_query_graph_rrd.data_template_id=92 and data_template_rrd.local_data_id=634"
Notice the blank value after "snmp_query_graph_rrd.snmp_query_graph_id=". If I connect to the cacti DB and run the above SQL with '38' as the snmp_query_graph_id, I get results. 38 is the value for that particular snmp_query_graph_rrd.snmp_query_graph_id in my DB.
Why isn't that value making it into the SQL statement? Is there something missing from the template or did the import process not work?
Fedora Core 5
Cacti 0.8.6h
mysql 5.0.22
RRD 1.2.15
Net-SNMP 5.3
Poller cmd.php
Thanks
Brandon
CMDPHP: ERROR: SQL Assoc Failed "select snmp_query_graph_rrd.snmp_field_name, data_template_rrd.id as data_template_rrd_id from (snmp_query_graph_rrd,data_template_rrd) where snmp_query_graph_rrd.data_template_rrd_id=data_template_rrd.local_data_template_rrd_id and snmp_query_graph_rrd.snmp_query_graph_id= and snmp_query_graph_rrd.data_template_id=92 and data_template_rrd.local_data_id=634"
Notice the blank value after "snmp_query_graph_rrd.snmp_query_graph_id=". If I connect to the cacti DB and run the above SQL with '38' as the snmp_query_graph_id, I get results. 38 is the value for that particular snmp_query_graph_rrd.snmp_query_graph_id in my DB.
Why isn't that value making it into the SQL statement? Is there something missing from the template or did the import process not work?
Fedora Core 5
Cacti 0.8.6h
mysql 5.0.22
RRD 1.2.15
Net-SNMP 5.3
Poller cmd.php
Thanks
Brandon
- fmangeant
- Cacti Guru User
- Posts: 2345
- Joined: Fri Sep 19, 2003 8:36 am
- Location: Sophia-Antipolis, France
- Contact:
Hi
have you installed the patches for 0.8.6h ?
This one seems to fix it :
have you installed the patches for 0.8.6h ?
This one seems to fix it :
Invalid SQL When Creating Graphs 2006/01/07
This patch fixes an problem where an invalid SQL statement would be executed when generating graphs.
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
I used yum to install cacti, but forgot the patches. I tried applying them, but they all returned similar errors to the one below.
>patch -p1 -N < fix_sql_syntax_related_to_default_rra_id.patch
patching file graph.php
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file graph.php.rej
I'm guessing the yum version is already patched. Below is the graph.php.rej output.
***************
*** 130,142 ****
$timespan = -($rra["timespan"]);
/* find the step and how often this graph is updated with new data */
- $ds_step = db_fetch_cell("select
data_template_data.rrd_step
- from (data_template_data,data_template_rrd,graph_templates_item)
- where graph_templates_item.task_item_id=data_template_rrd.id
- and data_template_rrd.local_data_id=data_template_data.local_data_id
- and graph_templates_item.local_graph_id=" . $_GET["local_graph_id"] .
- "limit 0,1");
$ds_step = empty($ds_step) ? 300 : $ds_step;
$seconds_between_graph_updates = ($ds_step * $rra["steps"]);
--- 130,142 ----
$timespan = -($rra["timespan"]);
/* find the step and how often this graph is updated with new data */
+ $ds_step = db_fetch_cell("SELECT
data_template_data.rrd_step
+ FROM (data_template_data,data_template_rrd,graph_templates_item)
+ WHERE graph_templates_item.task_item_id=data_template_rrd.id
+ AND data_template_rrd.local_data_id=data_template_data.local_data_id
+ AND graph_templates_item.local_graph_id=" . $_GET["local_graph_id"] .
+ " LIMIT 0,1");
$ds_step = empty($ds_step) ? 300 : $ds_step;
$seconds_between_graph_updates = ($ds_step * $rra["steps"]);
Thanks
>patch -p1 -N < fix_sql_syntax_related_to_default_rra_id.patch
patching file graph.php
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file graph.php.rej
I'm guessing the yum version is already patched. Below is the graph.php.rej output.
***************
*** 130,142 ****
$timespan = -($rra["timespan"]);
/* find the step and how often this graph is updated with new data */
- $ds_step = db_fetch_cell("select
data_template_data.rrd_step
- from (data_template_data,data_template_rrd,graph_templates_item)
- where graph_templates_item.task_item_id=data_template_rrd.id
- and data_template_rrd.local_data_id=data_template_data.local_data_id
- and graph_templates_item.local_graph_id=" . $_GET["local_graph_id"] .
- "limit 0,1");
$ds_step = empty($ds_step) ? 300 : $ds_step;
$seconds_between_graph_updates = ($ds_step * $rra["steps"]);
--- 130,142 ----
$timespan = -($rra["timespan"]);
/* find the step and how often this graph is updated with new data */
+ $ds_step = db_fetch_cell("SELECT
data_template_data.rrd_step
+ FROM (data_template_data,data_template_rrd,graph_templates_item)
+ WHERE graph_templates_item.task_item_id=data_template_rrd.id
+ AND data_template_rrd.local_data_id=data_template_data.local_data_id
+ AND graph_templates_item.local_graph_id=" . $_GET["local_graph_id"] .
+ " LIMIT 0,1");
$ds_step = empty($ds_step) ? 300 : $ds_step;
$seconds_between_graph_updates = ($ds_step * $rra["steps"]);
Thanks
- fmangeant
- Cacti Guru User
- Posts: 2345
- Joined: Fri Sep 19, 2003 8:36 am
- Location: Sophia-Antipolis, France
- Contact:
Try to use the pre-patched files : http://www.cacti.net/downloads/patches/ ... e-patched/
You just have to replace the files (make backups first, and check file permissions after overwritting them).
You just have to replace the files (make backups first, and check file permissions after overwritting them).
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
Have you tried refreshing the that data query?
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
I was waiting for that response.. ![:D](./images/smilies/icon_biggrin.gif)
![:D](./images/smilies/icon_biggrin.gif)
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
Who is online
Users browsing this forum: No registered users and 6 guests