diff --git a/CHANGELOG b/CHANGELOG index 4db3ff14ff..6e8258a647 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/cmd.php b/cmd.php index 0effd24fe1..1efac1405c 100755 --- a/cmd.php +++ b/cmd.php @@ -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 @@ -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)'; @@ -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) { @@ -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); diff --git a/lib/utility.php b/lib/utility.php index 0e9abeaffd..17610e2c0d 100644 --- a/lib/utility.php +++ b/lib/utility.php @@ -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();