From owner-freebsd-proliant@FreeBSD.ORG Wed Feb 14 00:29:22 2007 Return-Path: X-Original-To: freebsd-proliant@freebsd.org Delivered-To: freebsd-proliant@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4F6F416A400 for ; Wed, 14 Feb 2007 00:29:22 +0000 (UTC) (envelope-from soren@klintrup.dk) Received: from mail01.hemligt.net (mail01.hemligt.net [87.48.247.181]) by mx1.freebsd.org (Postfix) with ESMTP id EFAEE13C428 for ; Wed, 14 Feb 2007 00:29:21 +0000 (UTC) (envelope-from soren@klintrup.dk) Received: from localhost (unknown [172.21.203.81]) by mail01.hemligt.net (Postfix) with ESMTP id CA677508E6; Wed, 14 Feb 2007 01:17:05 +0100 (CET) X-Virus-Scanned: amavisd-new at hemligt.net Received: from mail01.hemligt.net ([172.21.203.81]) by localhost (mail01.hemligt.net [172.21.203.81]) (amavisd-new, port 10024) with ESMTP id 8ttIRU9HcutX; Wed, 14 Feb 2007 01:17:01 +0100 (CET) Received: from [172.21.203.26] (unknown [172.21.203.26]) by mail01.hemligt.net (Postfix) with ESMTP id 98FB9508E0; Wed, 14 Feb 2007 01:17:01 +0100 (CET) Message-ID: <45D25504.6020500@klintrup.dk> Date: Wed, 14 Feb 2007 01:17:08 +0100 From: =?ISO-8859-1?Q?S=F8ren_Klintrup?= User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: freebsd-proliant@freebsd.org References: <45D1B2B1.3070703@klintrup.dk> <20070213213959.GL90772@k7.mavetju> In-Reply-To: <20070213213959.GL90772@k7.mavetju> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: Subject: Re: HP Proliant SmartArray nagios check X-BeenThere: freebsd-proliant@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Technical discussion of FreeBSD on HP ProLiant server platforms." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2007 00:29:22 -0000 Edwin Groothuis wrote: > On Tue, Feb 13, 2007 at 01:44:33PM +0100, S?ren Klintrup wrote: > >> More information at http://www.klintrup.dk/soren/proliant/ >> > > To overcome the problem of many of [Tt][Hh][Ee][Ss][Ee] kind of > string, you can pipe the output through tr(1) so that it at least > is human-readable (instead of the minimal requirement of being a > cyborg :-) > > [~] edwin@k7>echo "TtHhEeSsEe" | tr A-Z a-z > tthheessee > > Also, the case statement doesn't have a catch for the case that the > variable is "" or not one of the five expected strings. > > And as the last one, if you use 's/foo/bar/i', it be case insensitive > too so the sed statement is easier to write/read/check for humans. Hi, Thanks for the hint on tr(1), script is updated and easier to read, I originally used grep -o to get the parts of the line I wanted, but this isn't available for FreeBSD 4.x, and for backwards compability's sake, I changed it to the sed line you see, it was kind of a nasty change, but not being FreeBSD 4 compliant, when it was such a small change just didn't make sense. As for the case statement, with the way the sed line works, the case where it doesn't hit one of the cases specified won't happen (unless someone purposly edits the script and breaks it), the sed line takes out the parts of the line needed (rea, int, rec, fai and ok) - and nothing else, so in case a volume has another state than this. This in itself does add another problem, if the volume is in an unknown state, and another volume is ok, it'll report everything as ok, and just ignore that volume. I've fixed this in version 1.4, so it'll return with errorlevel 3 and ouput the volume as being in "unknown state", thanks for bringing this to my attention :) As for using 'i' as an option on sed, it doesn't seem to work on FreeBSD 6.2 (havn't tested on others, since theres no reason if it doesn't work on 6.2 :), the tr A-Z a-z worked like a charm though, and it's readable again. $ echo fOo|sed -e 's/foo/bar/i' sed: 1: "s/foo/bar/i ": bad flag in substitute command: 'i' Regards, Søren Klintrup