From owner-freebsd-scsi@FreeBSD.ORG Wed May 18 08:11:03 2005 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BBEE116A4CE for ; Wed, 18 May 2005 08:11:03 +0000 (GMT) Received: from mail23.sea5.speakeasy.net (mail23.sea5.speakeasy.net [69.17.117.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4E17843DC6 for ; Wed, 18 May 2005 08:11:03 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: (qmail 3209 invoked from network); 18 May 2005 08:11:03 -0000 Received: from gate.funkthat.com (HELO hydrogen.funkthat.com) ([69.17.45.168]) (envelope-sender ) by mail23.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 18 May 2005 08:11:02 -0000 Received: from hydrogen.funkthat.com (elopip@localhost.funkthat.com [127.0.0.1])j4I8B2gK069554 for ; Wed, 18 May 2005 01:11:02 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.12.10/8.12.10/Submit) id j4I8B29T069553 for freebsd-scsi@FreeBSD.org; Wed, 18 May 2005 01:11:02 -0700 (PDT) Date: Wed, 18 May 2005 01:11:01 -0700 From: John-Mark Gurney To: freebsd-scsi@FreeBSD.org Message-ID: <20050518081101.GB6063@funkthat.com> Mail-Followup-To: John-Mark Gurney , freebsd-scsi@FreeBSD.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="IJpNTDwzlM2Ie8A6" Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.2-RELEASE i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html Subject: daily scsi defect status... X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: John-Mark Gurney List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2005 08:11:03 -0000 --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I thought someone a while back had added scsi defect monitoring to our periodic config, but upon upgrading one of my boxes, I found out that no one had... I no longer have any scsi disks, but could someone try out the attached daily script? Of course, you'll want to add the following lines to your /etc/periodic.conf: daily_status_scsi_disks_enable="YES" In the normal case, you should just see: SCSI Disk defect status: da0: da1: and the files for these defects are in /var/backups if you want to see the exact defects on your disks... If the code works fine, I'll cordinate with the correct people to commit it. Thanks for testting it out. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="401.status-scsi-disks" #!/bin/sh # # $FreeBSD: src/etc/periodic/daily/400.status-disks,v 1.6 2002/02/13 19:10:07 brian Exp $ # # 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 disk_unit_list() { camcontrol devlist | awk ' /da/ { if (match($0, "(da|sd)[[:digit:]]+") != 0) { diskname = substr($0, RSTART, RLENGTH) match(diskname, "[[:digit:]]+") print substr(diskname, RSTART, RLENGTH) } }' | sort -u } case "$daily_status_scsi_disks_enable" in [Yy][Ee][Ss]) echo "" echo "SCSI Disk defect status:" bak=/var/backups rc=0 for i in `disk_unit_list()`; do old=${bak}/da${i}.glist.bak cur=${bak}/da${i}.glist if [ -f "$cur" ]; then mv "$cur" "$old" fi echo -n "da${i}: " camcontrol defects da$i -f phys -G 2>&1 > "$cur" || rc=1 if [ -f "$old" ]; then if ! cmp -s "$cur" "$old"; then diff "$old" "$cur" || rc=2 fi fi done *) rc=0;; esac exit $rc --IJpNTDwzlM2Ie8A6--