in Tools

Simple PHP Ping Tool

Akhirnya tool ping server menggunakan php yang simple dan super ndeso ku jadi juga, ahaha… fungsinya sih bisa untuk ping server dengan ICMP Exec Server Linux, dan ping port dengan menggunakan Fsock, Yah pokoknya begitu lah,.. kalo bener2 Ndeso maklumin aja yak, soalnya bukan programmer sih 🙂 ini berkat bantuan kk Latief. Berikut code nya :




Server Monitoring Ping Tool
 


';
    $today = date("j F, Y, g:i a");
 echo '';
 ###LOOPING###
    foreach($server as $num => $ip) {
    $pingresult = exec('ping -c1 -w1 '.$ip); 

    preg_match_all('/max/i',$pingresult, $status); 
	if($status[0][0]){
        echo ''; 
	$i++;
    }
	$End = getTime();
	echo '';
    echo '
Status
'.$today.'

'.$nameserver[$i].'
'.$ip.'
';echo '
'; if ($web[$i]=="1"){if (fsockopen ($ip, 80)){echo "Webserver ok";}else{echo "Webserver nok";}echo '
';}; if ($mysql[$i]=="1"){if (fsockopen ($ip, 3306)){echo "Mysqlserver ok";}else{echo "Mysqlserver nok";}echo '
';}; if ($sqlserver[$i]=="1"){if (fsockopen ($ip, 1433)){echo "Sqlserver ok";}else{echo "Sqlserver nok";}echo '
';}; if ($firebird[$i]=="1"){if (fsockopen ($ip, 3050)){echo "Firebird ok";}else{echo "Firebird nok";}echo '
';}; echo ''; } else { echo '

'.$nameserver[$i].'
'.$ip.'
';echo '
'; if ($web[$i]=="1"){if (fsockopen ($ip, 80)){echo "Webserver ok";}else{echo "Webserver nok";}echo '
';}; if ($mysql[$i]=="1"){if (fsockopen ($ip, 3306)){echo "Mysqlserver ok";}else{echo "Mysqlserver nok";}echo '
';}; if ($sqlserver[$i]=="1"){if (fsockopen ($ip, 1433)){echo "Sqlserver ok";}else{echo "Sqlserver nok";}echo '
';}; if ($firebird[$i]=="1"){if (fsockopen ($ip, 3050)){echo "Firebird ok";}else{echo "Firebird nok";}echo '
';}; echo ''; } echo '
'."Time taken = ".number_format(($End - $Start),2)." secs".'
'; ?>

Scrshot:

Simple PHP Ping Tool

Simple PHP Ping Tool

Download : File