This is an old revision of the document!


monitor gmirror from NRPE / cron for FreeBSD

I wrote this little check-script for nrpe/nagios to get the status of various gmirror volumes in a box, and output the failed volumes if any such exist.

Syntax

$path/check_gmirror.sh [email] [email]

If no arguments are specified, the script will assume its run for NRPE. If one or more email addresses are specified, the script will send an email in case an array reports an error.

Output

gm3: DEGRADED / gm0: rebuilding / gm2: ok / gm1: ok

Failed/rebuilding volumes will always be first in the output string, to help diagnose the problem when recieving the output via pager/sms.

Output Examples

output description
ok The device is reported as ok by the smart array controller
DEGRADED The RAID volume is degraded, it's still working but without the safety of RAID, and in some cases with severe performance loss.
rebuilding The RAID is rebuilding, will return to OK when done
starting The geom device is currently starting, you shouldn't see this and will return an unknown code to nagios
unknown state

include the following output. gmirror status, gmirror list |

Compability

The script should work on any FreeBSD platform until gmirror changes input/output syntax, I have tested the script on the following platforms

  • FreeBSD 6.2
  • FreeBSD 6.3
  • FreeBSD 7.0(amd64)
  • FreeBSD 8.0(amd64)

Download

Latest version

Latest version 1.1

check_gmirror.sh

Old version

Changelog

1.1

     o Can now email an address of choice, just use email address(es) as arguments to shellscript
     o check if gmirror command exists on system before running script

1.0.1

     o small fixes to comments
       thanks to jmp for noticing

1.0

     o Initial public release
       Based on my check_gmirror.sh script.
       NOTE: This was made on request from a friend, has not been thorougly tested, your mileage may vary.