Hello! There is such a php script:
ini_set('max_execution_time', 1000); ini_set("default_socket_timeout", 1); $ips=file("ip.txt"); function ssh_exec($n) { if (!function_exists("ssh2_connect")) die("function ssh2_connect doesn't exist"); if(!(@$con = ssh2_connect($n, 22))){ echo $n." - fail: unable to establish connection\n"; } else { if(!ssh2_auth_password($con, "user", "pass")) { echo $n." - fail: unable to authenticate\n"; } else { if (!($stream = ssh2_exec($con, "cat version" ))) { echo $n." - fail: unable to execute command\n"; } else { stream_set_blocking($stream, true); $data = ""; while ($buf = fread($stream,4096)) { $data .= $buf; } if (!$data = 'version.1') { echo $n." - ".$data;} else {echo $n." - ok\n";} fclose($stream); } } } } echo "<pre>"; foreach ($ips as $ip => $n) { ssh_exec(trim($n)); } echo "</pre>"; echo "Time: " . number_format(( microtime(true) - $startTime), 4) . " Seconds\n"; One connection takes 1.3 seconds, the problem is that IPs are 600+ and it takes about 13-15 minutes to interrogate all devices. Is it possible to optimize this process / script? SNMP is not an option yet.