Bug 173614 - [patch] /etc/periodic/daily/404.status.zfs wrong
Summary: [patch] /etc/periodic/daily/404.status.zfs wrong
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-13 21:00 UTC by peter håkanson
Modified: 2018-05-20 23:53 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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

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
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:
  daily_show_success="NO"
  daily_show_info="NO"
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

Do
- Set Status to "Open"