From romain@blogreen.org  Mon Jul  4 07:45:49 2011
Return-Path: <romain@blogreen.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5587F1065670
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  4 Jul 2011 07:45:49 +0000 (UTC)
	(envelope-from romain@blogreen.org)
Received: from marvin.blogreen.org (smortex-1-pt.tunnel.tserv11.ams1.ipv6.he.net [IPv6:2001:470:1f14:7c2::2])
	by mx1.freebsd.org (Postfix) with ESMTP id EFFB88FC14
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  4 Jul 2011 07:45:48 +0000 (UTC)
Received: by marvin.blogreen.org (Postfix, from userid 1001)
	id CEEDF1BF79; Mon,  4 Jul 2011 09:45:47 +0200 (CEST)
Message-Id: <20110704074547.CEEDF1BF79@marvin.blogreen.org>
Date: Mon,  4 Jul 2011 09:45:47 +0200 (CEST)
From: Romain Tartiere <romain@FreeBSD.org>
Reply-To: Romain Tartiere <romain@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: sysutils/smartmontools daily script improvement
X-Send-Pr-Version: 3.113
X-GNATS-Notify: samm@os2.kiev.ua

>Number:         158630
>Category:       ports
>Synopsis:       sysutils/smartmontools daily script improvement
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    romain
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 04 07:50:04 UTC 2011
>Closed-Date:    Mon Jul 04 09:10:15 UTC 2011
>Last-Modified:  Mon Jul 04 09:10:15 UTC 2011
>Originator:     Romain Tartiere
>Release:        FreeBSD 8.2-STABLE amd64
>Organization:
>Environment:
System: FreeBSD marvin.blogreen.org 8.2-STABLE FreeBSD 8.2-STABLE #7 r222417: Sat May 28 13:23:35 CEST 2011 root@marvin.blogreen.org:/usr/obj/usr/src/sys/MARVIN amd64


	
>Description:

smartmontool port can install a daily script for checking disks.  When a
disk is failing, a full report is included in the generated mail, otherwise a
'OK' message is output instead.

When a disk has been failing in the past but the situation is back to
normal, the script still outputs a verbose report, requiring more attention to
see that it is not a new problem.

>How-To-Repeat:

Enable smart status in /etc/periodic.conf:

  daily_status_smart_enable="YES"
  daily_status_smart_devices="ad4 ad6 ad10 ad12"

ad4 has failed in the past because of a cooling problem.  The daily mail
include:

---------------------------------------8<-------------------------------------
Checking health of /dev/ad4: === START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.10
Device Model:     ST3320620AS
[...12 lines...]
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
See vendor-specific Attribute list for marginal Attributes.
[...41 lines...]
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   057   044   045    Old_age   Always   In_the_past 43 (Min/Max 36/50)
194 Temperature_Celsius     0x0022   043   056   000    Old_age   Always       -       43 (0 22 0 0)
[...23 lines...]
Checking health of /dev/ad6: OK
Checking health of /dev/ad10: OK
Checking health of /dev/ad12: OK
---------------------------------------8<-------------------------------------

>Fix:

smartctl sets bit 5 (counting from 0) of the return value to 1 for such cases.

---------------------------------------8<-------------------------------------
       Bit 5: SMART status check returned "DISK OK" but  we  found  that  some
              (usage  or  prefail)  Attributes  have been <= threshold at some
              time in the past.
---------------------------------------8<-------------------------------------

This can be used to produce clever output:

--- smart.diff begins here ---
--- files/smart.in	2011-07-04 09:28:22.164557351 +0200
+++ /tmp/smart.in	2011-07-04 09:29:24.213204043 +0200
@@ -63,6 +63,8 @@
 				status=$?
 				if [ ${status} -eq 0 ]; then
 					echo "OK"
+				elif [ ${status} -eq 32 ]; then
+					echo "OK (but has failed in the past)"
 				elif [ $((status & 3)) -ne 0 ]; then
 					rc=2
 					${trim_junk} "${tmpfile}"
--- smart.diff ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->romain 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Mon Jul 4 07:50:14 UTC 2011 
Responsible-Changed-Why:  
Submitter has GNATS access (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158630 
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Mon Jul 4 07:50:17 UTC 2011 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158630 

From: Edwin Groothuis <edwin@FreeBSD.org>
To: samm@os2.kiev.ua
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/158630: sysutils/smartmontools daily script improvement
Date: Mon, 4 Jul 2011 07:50:16 UT

 Maintainer of sysutils/smartmontools,
 
 Please note that PR ports/158630 has just been submitted.
 
 If it contains a patch for an upgrade, an enhancement or a bug fix
 you agree on, reply to this email stating that you approve the patch
 and a committer will take care of it.
 
 The full text of the PR can be found at:
     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/158630
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org

From: Alex Samorukov <samm@os2.kiev.ua>
To: bug-followup@FreeBSD.org, romain@FreeBSD.org
Cc:  
Subject: Re: ports/158630: sysutils/smartmontools daily script improvement
Date: Mon, 04 Jul 2011 10:50:38 +0200

 Looks fine, thank you.
 Please commit.

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/158630: commit references a PR
Date: Mon,  4 Jul 2011 09:09:53 +0000 (UTC)

 romain      2011-07-04 09:09:39 UTC
 
   FreeBSD ports repository
 
   Modified files:
     sysutils/smartmontools Makefile 
     sysutils/smartmontools/files smart.in 
   Log:
   Improve periodic script to display a short report when a disk attribute failed
   in the past but is now back to normal.
   
   PR:             ports/158630
   Submitted by:   romain
   Approved by:    Alex Samorukov <samm@os2.kiev.ua> (maintainer)
   
   Revision  Changes    Path
   1.51      +1 -0      ports/sysutils/smartmontools/Makefile
   1.10      +3 -1      ports/sysutils/smartmontools/files/smart.in
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: feedback->closed 
State-Changed-By: romain 
State-Changed-When: Mon Jul 4 09:10:14 UTC 2011 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158630 
>Unformatted:
