Cacti SQL Query Problem

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
BrandonT
Posts: 5
Joined: Fri Oct 13, 2006 9:23 am

Cacti SQL Query Problem

Post by BrandonT »

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
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Hi

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]
BrandonT
Posts: 5
Joined: Fri Oct 13, 2006 9:23 am

Post by BrandonT »

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
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

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).
[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]
BrandonT
Posts: 5
Joined: Fri Oct 13, 2006 9:23 am

Post by BrandonT »

Patched or un-patched doesn't seem to make a difference.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

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]
BrandonT
Posts: 5
Joined: Fri Oct 13, 2006 9:23 am

Post by BrandonT »

If I run the verbose query from the 'Associated Data Queries' portion of the device page, it runs fine and returns data. I click the green circle and no errors are returned.

How else can I refresh the data query?

Thanks
BrandonT
Posts: 5
Joined: Fri Oct 13, 2006 9:23 am

Post by BrandonT »

I'm not sure, but I think the data query refresh did the trick. I deleted all of the old (empty) data sources and graphs, then created new ones.

Thanks for your help.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

I was waiting for that response.. :D
[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]
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests