mirror of
https://github.com/ShaYmez/ezservermonitor-web.git
synced 2024-12-20 00:25:59 -05:00
3f6a49bae3
- Services : fix on service names with accent - Services : ability to specify a host for each service - Network usage : fix to retrieve the name of the network interfaces - Memory : the cached and buffers memory are added to free memory now - Load Average : taking into account the number of cores - Disk usage : new option to hide tmpfs mountpoints - General : remove all PHP short tags
37 lines
799 B
PHP
37 lines
799 B
PHP
<?php
|
|
require 'Utils/Config.class.php';
|
|
$Config = new Config();
|
|
|
|
|
|
$datas = array();
|
|
|
|
if (count($Config->get('services')) > 0)
|
|
{
|
|
foreach ($Config->get('services') as $service)
|
|
{
|
|
$host = $service['host'];
|
|
$sock = @fsockopen($host, $service['port'], $num, $error, 5);
|
|
|
|
if ($sock)
|
|
{
|
|
$datas[] = array(
|
|
'port' => $service['port'],
|
|
'name' => $service['name'],
|
|
'status' => 1,
|
|
);
|
|
|
|
fclose($sock);
|
|
}
|
|
else
|
|
{
|
|
$datas[] = array(
|
|
'port' => $service['port'],
|
|
'name' => $service['name'],
|
|
'status' => 0,
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
echo json_encode($datas); |