Revision ea20169a
Added by Jim Pingle over 10 years ago
etc/inc/util.inc | ||
---|---|---|
2075 | 2075 |
print "</body></html>\n"; |
2076 | 2076 |
} |
2077 | 2077 |
|
2078 |
/* Locate disks that can be queried for S.M.A.R.T. data. */ |
|
2079 |
function get_smart_drive_list() { |
|
2080 |
$disk_list = explode(" ", get_single_sysctl("kern.disks")); |
|
2081 |
foreach ($disk_list as $id => $disk) { |
|
2082 |
// We only want certain kinds of disks for S.M.A.R.T. |
|
2083 |
if (preg_match("/^(ad|da|ada).*[0-9]{1,2}$/", $disk) === FALSE) { |
|
2084 |
unset($disk_list[$id]); |
|
2085 |
} |
|
2086 |
} |
|
2087 |
sort($disk_list); |
|
2088 |
return $disk_list; |
|
2089 |
} |
|
2090 |
|
|
2078 | 2091 |
?> |
usr/local/www/diag_smart.php | ||
---|---|---|
276 | 276 |
// Default page, prints the forms to view info, test, etc... |
277 | 277 |
default: |
278 | 278 |
{ |
279 |
// Get all AD* and DA* (IDE and SCSI) devices currently installed and stores them in the $devs array |
|
280 |
exec("ls /dev | grep '^\(ad\|da\|ada\)[0-9]\{1,2\}$'", $devs); |
|
279 |
$devs = get_smart_drive_list(); |
|
281 | 280 |
?> |
282 | 281 |
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="default page"> |
283 | 282 |
<tr> |
usr/local/www/widgets/widgets/smart_status.widget.php | ||
---|---|---|
42 | 42 |
<?php |
43 | 43 |
$devs = array(); |
44 | 44 |
## Get all adX, daX, and adaX (IDE, SCSI, and AHCI) devices currently installed |
45 |
exec("ls /dev | grep '^\(ad\|da\|ada\)[0-9]\{1,2\}$'", $devs); ## From SMART status page
|
|
45 |
$devs = get_smart_drive_list();
|
|
46 | 46 |
|
47 | 47 |
if(count($devs) > 0) { |
48 | 48 |
foreach($devs as $dev) { ## for each found drive do |
Also available in: Unified diff
Use a better method of finding disks for SMART.
Old code was inaccurate and also listed entries that were symlinks to other disks