//Загрузка процессора
$cpus='"Cpu(s)"';
$cpus2="'{print $2 + $4}'";
$cpuloads = exec('top -b -n1 | grep '.$cpus." | awk ".$cpus2);
sg('Sensor_percentage03.value',$cpuloads);
//Температура проца
$cpu_temp=`cat /sys/devices/virtual/thermal/thermal_zone0/temp`;
$cpu_temp=round($cpu_temp,1);
setGlobal("Sensor_temp04.value",$cpu_temp);
//Время запуска
$data = shell_exec('uptime');
$uptime = explode(' up ', $data);
$uptime = explode(',', $uptime[1]);
sg('OHM.Uptime',trim($uptime[0]));
//Загрузка памяти
$mem_total=exec("vmstat -s -S M | grep mem | grep total | awk '{print $1}'");
$mem_used=exec("vmstat -s -S M | grep mem | grep used | awk '{print $1}'");
$sys_memory=round($mem_used/$mem_total*100, 2);
//$sys_memory=round($mem_used/$mem_total*100, 2) ."%";
setGlobal("Sensor_percentage04.value",$sys_memory);
//-------------------------
//Сколько места на флешке
$bytes = disk_free_space(".");
$tbytes = disk_total_space(".");
$si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
$base = 1024;
$class = min((int)log($bytes , $base) , count($si_prefix) - 1);
$temp = round($bytes / pow($base,$class)) . ' ' . $si_prefix[$class];
sg('OHM.hddFreeSpaceC',$temp);
$class = min((int)log($tbytes , $base) , count($si_prefix) - 1);
$temp = round($tbytes / pow($base,$class)) . ' ' . $si_prefix[$class];
sg('OHM.hddTotalSpace',$temp);
$bytes = disk_free_space(".");
$tbytes = disk_total_space(".");
$bytes = $tbytes - $bytes;
$si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
$base = 1024;
$class = min((int)log($bytes , $base) , count($si_prefix) - 1);
$temp = round($bytes / pow($base,$class)) . ' ' . $si_prefix[$class];
sg('OHM.hddSpaceUsed',$temp);