3) || ($host['snmp_community'] == '' && $host['snmp_version'] != 3)) { return null; } } $rrd_next_step = api_poller_get_rrd_next_step($host_id, $rrd_step, $local_data_id); return "($local_data_id, " . $host['poller_id'] . ', ' . $host['id'] . ", $poller_action_id," . db_qstr($host['hostname']) . ', ' . db_qstr($host['snmp_community']) . ', ' . db_qstr($host['snmp_version']) . ', ' . db_qstr($host['snmp_timeout']) . ', ' . db_qstr($host['snmp_retries']) . ', ' . db_qstr($host['snmp_username']) . ', ' . db_qstr($host['snmp_password']) . ', ' . db_qstr($host['snmp_auth_protocol']) . ', ' . db_qstr($host['snmp_priv_passphrase']) . ', ' . db_qstr($host['snmp_priv_protocol']) . ', ' . db_qstr($host['snmp_context']) . ', ' . db_qstr($host['snmp_engine_id']) . ', ' . db_qstr($host['snmp_port']) . ', ' . db_qstr($data_source_item_name) . ', ' . db_qstr(clean_up_path(get_data_source_path($local_data_id, true))) . ', ' . db_qstr($num_rrd_items) . ', ' . db_qstr($rrd_step) . ', ' . db_qstr($rrd_next_step) . ', ' . db_qstr($arg1) . ', ' . db_qstr($arg2) . ', ' . db_qstr($arg3) . ", '1')"; } return null; } function api_poller_get_rrd_next_step(int $host_id, int $rrd_step, int $local_data_id) : int { static $rrd_step_counter = 0; static $last_host = -1; static $last_data_id = -1; static $warning_issued = false; $poller_interval = read_config_option('poller_interval'); $rrd_next_step = 0; if (empty($poller_interval)) { $poller_interval = 300; } if ($rrd_step < $poller_interval && !$warning_issued) { $message = sprintf('WARNING: The Poller Interval is %s and you have a Data Source with a sampling interval of %s. Change your Poller Interval to %s seconds, and repopulate your poller cache.', $poller_interval, $rrd_step, $rrd_step); admin_email('Cacti Poller Interval Warning', $message); cacti_log($message, false, 'POLLER'); $warning_issued = true; } $process_leveling = read_config_option('process_leveling'); if ($last_host != $host_id || $process_leveling != 'on') { $rrd_step_counter = 0; } elseif ($rrd_step != $poller_interval) { if ($last_data_id != $local_data_id) { $rrd_step_counter++; } $modulus = ceil($rrd_step / $poller_interval); $rrd_next_step = $poller_interval * ($rrd_step_counter % $modulus); } $last_host = $host_id; $last_data_id = $local_data_id; return $rrd_next_step; }