Bug 173614

Summary: [patch] /etc/periodic/daily/404.status.zfs wrong
Product: Base System Reporter: peter håkanson <peter>
Component: confAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me CC: asomers, wout
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description peter håkanson 2012-11-13 21:00:00 UTC
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


# $FreeBSD: src/etc/periodic/daily/404.status-zfs,v 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 ]
    . /etc/defaults/periodic.conf

case "$daily_status_zfs_enable" in
        echo 'Checking status of zfs pools:'

        out=`zpool status -x`
        echo "$out"
        # assume fail
        # 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
        if ( echo $out | grep -q "all pools are healthy" ) ; then 

exit $rc
How-To-Repeat: use it on a machine with zfs
Comment 1 wout 2016-12-18 17:05:56 UTC
11-RELEASE version of 404.status-zfs returns `2` when a problem with ZFS is detected. I think this should return `3` like 406.status-gmirror and 401.status-graid do.

This will make sure the output is sent when using:
Comment 2 Alan Somers freebsd_committer 2017-04-06 20:37:00 UTC
Are you sure?  It looks to me like it will return rc=1 for a damaged pool.
Comment 3 wout 2017-04-06 21:47:00 UTC
My comment above has a mistake: 404.status-zfs in 11-RELEASE does indeed return rc=1 (instead of rc=2) when a damaged (or no) pool is detected.

However, people who now set daily_show_success=NO and daily_show_info=NO will not get any notification for broken pools.

Other status periodic scripts, as 406.status-gmirror and 401.status-graid return rc=3 in this case, so the information is not masked in the periodic output.
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:53:15 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

- Set Status to "Open"