mirror of
https://github.com/ShaYmez/ezservermonitor-web.git
synced 2026-06-08 00:44:54 -04:00
General : cleaning and optimizing CSS
General : responsive design General : reload button now spins when you reload block General : update jQuery plugin Knob to 1.2.11 General : optimizing security (config file esm.config.json is now in the conf/ folder with an htaccess) CPU : retrieves correctly CPU frequency for Raspberry Pi CPU : add CPU temperature (+ option to enable/disable) System : little correction for getting distro name Swap : fix if swap is disabled Services status : adds protocol TCP or UDP for checking service status Services status : new option to hide port number (see show_port in services section)
This commit is contained in:
+21
-23
@@ -1,35 +1,33 @@
|
||||
<?php
|
||||
require 'Utils/Config.class.php';
|
||||
require '../autoload.php';
|
||||
$Config = new Config();
|
||||
|
||||
|
||||
$datas = array();
|
||||
|
||||
if (count($Config->get('services')) > 0)
|
||||
$available_protocols = array('tcp', 'udp');
|
||||
|
||||
$show_port = $Config->get('services:show_port');
|
||||
|
||||
if (count($Config->get('services:list')) > 0)
|
||||
{
|
||||
foreach ($Config->get('services') as $service)
|
||||
foreach ($Config->get('services:list') 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);
|
||||
}
|
||||
$host = $service['host'];
|
||||
$port = $service['port'];
|
||||
$name = $service['name'];
|
||||
$protocol = isset($service['protocol']) && in_array($service['protocol'], $available_protocols) ? $service['protocol'] : 'tcp';
|
||||
|
||||
if (Misc::scanPort($host, $port, $protocol))
|
||||
$status = 1;
|
||||
else
|
||||
{
|
||||
$datas[] = array(
|
||||
'port' => $service['port'],
|
||||
'name' => $service['name'],
|
||||
'status' => 0,
|
||||
);
|
||||
}
|
||||
$status = 0;
|
||||
|
||||
$datas[] = array(
|
||||
'port' => $show_port === true ? $port : '',
|
||||
'name' => $name,
|
||||
'status' => $status,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user