Operating System - HP-UX
1753479 Members
5043 Online
108794 Solutions
New Discussion юеВ

Re: Live monitoring of DIsk Mirroring

 
SOLVED
Go to solution
arkie
Super Advisor

Live monitoring of DIsk Mirroring

Hi,

How can I monitor the Root Disk Mirroring activity in my system - LIVE, besides doing a:-

lvdisplay -v /dev/vg00/lvolX and grep for stale

Is there a better way. Are there any other logs being generated by 'lvextend' besides the system's syslog.log

Thanks in advance
6 REPLIES 6
Jupinder Bedi
Respected Contributor
Solution

Re: Live monitoring of DIsk Mirroring

you can use this script

for i in `vgdisplay -v vg00 | grep available | awk '{print $3}' | cut -c 1-9`
do
if [ $i = stale ]
then
echo " disk fail "
else
echo " disk ok "
fi
done


also you can just put a mailx syntax in this script if disk will fail

All things excellent are as difficult as they are rare
Jupinder Bedi
Respected Contributor

Re: Live monitoring of DIsk Mirroring

Also from the forum , this is the script

#!/bin/ksh
# script to check mirror(s) on vg00
# Geoff Wild 3/19/2003
#set -x

admin1=you@yourdomain.com
host_name=`hostname`

do_mirrordisk() {
echo "------------------------------------------------"
echo " checking the root disk vg00 on $host_name "
echo "------------------------------------------------"

for lvol in `/usr/sbin/vgdisplay -v vg00 |grep "LV Name" |awk '{print $3}'`
do
mirror=`/usr/sbin/lvdisplay -v ${lvol} |grep Mirror |awk '{print $3}'`
if [ $mirror -lt 1 ]
then
echo "Root Mirror disk for ${lvol} has no mirror..."
/usr/sbin/lvdisplay -v ${lvol} |grep Mirror > /tmp/MIRRPT
mailx -s "ALERT: $host_name Root Mirror for ${lvol} has no mirror..." $admin1 fi
stale=`/usr/sbin/lvdisplay -v ${lvol} | grep stale | wc -l`
if [ $stale -ge 1 ]
then
echo "Root Mirror disk for lvol${lvol} is down, please check ..."
/usr/sbin/lvdisplay -v ${lvol} | grep stale | head > /tmp/MIRRPT
mailx -s "ALERT: $host_name Root Mirror Disk for ${lvol} is down !" $admin1 < /tmp/MIRRPT
else
echo "Root Mirror Disk for ${lvol} is Okay !"
fi
done

}

do_mirrordisk
All things excellent are as difficult as they are rare
arkie
Super Advisor

Re: Live monitoring of DIsk Mirroring

Hi Jupinder,

Thanks! This is great
Torsten.
Acclaimed Contributor

Re: Live monitoring of DIsk Mirroring

>> lvdisplay -v /dev/vg00/lvolX and grep for stale


This is basically all you can do. You can count all the stale entries and do some calculations in a script too ...

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
sarfaraj ahmad
Trusted Contributor

Re: Live monitoring of DIsk Mirroring

lvdisplay -v /dev/vgX/lvolX |grep -i stale

is the better way to check the current mirroring progress.
Viktor Balogh
Honored Contributor

Re: Live monitoring of DIsk Mirroring

you can also do something like this:

# VGNAME=vgtarget
# while true;do lvdisplay -v `vgdisplay -v $VGNAME | awk '/LV Name/ {print $3}'` | grep -c stale; sleep 1; done

This is an infinite loop, which checks the target VG and prints the total number of stale LEs. (On a Linux system there is a command called 'watch' which does a similar task)
****
Unix operates with beer.