3) || ($host["snmp_community"] == "" && $host["snmp_version"] != 3)) { return; } } $rrd_next_step = api_poller_get_rrd_next_step($rrd_step, $num_rrd_items); return "($local_data_id, " . "0, " . $host["id"] . ", $poller_action_id," . $cnn_id->qstr($host["hostname"]) . ", " . $cnn_id->qstr($host["snmp_community"]) . ", " . $cnn_id->qstr($host["snmp_version"]) . ", " . $cnn_id->qstr($host["snmp_timeout"]) . ", " . $cnn_id->qstr($host["snmp_username"]) . ", " . $cnn_id->qstr($host["snmp_password"]) . ", " . $cnn_id->qstr($host["snmp_auth_protocol"]) . ", " . $cnn_id->qstr($host["snmp_priv_passphrase"]) . ", " . $cnn_id->qstr($host["snmp_priv_protocol"]) . ", " . $cnn_id->qstr($host["snmp_context"]) . ", " . $cnn_id->qstr($host["snmp_port"]) . ", " . $cnn_id->qstr($data_source_item_name) . ", " . $cnn_id->qstr(clean_up_path(get_data_source_path($local_data_id, true))) . ", " . $cnn_id->qstr($num_rrd_items) . ", " . $cnn_id->qstr($rrd_step) . ", " . $cnn_id->qstr($rrd_next_step) . ", " . $cnn_id->qstr($arg1) . ", " . $cnn_id->qstr($arg2) . ", " . $cnn_id->qstr($arg3) . ", '1')"; } } function api_poller_get_rrd_next_step($rrd_step=300, $num_rrd_items=1) { global $config; $poller_interval = read_config_option("poller_interval"); $rrd_next_step = 0; if (($rrd_step != $poller_interval) && (isset($poller_interval))){ if (!isset($config["rrd_step_counter"])) { $rrd_step_counter = read_config_option("rrd_step_counter"); }else{ $rrd_step_counter = $config["rrd_step_counter"]; } if ($num_rrd_items == 1) { $config["rrd_num_counter"] = 0; }else{ if (!isset($config["rrd_num_counter"])) { $config["rrd_num_counter"] = 1; }else{ $config["rrd_num_counter"]++; } } $modulus = $rrd_step / $poller_interval; if (($modulus < 1) || ($rrd_step_counter == 0)) { $rrd_next_step = 0; }else{ $rrd_next_step = $poller_interval * ($rrd_step_counter % $modulus); } if ($num_rrd_items == 1) { $rrd_step_counter++; }else{ if ($num_rrd_items == $config["rrd_num_counter"]) { $rrd_step_counter++; $config["rrd_num_counter"] = 0; } } if ($rrd_step_counter >= $modulus) { $rrd_step_counter = 0; } /* save rrd_step_counter */ $config["rrd_step_counter"] = $rrd_step_counter; db_execute("replace into settings (name, value) values ('rrd_step_counter','$rrd_step_counter')"); } return $rrd_next_step; } ?>