ezservermonitor-web/libs/services.php
ShevAbam 3f6a49bae3 - System : fix to get the distro name
- 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
2014-06-18 10:15:18 +02:00

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);