1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
| #set -x
OPCMON=/opt/OV/bin/opcmon
Usage()
{
echo "Usage: $1 [-c A|B [-bg 0|1|...|-lbg]]"
exit 1
}
CheckSlices()
{
#0 front1_1 1391260 true false
#0 front2_1 1391260 true false
#0 master 1391260 true false
#1 front1_1 1381123 true false
#1 front3_1 1381123 true false
#1 master 1381123 true false
grep "<IndexSliceInstanceStatus" | sed -e 's/^.*indexSlice="//' -e 's/" sliceInstance="/ /' \
-e 's/".*ndocs="/ /' -e 's/".*replicationIsUpToDate="/ /' \
-e 's/" replicationIsBlocking="/ /' -e 's/".*//' | awk '
{
if (NR==1 || s!=$1) {
s=$1;
n=$3;
}
if ($n != $3) {
print "NOK - slice", $1, "instance", $2, ": wrong number of documents (found:", $3, "expected:", n,")";
}
if ($4 != "true") {
print "NOK - slice", $1, "instance", $2, ": replication problem (not up to date)";
}
if ($5 != "false") {
print "NOK - slice", $1, "instance", $2, ": replication problem (blocking)";
}
}
'
}
CR=0
C=""
BG=""
while [ $# -gt 0 ]
do
case $1 in
-c) C=$2; shift;;
-bg) BG=$2; shift;;
-lbg) [ x"$C" = "xA" ] && echo "0 1" || echo "0 1 2 3"; exit 0;;
*) Usage $0;;
esac
shift
done
[ x"$C" = "x" ] && LC="A B" || LC=$C
for c in $LC
do
[ -f $c/exalead_env ] && . $c/exalead_env || . $c/exabis_env
[ x"$BG" = "x" ] && {
case $c in
A) LBG="0 1";;
B) LBG="0 1 2 3";;
esac
} || LBG=$BG
for i in $LBG
do
echo -n "ssh $EXA_USER@$EXA_ADM_HOST admin/bin/cvcommand :$EXA_ADM_PORT mami/indexing getBuildGroupStatus buildGroup=bg$i => "
res=`ssh $EXA_USER@$EXA_ADM_HOST admin/bin/cvcommand :$EXA_ADM_PORT mami/indexing getBuildGroupStatus buildGroup=bg$i 2>/dev/null | xmllint --format - 2>/dev/null`
[ $? -ne 0 ] && {
echo "OK (stopped ?)"
continue
}
status1=`echo "$res" | egrep 'replicationIsBlocking="true"|replicationIsUpToDate="false"'`
CR1=$?
status2=`echo "$res" | egrep 'PushServerStatus enabled="false"'`
CR2=$?
status3=`echo "$res" | egrep 'flowControlThrottling="true"'`
CR3=$?
status4=`echo "$res" | egrep 'flowControlBlocking="true"'`
CR4=$?
([ $CR1 -eq 0 ] || [ $CR2 -eq 0 ] || [ $CR3 -eq 0 ] || [ $CR4 -eq 0 ]) && (CR=1; echo "NOK") || echo "OK"
if [ x"$status1" != "x" ]
then
status5=`echo "$res" | CheckSlices | grep NOK`
echo "$status5"
fi
if [ x"$status2" != "x" ]
then
$OPCMON AFP_exalead_CheckBuildGroupStatus=1 -object PushServerStatus -option cause="PushServerStatus enabled=false"
fi
if [ x"$status3" != "x" ]
then
$OPCMON AFP_exalead_CheckBuildGroupStatus=1 -object flowControlThrottling -option cause="flowControlThrottling=true"
fi
if [ x"$status4" != "x" ]
then
$OPCMON AFP_exalead_CheckBuildGroupStatus=1 -object flowControlBlocking -option cause="flowControlBlocking=true"
fi
done
done
exit $CR |
Partager