add_graph script causing mysql load

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
sys0p
Posts: 48
Joined: Sun Jan 14, 2007 3:46 pm
Location: Europe

add_graph script causing mysql load

Post by sys0p »

Hello,

I am trying to run the following :

php -q add_graphs.php --graph-type=ds --graph-template-id=31 --snmp-query-id=13 --snmp-query-type-id=20 --host-id=3 --snmp-field=ifOperStatus --snmp-value=Up

I am using cacti version 0.8.7b with the latest patches.

This is happening only when using graph-template-id=31 .

SQL statement below:

SELECT DISTINCT data_input_fields.data_name AS `name`, data_input_fields.name AS `description`, data_input_data.value AS `default`, data_template_data.data_template_id, data_input_fields.id AS `data_input_field_id` FROM data_input_data INNER JOIN (((data_template_rrd INNER JOIN (graph_templates INNER JOIN graph_templates_item ON graph_templates.id = graph_templates_item.graph_template_id) ON data_template_rrd.id = graph_templates_item.task_item_id) INNER JOIN data_template_data ON data_template_rrd.data_template_id=data_template_data.data_template_id) INNER JOIN data_input_fields ON data_template_data.data_input_id=data_input_fields.data_input_id) ON (data_input_data.data_template_data_id = data_template_data.id) AND (data_input_data.data_input_field_id = data_input_fields.id) WHERE (((graph_templates.id)=31) AND ((data_input_data.t_value)='on') AND ((data_input_fields.input_output)='in'));



Can you please let me know what exactly is causing this ? I tried to repair the tables after restarting mysql and the same result.


Thanks!
sys0p
Posts: 48
Joined: Sun Jan 14, 2007 3:46 pm
Location: Europe

Post by sys0p »

It seems that there is a very very slow query involved here:

# Query_time: 1030 Lock_time: 0 Rows_sent: 3 Rows_examined: 39622008
use cacti;
SELECT DISTINCT data_input_fields.data_name AS `name`, data_input_fields.name AS `description`, data_input_data.value AS `default`, data_template_data.data_template_id, data_input_fields.id AS `data_input_field_id` FROM data_input_data INNER JOIN (((data_template_rrd INNER JOIN (graph_templates INNER JOIN graph_templates_item ON graph_templates.id = graph_templates_item.graph_template_id) ON data_template_rrd.id = graph_templates_item.task_item_id) INNER JOIN data_template_data ON data_template_rrd.data_template_id=data_template_data.data_template_id) INNER JOIN data_input_fields ON data_template_data.data_input_id=data_input_fields.data_input_id) ON (data_input_data.data_template_data_id = data_template_data.id) AND (data_input_data.data_input_field_id = data_input_fields.id) WHERE (((graph_templates.id)=31) AND ((data_input_data.t_value)='on') AND ((data_input_fields.input_output)='in'));



Can any developer shed some light on this ?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests