#!/usr/bin/php Poll single device\n"); echo("--os Poll all devices of a given OS\n"); echo("--all Poll all devices\n\n"); echo("No polling type specified!\n"); exit; } if ($argv[2] == "--type" && $argv[3]) { $type = $argv[3]; } elseif ($argv[3] == "--type" && $argv[4]) { $type = $argv[4]; } else { echo("Require valid polling type.\n"); exit; } $devices_polled = 0; $device_query = mysql_query("SELECT * FROM `devices` WHERE status = '1' $where ORDER BY device_id DESC"); while ($device = mysql_fetch_array($device_query)) { echo("\n" . $device['hostname'] ."\n"); $host_rrd = $config['rrd_dir'] . "/" . $device['hostname']; $where = "WHERE device_id = '" . $device['device_id'] . "' AND deleted = '0'"; include("includes/polling/".$type.".inc.php"); echo("\n"); $devices_polled++; unset($array); } $poller_end = utime(); $poller_run = $poller_end - $poller_start; $poller_time = substr($poller_run, 0, 5); $string = $argv[0] . " " . date("F j, Y, G:i") . " - $i devices polled in $poller_time secs"; echo("$string\n"); shell_exec("echo '".$string."' >> /tmp/observer.log"); ?>