mirror of
https://github.com/ShaYmez/ezservermonitor-web.git
synced 2026-06-02 22:14:56 -04:00
+ First commit (version 2.0)
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
require 'Utils/Config.class.php';
|
||||
$Config = new Config();
|
||||
|
||||
|
||||
$datas = array();
|
||||
|
||||
if (count($Config->get('ping:hosts')) > 0)
|
||||
$hosts = $Config->get('ping:hosts');
|
||||
else
|
||||
$hosts = array('google.com', 'wikipedia.org');
|
||||
|
||||
foreach ($hosts as $host)
|
||||
{
|
||||
exec('/bin/ping -qc 1 '.$host.' | awk -F/ \'/^rtt/ { print $5 }\'', $result);
|
||||
|
||||
$datas[] = array(
|
||||
'host' => $host,
|
||||
'ping' => $result[0],
|
||||
);
|
||||
|
||||
unset($result);
|
||||
}
|
||||
|
||||
echo json_encode($datas);
|
||||
Reference in New Issue
Block a user