Nchan implementation

This commit is contained in:
bergware
2021-06-25 15:46:31 +02:00
parent 3f9821a343
commit 34eca22b82

View File

@@ -19,21 +19,21 @@ $data = [];
require_once "$docroot/webGui/include/Helpers.php";
require_once "$docroot/webGui/include/publish.php";
exec("ls $net|grep -Po '^(lo|(bond|eth)\d+)$'",$ports);
// satisfy translations (not used)
if (!function_exists('_')) {
function _($text) {return $text;}
}
$time0 = $time = microtime(true);
exec("ls $net|grep -Po '^(lo|(bond|eth)\d+)$'",$ports);
foreach ($ports as $port) {
$data[$port]['rx'] = (float)file_get_contents("$net/$port/statistics/rx_bytes");
$data[$port]['tx'] = (float)file_get_contents("$net/$port/statistics/tx_bytes");
}
while (true) {
$echo = $mode = $rxtx = $stat = [];
$ports = $echo = $mode = $rxtx = $stat = [];
$ts = $time - $time0;
exec("ls $net|grep -Po '^(lo|(bond|eth)\d+)$'",$ports);
foreach ($ports as $port) {
// inbound + outbound speed
$rx = (float)file_get_contents("$net/$port/statistics/rx_bytes");