Einfaches Bootstrap / PHP Script um einzelne Server Dienste zu überwachen.
<?php function check_port($host,$port,$timeout){ $tbegin = microtime(true); $fp = fsockopen($host, $port, $errno, $errstr, $timeout); $responding = 1; if (!$fp) { $responding = 0; } $tend = microtime(true); fclose($fp); $mstime = ($tend - $tbegin) * 1000; $mstime = round($mstime, 2); if($responding) { return '<span style="color:green;" class="glyphicon glyphicon glyphicon-ok ok-cross"></span>'; } else { return '<span style="color:red;" class="glyphicon glyphicon glyphicon-remove"></span>'; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <title>Service Status</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="row"> <div class="col-md-12"> <br><br> <h3 style="font-weight:300;">Server Dienst Status</h3> <table style="box-shadow: 0 0 40px #ccc;border: 1px solid #ddd;" class="table package-table"> <tbody> <tr style="background: rgba(230, 247, 189, 0.63);"> <td>Dienste:</td> <td>HTTP 80</td> <td>FTP 21</td> <td>SSH 22</td> </tr> <tr> <td>example.com</td> <td><?php echo check_port("example.com",80,1); ?></td> <td><?php echo check_port("example.com",21,1); ?></td> <td><?php echo check_port("example.com",22,1); ?></td> </tr> <tr> <td>webgreat.de</td> <td><?php echo check_port("webgreat.de",80,1); ?></td> <td><?php echo check_port("webgreat.de",21,1); ?></td> <td><?php echo check_port("webgreat.de",22,1); ?></td> </tr> <tr> <td>google.com</td> <td><?php echo check_port("google.com",80,1); ?></td> <td><?php echo check_port("google.com",21,1); ?></td> <td><?php echo check_port("google.com",22,1); ?></td> </tr> </tbody> </table> </div> </div> </div> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> </body> </html>