EMMC on 2440 - Smart Status UNKNOWN in widget
-
I installed an mSATA SSD in my 2440 and installed pfsense225 on it. When I added the "SMART Status" dashboard widget, it looks like this
The da0 device is the internal 4gb eMMC disk. When I looked at the widget code, it looks like it runs smartctl -H /dev/da0 which doesn't work on this device. It needs to be smartctl -d scsi -H /dev/da0
e.g. when you run smartctl -H /dev/da0 you get
/dev/da0: Unknown USB bridge [0x0424:0x2240 (0x198)] Please specify device type with the -d option.
but If I add "-d scsi" it works
smartctl -d scsi -H /dev/da0 === START OF READ SMART DATA SECTION === SMART Health Status: OK
Is there any way to make the widget run the proper commands for the "scsi" device to show its proper status? or just ignore it?
-
This patch will let you hide it from the widget:
--- --- a/usr/local/www/widgets/widgets/smart_status.widget.php +++ b/usr/local/www/widgets/widgets/smart_status.widget.php @@ -32,7 +32,21 @@ require_once("pfsense-utils.inc"); require_once("functions.inc"); require_once("/usr/local/www/widgets/include/smart_status.inc"); + +if (isset($_POST['smartstatusfilter'])) { + $config['widgets']['smartstatusfilter'] = htmlspecialchars($_POST['smartstatusfilter'], ENT_QUOTES | ENT_HTML401); + write_config("Saved SMART Status Filter via Dashboard"); + header("Location: ../../index.php"); +} ?> + + + <form action="/widgets/widgets/smart_status.widget.php" method="post" name="iformd"> + Comma separated list of drives to NOT display in the widget + + + </form> + @@ -42,35 +56,50 @@ -$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 */ $devs = get_smart_drive_list(); +/* Get list of drives to hide from the widget */ +$skipdrives = array(); +$skipdrives = explode(",", $config['widgets']['smartstatusfilter']); -if(count($devs) > 0) { - foreach($devs as $dev) { ## for each found drive do - $dev_ident = exec("diskinfo -v /dev/$dev | grep ident | awk '{print $1}'"); ## get identifier from drive - $dev_state = trim(exec("smartctl -H /dev/$dev | awk -F: '/^SMART overall-health self-assessment test result/ {print $2;exit} -/^SMART Health Status/ {print $2;exit}'")); ## get SMART state from drive - switch ($dev_state) { - case "PASSED": - case "OK": - $color = "#90EE90"; - break; - case "": - $dev_state = "Unknown"; - $color = "#C0B788"; - break; - default: - $color = "#F08080"; - break; - } +if (count($devs) > 0) { + // For each found drive ... + foreach($devs as $dev) { + // unless configured to be hidden ... + if ((!in_array($dev, $skipdrives))) { + $dev_ident = exec("diskinfo -v /dev/$dev | grep ident | awk '{print $1}'"); // get identifier from drive + $dev_state = trim(exec("smartctl -H /dev/$dev | awk -F: '/^SMART overall-health self-assessment test result/ {print $2;exit} +/^SMART Health Status/ {print $2;exit}'")); // get SMART state from drive + switch ($dev_state) { + case "PASSED": + case "OK": + $color = "#90EE90"; + break; + case "": + $dev_state = "Unknown"; + $color = "#C0B788"; + break; + default: + $color = "#F08080"; + break; + } ?> - - - - - -+ + + + + ++ } } ?> | | | | | | | | + + +
(No, I don't have any patch to add -d scsi.)
-
Doktor - thank you, nice patch! Looks just like the Services Status widget which has a similar filter. Are you able to merge that code with the mainline? (I'm old - when I manually patch things I always forget about it and wind up breaking things during upgrades etc.)
-
Are you able to merge that code with the mainline?
You can use this URL with System Patches package for 2.2.x:
https://github.com/doktornotor/pfsense/commit/119d9703ba232ecf97d9e58c742ceee9e376c57d.patch
(There's PR 1841 for 2.2.x, never been merged. I don't have a patch for 2.3 snapshots yet.)
-
Awesome! thanks again, works a treat