Use a better method of finding disks for SMART.
Old code was inaccurate and also listed entries that were symlinks to other disks
This commit is contained in:
parent
0810a719e9
commit
ea20169a38
|
@ -2075,4 +2075,17 @@ function post_redirect($page, $params) {
|
||||||
print "</body></html>\n";
|
print "</body></html>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Locate disks that can be queried for S.M.A.R.T. data. */
|
||||||
|
function get_smart_drive_list() {
|
||||||
|
$disk_list = explode(" ", get_single_sysctl("kern.disks"));
|
||||||
|
foreach ($disk_list as $id => $disk) {
|
||||||
|
// We only want certain kinds of disks for S.M.A.R.T.
|
||||||
|
if (preg_match("/^(ad|da|ada).*[0-9]{1,2}$/", $disk) === FALSE) {
|
||||||
|
unset($disk_list[$id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sort($disk_list);
|
||||||
|
return $disk_list;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -276,8 +276,7 @@ switch($action) {
|
||||||
// Default page, prints the forms to view info, test, etc...
|
// Default page, prints the forms to view info, test, etc...
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
// Get all AD* and DA* (IDE and SCSI) devices currently installed and stores them in the $devs array
|
$devs = get_smart_drive_list();
|
||||||
exec("ls /dev | grep '^\(ad\|da\|ada\)[0-9]\{1,2\}$'", $devs);
|
|
||||||
?>
|
?>
|
||||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="default page">
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="default page">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -42,7 +42,7 @@ require_once("/usr/local/www/widgets/include/smart_status.inc");
|
||||||
<?php
|
<?php
|
||||||
$devs = array();
|
$devs = array();
|
||||||
## Get all adX, daX, and adaX (IDE, SCSI, and AHCI) devices currently installed
|
## Get all adX, daX, and adaX (IDE, SCSI, and AHCI) devices currently installed
|
||||||
exec("ls /dev | grep '^\(ad\|da\|ada\)[0-9]\{1,2\}$'", $devs); ## From SMART status page
|
$devs = get_smart_drive_list();
|
||||||
|
|
||||||
if(count($devs) > 0) {
|
if(count($devs) > 0) {
|
||||||
foreach($devs as $dev) { ## for each found drive do
|
foreach($devs as $dev) { ## for each found drive do
|
||||||
|
|
Reference in New Issue