monitors:gmirror

Error loading plugin struct
ParseError: syntax error, unexpected 'fn' (T_STRING), expecting :: (T_PAAMAYIM_NEKUDOTAYIM)
More info is available in the error log.
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


monitors:gmirror [2011/08/12 04:33] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== FreeBSD gmirror (geom based RAID-1) monitor ======
 +
 +^ Author | [[ Brian.Scott@tafensw.edu.au | Brian Scott ]] |
 +^ Compatibility | Xymon 4.3 |
 +^ Requirements | FreeBSD, Bourne Shell (sh) |
 +^ Download | None |
 +^ Last Update | 2011-08-12 |
 +
 +===== Description =====
 +
 +Simple shell script to monitor FreeBSD geom based mirroring.
 +
 +Status is red for degraded (missing a component) and yellow when recovering.
 +
 +===== Installation =====
 +Pretty much standard fare:
 +<code>
 +[gmirror]
 +    ENVFILE /home/hobbit/server/etc/xymonserver.cfg
 +    NEEDS xymond
 +    CMD  $XYMONHOME/ext/gmirror.sh
 +    LOGFILE $XYMONSERVERLOGS/gmirror.log
 +    INTERVAL 5m
 +</code>
 +
 +Or the equivalent on the client side.
 +===== Source =====
 +==== gmirror.sh ====
 +
 +<hidden onHidden="Show Code ⇲" onVisible="Hide Code ⇱">
 +<code>
 +#!/bin/sh
 +
 +COLUMN=gmirror
 +
 +HOSTNAME="`hostname`"
 +COLOUR=green
 +
 +# % gmirror status
 +#       Name    Status  Components
 +#mirror/root  COMPLETE  ad8p2 (ACTIVE)
 +# ad10p2 (ACTIVE)
 +# mirror/var  COMPLETE  ad8p4 (ACTIVE)
 +# ad10p4 (ACTIVE)
 +# mirror/usr  COMPLETE  ad8p6 (ACTIVE)
 +# ad10p6 (ACTIVE)
 +#mirror/home  COMPLETE  ad8p7 (ACTIVE)
 +# ad10p7 (ACTIVE)
 +
 +# STARTING, COMPLETE, DEGRADED -> yellow, green, red
 +/usr/bin/time -p gmirror status >$XYMONTMP/$COLUMN.out 2>&1
 +rc=$?
 +SECONDS=`egrep "^real" $XYMONTMP/${COLUMN}.out | awk '{printf $2}'`
 +
 +if [ $rc -ne 0 ]; then
 + COLOUR=red
 + MSG="gmirror query failed
 +
 +`cat $XYMONTMP/${COLUMN}.out|grep -v '^\(real\|user\|sys\)'`
 +
 +Seconds: ${SECONDS}
 +"
 +else
 + grep ' DEGRADED ' $XYMONTMP/$COLUMN.out >/dev/null
 + if [ $? -eq 0 ]; then
 + COLOUR=red
 + else
 + grep ' STARTING ' $XYMONTMP/$COLUMN.out >/dev/null
 + if [ $? -eq 0 ]; then
 + COLOUR=yellow
 + fi
 + fi
 + MSG="gmirror query succeeded
 +
 +`cat $XYMONTMP/${COLUMN}.out|grep -v '^\(real\|user\|sys\)'`
 +
 +Seconds: ${SECONDS}
 +"
 +fi
 +$XYMON $XYMSRV "status $HOSTNAME.$COLUMN $COLOUR `date`
 +
 +$MSG"
 +$RM $XYMONTMP/${COLUMN}.out
 +
 +exit 0
 +</code>
 +</hidden>
 +
 +===== Known  Bugs and Issues =====
 +
 +===== To Do =====
 +
 +Nice features like green/red/yellow dots against individual mirrors.
 +
 +Ability to exclude mirrors that we don't care about.
 +
 +===== Credits =====
 +As with all of these things, the code started out by kicking around other people's code.
 +===== Changelog =====
 +
 +  * **2011-08-12**
 +    * Initial release
  
  • monitors/gmirror.txt
  • Last modified: 2011/08/12 04:33
  • by 127.0.0.1