From nobody@FreeBSD.org  Tue Nov 13 20:57:30 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id B4D50A64
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 13 Nov 2012 20:57:30 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 9D7FD8FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 13 Nov 2012 20:57:30 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id qADKvTvq015157
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 13 Nov 2012 20:57:29 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id qADKvTo6015156;
	Tue, 13 Nov 2012 20:57:29 GMT
	(envelope-from nobody)
Message-Id: <201211132057.qADKvTo6015156@red.freebsd.org>
Date: Tue, 13 Nov 2012 20:57:29 GMT
From: peter hkanson <peter@ipsec.se>
To: freebsd-gnats-submit@FreeBSD.org
Subject: /etc/periodic/daily/404.status.zfs wrong
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         173614
>Category:       conf
>Synopsis:       [patch] /etc/periodic/daily/404.status.zfs wrong
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 13 21:00:00 UTC 2012
>Closed-Date:    
>Last-Modified:  Tue Nov 13 21:04:47 UTC 2012
>Originator:     peter hkanson
>Release:        8.2 amd64
>Organization:
ipsec sverige
>Environment:
FreeBSD bore.hk.ipsec.se 8.1-RELEASE-p5 FreeBSD 8.1-RELEASE-p5 #0: Tue Sep 27 16:18:26 UTC 2011     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
And others !
>Description:
The 404.status.zfs does not report a broken vdev.

Attatched is a modified 404.status.zfs that work both on a broken vdev and a correct one
>How-To-Repeat:
use it on a machine with zfs 
>Fix:
#!/bin/sh
#
# $FreeBSD: src/etc/periodic/daily/404.status-zfs,v 1.1.10.1.6.1 2010/12/21 17:09:25 kensmith Exp $
# made working by peter h IPSec 2012
#

# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/periodic.conf ]
then
    . /etc/defaults/periodic.conf
    source_periodic_confs
fi

case "$daily_status_zfs_enable" in
    [Yy][Ee][Ss])
        echo
        echo 'Checking status of zfs pools:'

        out=`zpool status -x`
        echo "$out"
        # assume fail
        rc=1
        # zpool status -x always exits with 0, so we have to interpret its
        # output to see what's going on.
        if  ( echo $out | grep -q "state: DEGRADED"  ) ; then
                rc=1
        fi
        if ( echo $out | grep -q "all pools are healthy" ) ; then 
                rc=0
        fi
        ;;

    *)
        rc=0
        ;;
esac
exit $rc




>Release-Note:
>Audit-Trail:
>Unformatted:
