Skip to content

Commit

Permalink
Utilities view has calculation errors when there are no data sources (#…
Browse files Browse the repository at this point in the history
…4472)

Closes #4472
  • Loading branch information
netniV committed Nov 22, 2021
1 parent 17e2240 commit 40ef3f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Cacti CHANGELOG
-issue#4461: When viewing graph data, non-numeric values may appear
-issue#4457: Titles may show "Missing Datasource" incorectly
-issue#4460: Polling does not complete as expected on larger systems
-issue#4472: Utilities view has calculation errors when there are no data sources

1.2.19
-security#4356: Further fixes for grave character security protection
Expand Down
4 changes: 2 additions & 2 deletions utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -2226,7 +2226,7 @@ function applyFilter() {

$poller_items = db_fetch_cell('SELECT COUNT(local_data_id) FROM poller_item');
$data_sources = db_fetch_cell('SELECT COUNT(DISTINCT local_data_id) FROM poller_item');
$pi_ds = $poller_items / $data_sources;
$pi_ds = ($data_sources ? ($poller_items / $data_sources) : 0);

if ($pending_ds == 0) {
$remaining = $arch_records;
Expand Down Expand Up @@ -2336,7 +2336,7 @@ function applyFilter() {
form_alternate_row();
print '<td>' . __('Total Poller Items:') . '</td><td>' . number_format_i18n($poller_items, -1) . '</td>';

$premaining = round(($pending_ds / $data_sources) * 100, 1);
$premaining = ($data_sources ? (round(($pending_ds / $data_sources) * 100, 1)) : 0);

if ($total_records) {
form_alternate_row();
Expand Down

0 comments on commit 40ef3f5

Please sign in to comment.