From 9960bd718b5fd854cd9c54d40fee99526ce79cdc Mon Sep 17 00:00:00 2001 From: Garrett Wollman Date: Fri, 13 Jan 2006 18:07:52 +0000 Subject: [PATCH] Add a daily script to show the status of gmirror(8) devices. --- etc/defaults/periodic.conf | 3 +++ etc/periodic/daily/406.status-gmirror | 34 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 etc/periodic/daily/406.status-gmirror diff --git a/etc/defaults/periodic.conf b/etc/defaults/periodic.conf index fd0cd1a3959e..c83986448906 100644 --- a/etc/defaults/periodic.conf +++ b/etc/defaults/periodic.conf @@ -91,6 +91,9 @@ daily_status_disks_df_flags="-k -t nonfs" # df(1) flags for check # 405.status-ata_raid daily_status_ata_raid_enable="NO" # Check ATA raid status +# 406.status-gmirror +daily_status_gmirror_enable="NO" # Check gmirror(8) + # 420.status-network daily_status_network_enable="YES" # Check network status daily_status_network_usedns="YES" # DNS lookups are ok diff --git a/etc/periodic/daily/406.status-gmirror b/etc/periodic/daily/406.status-gmirror new file mode 100644 index 000000000000..8fc698c804d2 --- /dev/null +++ b/etc/periodic/daily/406.status-gmirror @@ -0,0 +1,34 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# If there is a global system configuration file, suck it in. +# +if [ -r /etc/defaults/periodic.conf ] +then + . /etc/defaults/periodic.conf + source_periodic_confs +fi + +case "$daily_status_gmirror_enable" in + [Yy][Ee][Ss]) + echo + echo 'Checking status of gmirror(8) devices:' + + if gmirror status; then + components="$(gmirror status -s | fgrep -v COMPLETE)" + if [ "${components}" ]; then + rc=3 + else + rc=0 + fi + else + rc=2 + fi + ;; + + *) rc=0;; +esac + +exit $rc