Re: Notification for GMirror failures

2018-05-09 Thread Andrea Venturoli

On 05/09/18 01:51, Jack L. wrote:

I use crontab @daily (/sbin/gmirror status | grep -q COMPLETE) || mail
-s "gmirror failure" email addy


Or you could simply add the following to /etc/periodic.conf[.local]:

daily_status_gmirror_enable="YES"

 bye
av.
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Notification for GMirror failures

2018-05-08 Thread Jack L.
I use crontab @daily (/sbin/gmirror status | grep -q COMPLETE) || mail
-s "gmirror failure" email addy

On Tue, May 8, 2018 at 4:41 PM, Vincent Hoffman-Kazlauskas
 wrote:
>
>
> On 08/05/2018 08:28, Andrea Brancatelli wrote:
>> Hi,
>>
>> out of curiosity, does any kind of GMirror-failure notification tools
>> exist?
>>
>> Either native... SNMP... external ports... whatever?
>>
> If you use nagios (or compatible) net-mgmt/nagios-geom in ports works
>
> root@banshee # /usr/local/libexec/nagios/check_geom mirror gm0
> OK mirror/gm0 COMPLETE { ada0s1 (ACTIVE) , ada1s1 (ACTIVE)
> }|geom_mirror=2;;;0;
> ($00:41:05 $) 0
>
>
> Vince
> ___
> freebsd-stable@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Notification for GMirror failures

2018-05-08 Thread Vincent Hoffman-Kazlauskas


On 08/05/2018 08:28, Andrea Brancatelli wrote:
> Hi, 
> 
> out of curiosity, does any kind of GMirror-failure notification tools
> exist? 
> 
> Either native... SNMP... external ports... whatever?
> 
If you use nagios (or compatible) net-mgmt/nagios-geom in ports works

root@banshee # /usr/local/libexec/nagios/check_geom mirror gm0
OK mirror/gm0 COMPLETE { ada0s1 (ACTIVE) , ada1s1 (ACTIVE)
}|geom_mirror=2;;;0;
($00:41:05 $) 0


Vince
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Notification for gmirror failures

2018-05-08 Thread Miroslav Lachman

Andrea Brancatelli wrote on 2018/05/08 09:28:

Hi,

out of curiosity, does any kind of GMirror-failure notification tools
exist?

Either native... SNMP... external ports... whatever?


I don't know any daemon like solution so I wrote some simple shell 
script. Its used on all our machines. It should be run be cron in some 
sane interval (like each 5 or 10 minutes)


#!/bin/sh

## $Id: check_gmirror.sh 8c1f418ba7f5 2017-06-15 12:36 +0200 lachman $

export PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"

mailto="y...@example.com"
subject_pref="$(hostname) gmirror"
notify_state="/var/run/${0##*/}.notified"

cmd_out=$(gmirror status -s)

components="$(echo "$cmd_out" | grep -F -v COMPLETE)"

if [ -n "$components" ]; then
if [ ! -f "$notify_state" ]; then
subject="$subject_pref FAILED - $(date '+%Y-%m-%d %H:%M:%S')"
echo "$cmd_out" | sed -E 's/(SYNCHRONIZING,) [0-9]+%/\1 x%/' > 
"$notify_state"

echo "$cmd_out" | mail -s "$subject" "$mailto"
echo "$subject" | logger
else
subject="$subject_pref FAILED - $(date '+%Y-%m-%d %H:%M:%S')"
echo "$cmd_out" | sed -E 's/(SYNCHRONIZING,) [0-9]+%/\1 x%/' > 
"$notify_state.now"
diff -u -b -B "$notify_state" "$notify_state.now" > 
"$notify_state.diff"


if [ -s "$notify_state.diff" ]; then## if diff is not empty
cat "$notify_state.diff" | mail -s "$subject" "$mailto"
echo "$subject additional failure occurred" | logger
cp "$notify_state.now" "$notify_state"
fi
rm "$notify_state.now" "$notify_state.diff"
fi
else
if [ -f "$notify_state" ]; then
rm "$notify_state"
subject="$subject_pref now OK - $(date '+%Y-%m-%d %H:%M:%S')"
echo "$cmd_out" | mail -s "$subject" "$mailto"
echo "$subject" | logger
fi
fi


We have similar script for checking ZFS too.

Miroslav Lachman
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Notification for GMirror failures

2018-05-08 Thread Patrick M. Hausen
Hi all,


> Am 08.05.2018 um 09:28 schrieb Andrea Brancatelli :
> out of curiosity, does any kind of GMirror-failure notification tools
> exist? 

http://soren.klintrup.dk/gmirror

We use it in production. Works as designed.

HTH,
Patrick
-- 
punkt.de GmbH   Internet - Dienstleistungen - Beratung
Kaiserallee 13a Tel.: 0721 9109-0 Fax: -100
76133 Karlsruhe i...@punkt.de   http://punkt.de
AG Mannheim 108285  Gf: Juergen Egeling

___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Notification for GMirror failures

2018-05-08 Thread Andrea Brancatelli
Hi, 

out of curiosity, does any kind of GMirror-failure notification tools
exist? 

Either native... SNMP... external ports... whatever?

-- 

Andrea Brancatelli
Schema31 S.p.a.
Chief Technology Officier

ROMA - FI - PA 
ITALY
Tel: +39.06.98.358.472
Cell: +39.331.2488468
Fax: +39.055.71.880.466
Società del Gruppo OVIDIO TECH S.R.L.
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"