Monitoring geom

Frederique Rijsdijk frederique at
Thu Mar 5 22:37:22 PST 2009

Mister Olli wrote:
> Hi hi...
> What is the best way to monitor geom software raids (gmirror & gvinum
> raid5)???
> The solution I'm searching for should be a kind of script which checks
> the status, and drops me an email if something is wrong.
> I found a nagios plugin, but currently I'm unable to invest enough time
> to get nagios up and running for the customer...
> Thanks a lot...
> greetz
> Olli
> _______________________________________________
> freebsd-questions at mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at"

I monitor some machines with geom mirrors via Nagios/SNMP.

In nagios:
define service{
    use                             generic-service
    service_description             gmirror
    check_command                   check_snmp!1!0!UCD-SNMP-MIB::extOutput.1

On the machine in snmpd.conf (net-snmp):
exec gmirror /usr/local/sbin/checkgmirror

The script:

mirrorstate=`/sbin/gmirror list | /usr/bin/grep ^State |\
	/usr/bin/awk '{print $2}'`

if [ $mirrorstate != "COMPLETE" ]
     echo "1"
     echo "0"

Besides crafthing something of your own, there is also: 

This is a small Nagios plugin written in PERL and designed to monitor
the state of FreeBSD GEOM devices (specifically mirrors and striped
volumes) from Nagios.


To use in Nagios:

In checkcommands.cfg:
define command{
         command_name    check_geom
         command_line    $USER1$/check_geom $ARG1$ $ARG2$

In your host.cfg:
define service{
         use                             local-service
         service_description             mirror
         check_command                   check_geom!mirror!gm0

More information about the freebsd-questions mailing list