Monitoring geom

Frederique Rijsdijk frederique at isafeelin.org
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 freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"


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

In nagios:
--------------------------------------------------------------
define service{
    use                             generic-service
    host_name                       host.name.com
    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:
--------------------------------------------------------------
#!/bin/sh

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

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


Besides crafthing something of your own, there is also: 
/usr/ports/net-mgmt/nagios-geom

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.

WWW: http://www.geocities.com/ntb4real/proj/geom.htm


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
         host_name                       host.name.conf
         service_description             mirror
         check_command                   check_geom!mirror!gm0
         }




More information about the freebsd-questions mailing list