Skip to content

Commit

Permalink
Fixing #5451 - Slow Graph Creation Over Time
Browse files Browse the repository at this point in the history
* Reported on the Forums, Graph creation slows over time
  • Loading branch information
TheWitness committed Aug 12, 2023
1 parent 8746a05 commit f5dabf9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ Cacti CHANGELOG
-issue#5446: Duplication functions for Graph/Template and Data Source/Template do not return an id
-issue#5447: Duplication of Device Templates happens in the base Cacti file and not in an API file
-issue#5450: Unable to bulk convert to latin1 if desired
-issue#5451: Reported on the Forums, Graph creation slows over time
-feature#5375: Add template for Fortinet firewall and Aruba Instant cluster
-feature#5393: Add template for SNMP printer
-feature#5418: Display device class before package import
Expand Down
16 changes: 6 additions & 10 deletions lib/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -2299,21 +2299,17 @@ function data_source_exists($graph_template_id, $host_id, &$data_template, &$snm
} else {
/* create each data source, but don't duplicate */
$data_source = db_fetch_row_prepared('SELECT dl.*
FROM data_template AS dt
INNER JOIN data_local AS dl
ON dl.data_template_id=dt.id
FROM data_local AS dl
INNER JOIN data_template_rrd AS dtr
ON dtr.data_template_id=dt.id
ON dtr.data_template_id = dl.data_template_id
AND dtr.local_data_id = dl.id
INNER JOIN graph_templates_item AS gti
ON gti.task_item_id=dtr.id
WHERE dtr.local_data_id > 0
AND dl.host_id = ?
ON gti.task_item_id = dtr.id
WHERE dl.host_id = ?
AND dl.data_template_id = ?
AND dtr.data_source_name = ?
AND gti.local_graph_id > 0
AND gti.graph_template_id = ?
GROUP BY dt.id
ORDER BY dt.name',
LIMIT 1',
array($host_id, $data_template['id'], $data_template['data_source_name'], $graph_template_id));

return $data_source;
Expand Down

0 comments on commit f5dabf9

Please sign in to comment.