HP Proliant SmartArray nagios check

Søren Klintrup soren at klintrup.dk
Wed Feb 14 00:29:22 UTC 2007


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 at 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


More information about the freebsd-proliant mailing list