["pipe", "w"]], $pipes); if (!is_resource($proc)) { return; } $data = stream_get_contents($pipes[1]); fclose($pipes[1]); $retval = proc_close($proc); if ($retval == 0) { return json_decode($data); } return $data . "\nProcess exited with $retval"; } 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(); ?> Block Device Status

"; echo $data; echo ""; } else { ?>
Property Value
smartctl smartctl->version, ) ?>
Model Name model_name ?>
Temperature temperature->current ?> Celcius

SMART data

device->type == "nvme") { $health = $data->nvme_smart_health_information_log; ?>
Property Value
Data Units Read data_units_read) . " (" . data_unit($health->data_units_read) . ")" ?>
Data Units Written data_units_written) . " (" . data_unit($health->data_units_written) . ")" ?>
Original Output
smartctl->output) ?>