mirror of
https://github.com/ShaYmez/ezservermonitor-web.git
synced 2024-11-15 21:01:46 -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
32 lines
937 B
PHP
32 lines
937 B
PHP
<?php
|
|
require 'Utils/Misc.class.php';
|
|
|
|
$datas = array();
|
|
|
|
if (!(exec('/sbin/ifconfig |awk -F \'[/ |: ]\' \'{print $1}\' |sed -e \'/^$/d\'', $getInterfaces)))
|
|
{
|
|
$datas[] = array('interface' => 'N.A', 'ip' => 'N.A');
|
|
}
|
|
else
|
|
{
|
|
exec('/sbin/ifconfig | awk \'/inet / {print $2}\' | cut -d \':\' -f2', $getIps);
|
|
|
|
foreach ($getInterfaces as $key => $interface)
|
|
{
|
|
// Get transmit and receive datas by interface
|
|
exec('cat /sys/class/net/'.$interface.'/statistics/tx_bytes', $getBandwidth_tx);
|
|
exec('cat /sys/class/net/'.$interface.'/statistics/rx_bytes', $getBandwidth_rx);
|
|
|
|
$datas[] = array(
|
|
'interface' => $interface,
|
|
'ip' => $getIps[$key],
|
|
'transmit' => Misc::getSize($getBandwidth_tx[0]),
|
|
'receive' => Misc::getSize($getBandwidth_rx[0]),
|
|
);
|
|
|
|
unset($getBandwidth_tx, $getBandwidth_rx);
|
|
}
|
|
}
|
|
|
|
|
|
echo json_encode($datas); |