#!/usr/bin/php -q 0) and (read_config_option("poller_enabled") == "on")) { /* Determine the number of hosts to process per file */ $hosts_per_file = ceil(sizeof($polling_items) / $concurrent_processes ); /* Determine Command Name */ if (($config["cacti_server_os"] == "unix") and ($poller == "2")) { $command_string = read_config_option("path_cactid"); $extra_args = ""; }else if ($config["cacti_server_os"] == "unix") { $command_string = read_config_option("path_php_binary"); $extra_args = $config["base_path"] . "/cmd.php"; }else if ($poller == "2") { $command_string = read_config_option("path_cactid"); $extra_args = ""; }else{ $command_string = read_config_option("path_php_binary"); $extra_args = $config["base_path"] . "\\cmd.php"; } /* Populate each execution file with appropriate information */ foreach ($polling_items as $item) { if ($host_count == 1) { $first_host = $item["id"]; } if ($host_count == $hosts_per_file) { $last_host = $item["id"]; $change_files = True; } $host_count ++; if ($change_files) { exec_background($command_string, "$extra_args $first_host $last_host"); $host_count = 1; $change_files = False; $first_host = 0; $last_host = 0; } /* End change_files */ } /* End For Each */ if ($host_count > 1) { $last_host = $item["id"]; exec_background($command_string, "$extra_args $first_host $last_host"); } /* insert the current date/time for graphs */ db_execute("replace into settings (name,value) values ('date',NOW())"); /* take time and log performance data */ list($micro,$seconds) = split(" ", microtime()); $end = $seconds + $micro; if ($poller == "1") { $max_threads = "N/A"; } if(read_config_option("log_pstats") == "on") log_data(sprintf("STATS: " . "Execution Time: %01.4f s, " . "Method: %s, " . "Max Processes: %s, " . "Max Threads/Process: %s, " . "Polled Hosts: %s, " . "Hosts/Process: %s", round($end-$start,4), $command_string, $concurrent_processes, $max_threads, sizeof($polling_items), $hosts_per_file)); }else{ print "There are no items in your poller cache or polling is disabled. Make sure you have at least one data source created. If you do, go to 'Utilities', and select 'Clear Poller Cache'.\n"; } // End Mainline Processing ?>