["pipe", "w"]], $pipes); if (!is_resource($proc)) { return; } $data = stream_get_contents($pipes[1]); fclose($pipes[1]); $retval = proc_close($proc); return json_decode($data); } const NVME_DATA_UNIT = 1000 * 512; const GIGABYTE = 10 ** 9; const TERABYTE = 10 ** 12; function data_unit($data) { $num = $data * NVME_DATA_UNIT; if ($num < TERABYTE) { return strval(round($num / GIGABYTE, 2)) . " GB"; } return strval(round($num / TERABYTE, 2)) . " TB"; } $data = get_data(); ?>
| Property | Value |
|---|---|
| smartctl = implode( ".", $data->smartctl->version, ) ?> | |
| Model Name | = $data->model_name ?> |
| Temperature | = $data->temperature->current ?> Celcius |
= implode("\n", $data->smartctl->output) ?>