with `-v` to print version * banners (MMDVMHost, DMRGateway, DMR2YSF/NXDN, YSFGateway, * DGIdGateway, YSF2DMR/P25/NXDN, P25Gateway, NXDNGateway, * M17Gateway, DAPNETGateway). */ require_once($_SERVER['DOCUMENT_ROOT'].'/config/security_headers.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/config/banner_warnings.inc'); setSecurityHeaders(); // Layer 2 of the default-password protection — see config/banner_warnings.inc. // MUST run BEFORE any output so header('Location: ...') works. pistar_warnings_enforce_redirect(); // Load the language support require_once('config/language.php'); // Load the Pi-Star Release file $pistarReleaseConfig = '/etc/pistar-release'; $configPistarRelease = array(); $configPistarRelease = parse_ini_file($pistarReleaseConfig, true); // Load the Version Info require_once('config/version.php'); // Retrieve server information $system = system_information(); function system_information() { @list($system, $host, $kernel) = preg_split('/[\s,]+/', php_uname('a'), 5); $meminfo = false; if (@is_readable('/proc/meminfo')) { $data = explode("\n", file_get_contents("/proc/meminfo")); $meminfo = array(); foreach ($data as $line) { if (strpos($line, ':') !== false) { list($key, $val) = explode(":", $line); $meminfo[$key] = 1024 * floatval( trim( str_replace( ' kB', '', $val ) ) ); } } } return array('date' => date('Y-m-d H:i:s T'), 'mem_info' => $meminfo, 'partitions' => disk_list() ); } function disk_list() { $partitions = array(); // Fetch partition information from df command // I would have used disk_free_space() and disk_total_space() here but // there appears to be no way to get a list of partitions in PHP? $output = array(); @exec('df --block-size=1', $output); foreach($output as $line) { $columns = array(); foreach(explode(' ', $line) as $column) { $column = trim($column); if($column != '') $columns[] = $column; } // Only process 6 column rows // (This has the bonus of ignoring the first row which is 7) if(count($columns) == 6) { $partition = $columns[5]; $partitions[$partition]['Temporary']['bool'] = in_array($columns[0], array('tmpfs', 'devtmpfs')); $partitions[$partition]['Partition']['text'] = $partition; $partitions[$partition]['FileSystem']['text'] = $columns[0]; if(is_numeric($columns[1]) && is_numeric($columns[2]) && is_numeric($columns[3])) { $partitions[$partition]['Size']['value'] = $columns[1]; $partitions[$partition]['Free']['value'] = $columns[3]; $partitions[$partition]['Used']['value'] = $columns[2]; } else { // Fallback if we don't get numerical values $partitions[$partition]['Size']['text'] = $columns[1]; $partitions[$partition]['Used']['text'] = $columns[2]; $partitions[$partition]['Free']['text'] = $columns[3]; } } } return $partitions; } function formatSize( $bytes ) { $types = array( 'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ); for( $i = 0; $bytes >= 1024 && $i < ( count( $types ) -1 ); $bytes /= 1024, $i++ ); return( round( $bytes, 2 ) . " " . $types[$i] ); } ?>
| Pi-Star System Information | Memory | Stats | \n"; $sysRamUsed = $system['mem_info']['MemTotal'] - $system['mem_info']['MemFree'] - $system['mem_info']['Buffers'] - $system['mem_info']['Cached']; $sysRamPercent = sprintf('%.2f',($sysRamUsed / $system['mem_info']['MemTotal']) * 100); echo "
|---|---|
| RAM | ";
echo " Total: ".formatSize($system['mem_info']['MemTotal'])." Used: ".formatSize($sysRamUsed)." Free: ".formatSize($system['mem_info']['MemTotal'] - $sysRamUsed)." |
| Mount | Stats |
| ".$fs['Partition']['text']." | ";
echo " Total: ".formatSize($diskTotal)." Used: ".formatSize($diskUsed)." Free: ".formatSize($diskFree)." |
| Binary | Version |
| MMDVMHost | ".$MMDVMHost_Ver." |
| DMRGateway | ".$DMRGateway_Ver." |
| DMR2YSF | ".$DMR2YSF_Ver." |
| DMR2NXDN | ".$DMR2NXDN_Ver." |
| YSFGateway | ".$YSFGateway_Ver." |
| DGIdGateway | ".$DGIdGateway_Ver." |
| YSF2DMR | ".$YSF2DMR_Ver." |
| YSF2P25 | ".$YSF2P25_Ver." |
| YSF2NXDN | ".$YSF2NXDN_Ver." |
| P25Gateway | ".$P25Gateway_Ver." |
| NXDNGateway | ".$NXDNGateway_Ver." |
| M17Gateway | ".$M17Gateway_Ver." |
| DAPNETGateway | ".$DAPNETGateway_Ver." |