Skip to content

Commit

Permalink
Fixing Cacti#5247 and QA on Cacti#5241 - Polling Issues
Browse files Browse the repository at this point in the history
* Rebuilding Poller Cache from Utilities does not respect poller interval due to lack or ordering
* Decrementing of rrd_next_step is flawed
  • Loading branch information
TheWitness committed Feb 20, 2023
1 parent 10ae8d9 commit 17bcbcc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Cacti CHANGELOG
-issue#5241: "Balance Process Load" dont work after upgrade to 1.2.23
-issue#5243: Template Export missing Graph Template columns multiple and test_source
-issue#5245: Add additional security to Cacti's use of the the unserialize function
-issue#5247: Rebuilding Poller Cache from Utilities does not respect poller interval due to lack or ordering

1.2.23
-security#4920: Add .htaccess file to scripts folder
Expand Down
12 changes: 9 additions & 3 deletions cmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
// record the start time
$start = microtime(true);
$poller_interval = read_config_option('poller_interval');
$cron_interval = read_config_option('cron_interval');
$active_profiles = read_config_option('active_profiles');

// check arguments
Expand All @@ -195,7 +196,7 @@

$params1 = array($poller_id);
$params2 = array($poller_id, POLLER_ACTION_SCRIPT_PHP, POLLER_ACTION_SCRIPT_PHP_COUNT);
$params3 = array($poller_interval, $poller_interval, $poller_interval, $poller_id);
$params3 = array($poller_interval, $poller_interval, 0, $poller_interval, $poller_id);
} else {
$sql_where0 = 'WHERE poller_id > ?';
$sql_where1 = ' AND ((h.id >= ? AND h.id <= ?) OR h.id IS NULL)';
Expand All @@ -204,7 +205,12 @@

$params1 = array($poller_id, $first, $last);
$params2 = array($poller_id, POLLER_ACTION_SCRIPT_PHP, POLLER_ACTION_SCRIPT_PHP_COUNT, $first, $last);
$params3 = array($poller_interval, $poller_interval, $poller_interval, $poller_id, $first, $last);

if ($cron_interval == $poller_interval) {
$params3 = array($poller_interval, $poller_interval, 0, $poller_interval, $poller_id, $first, $last);
} else {
$params3 = array($poller_interval, $poller_interval, $poller_interval, $poller_interval, $poller_id, $first, $last);
}
}

if ($debug) {
Expand Down Expand Up @@ -250,7 +256,7 @@

// setup next polling interval
db_execute_prepared("UPDATE poller_item AS pi
SET rrd_next_step = IF(rrd_step = ?, 0, IF(rrd_next_step - ? < 0, rrd_step, rrd_next_step - ?))
SET rrd_next_step = IF(rrd_step = ?, 0, IF(rrd_next_step - ? < 0, rrd_step - ?, rrd_next_step - ?))
WHERE poller_id = ?
$sql_where3",
$params3);
Expand Down
2 changes: 1 addition & 1 deletion lib/utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function repopulate_poller_cache() {
INNER JOIN host AS h
ON dl.host_id=h.id
WHERE dl.snmp_query_id = 0 OR (dl.snmp_query_id > 0 AND dl.snmp_index != "")
ORDER BY h.poller_id ASC');
ORDER BY h.poller_id ASC, h.id ASC');

$poller_items = array();
$local_data_ids = array();
Expand Down

0 comments on commit 17bcbcc

Please sign in to comment.