';
//configure script
$timeout = "1";
//set service checks
/*
The script will open a socket to the following service to test for connection.
Does not test the fucntionality, just the ability to connect
Each service can have a name, port and the Unix domain it run on (default to localhost)
*/
$services = array();
$services[] = array("port" => "80", "service" => "Web server", "ip" => "") ;
$services[] = array("port" => "21", "service" => "FTP", "ip" => "") ;
$services[] = array("port" => "3306", "service" => "MYSQL", "ip" => "") ;
// $services[] = array("port" => "3000", "service" => "Mastodon web", "ip" => "") ;
// $services[] = array("port" => "4000", "service" => "Mastodon streaming", "ip" => "") ;
$services[] = array("port" => "22", "service" => "Open SSH", "ip" => "") ;
$services[] = array("port" => "58846", "service" => "Deluge", "ip" => "") ;
$services[] = array("port" => "8112", "service" => "Deluge Web", "ip" => "") ;
$services[] = array("port" => "80", "service" => "Internet Connection", "ip" => "google.com") ;
$services[] = array("port" => "8083", "service" => "Vesta panel", "ip" => "") ;
//begin table for status
$data .= "
Service | Port | Status |
";
foreach ($services as $service) {
if($service['ip']==""){
$service['ip'] = "localhost";
}
$data .= "" . $service['service'] . " | ". $service['port'];
$fp = @fsockopen($service['ip'], $service['port'], $errno, $errstr, $timeout);
if (!$fp) {
$data .= " | Offline |
";
//fclose($fp);
} else {
$data .= "Online | ";
fclose($fp);
}
}
//close table
$data .= "
";
$data .= '