$temp=exec("\/usr\/sbin\/hddtemp \/dev\/sda1");
ereg("[^:]*\:[ ]*[^:]*\:[ ]*([0-9+-.]*)",$temp,$arr);
$temp = trim($arr[1]);
$temp = str_replace('+','',$temp);
sg('mdsensors.hddtemp',$temp);
$data = shell_exec('uptime');
$uptime = explode(' up ', $data);
$uptime = explode(',', $uptime[1]);
sg('mdsensors.uptime',trim($uptime[0]));
$bytes = disk_free_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('mdsensors.freespace',$temp);
$data = shell_exec('vcgencmd measure_temp');
sg('mdsensors.systemp',str_replace('\'C','', substr($data,5)));
$data = shell_exec('uname -r');
sg('mdsensors.kernell',trim($data));
$data = shell_exec('cat /proc/cpuinfo |grep Hardware');
sg('mdsensors.chip',trim($data));
$data = shell_exec('cat /proc/cpuinfo |grep BogoMIPS');
sg('mdsensors.bogomips',trim($data));
$bogomips=explode("\n", $data);
sg('mdsensors.bogomips1',str_replace('BogoMIPS : ','',$bogomips[0]));
sg('mdsensors.bogomips2',str_replace('BogoMIPS : ','',$bogomips[1]));
sg('mdsensors.bogomips3',str_replace('BogoMIPS : ','',$bogomips[2]));
sg('mdsensors.bogomips4',str_replace('BogoMIPS : ','',$bogomips[3]));
$data = shell_exec('df');
sg('mdsensors.diskfree',trim($data));
$data = shell_exec('free');
sg('mdsensors.free',trim($data));
$data = shell_exec('cat /proc/version');
sg('mdsensors.os',trim($data));
$data = shell_exec('df |grep /dev/root');
sg('mdsensors.dfall',trim($data));
$data2 = explode(' ',trim(str_replace('/dev/root', '',$data)));
$data3 = mb_split ('\s{1,}',trim(str_replace('/dev/root', '',$data)));
sg('mdsensors.dfsize',$data2[0]);
sg('mdsensors.dfused',$data2[1]);
sg('mdsensors.dfaviable',$data3[2]);
$proc=explode('%',$data);
sg('mdsensors.dfproc',trim(substr($proc[0],-3)));
$data = trim(shell_exec('free |grep Mem'));
$data2 = trim(str_replace('Mem:', '',$data));
#$data3 = explode(' ',$data2);
$data3 = mb_split ('\s{1,}',$data2);
sg('mdsensors.freetotal',$data3[0]);
sg('mdsensors.freeused',$data3[1]);
sg('mdsensors.freefree',$data3[2]);
$data = shell_exec('vcgencmd get_mem arm');
sg('mdsensors.getmemcpu',trim($data));
$data = shell_exec('vcgencmd get_mem gpu');
sg('mdsensors.getmemgpu',trim($data));
$data = shell_exec('lsusb');
sg('mdsensors.lsusb',trim($data));
$data = shell_exec('vcgencmd measure_volts core');
$data =explode('=',trim($data));
sg('mdsensors.kernellvcc',substr($data[1],0,-1));
$data = shell_exec('vcgencmd codec_enabled CODECNAME ');
sg('mdsensors.codecs',trim($data));
$data = shell_exec('cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq');
sg('mdsensors.freqcur',trim($data));
$data = shell_exec('cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq');
sg('mdsensors.freqmin',trim($data));
$data = shell_exec('cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq');
sg('mdsensors.freqmax',trim($data));
$data = shell_exec('ps -x');
sg('mdsensors.ps',trim($data));