Commit b7a5428e authored by Edita Kizinevic's avatar Edita Kizinevic
Browse files

Stop trying squids after one successful fn-req when script runs as pilot, add FRONTIER_ID to fn-req

parent 5318d6f6
......@@ -2,14 +2,16 @@
shopt -s expand_aliases
SCRIPT_REVISION="2020-03-20, Dave Dykstra and Edita Kizinevic"
SCRIPT_REVISION="2020-03-30"
MAINTAINERS="Dave Dykstra and Edita Kizinevic"
SCRIPT_NAME=`basename "$0"`
# Script does not use backupproxyurl if it is SAM test, but script uses backupproxyurl if it is pilot
includebackups=false
while getopts ":b" opt; do
# Script has some differences when it runs as SAM or pilot
pilot=false
while getopts ":p" opt; do
case ${opt} in
b)
includebackups=true
p)
pilot=true
;;
\?)
echo "Invalid Option: -$OPTARG" 1>&2
......@@ -81,7 +83,7 @@ if [ -z "$CMS_PATH" ] ; then
fi
# Print script version information
echo "script version: $SCRIPT_REVISION"
echo "script version: $SCRIPT_REVISION, $MAINTAINERS"
echo
# Get site name
......@@ -101,7 +103,7 @@ echo
# Script checks failover if it is SAM test, but script does not check failover if it is pilot
failover=false
if ! $includebackups; then
if ! $pilot; then
if [ ! -z "$site" ] ; then
site_summary_file=site_summary.txt
url=http://wlcg-squid-monitor.cern.ch/failover/failoverCMS/$site_summary_file
......@@ -132,12 +134,15 @@ cmsenv
# Function to check proxies
# $1 - list of proxies
# $2 - $includebackups
# $2 - $pilot
check_proxies() {
# Script does not use backupproxyurl if it is SAM test, but script uses backupproxyurl if it is pilot
if $2; then
backupproxyurl="*(backupproxyurl=*"
FRONTIER_ID="${SCRIPT_NAME}_pilot_${SCRIPT_REVISION}"
else
backupproxyurl="NONE"
FRONTIER_ID="${SCRIPT_NAME}_SAM_${SCRIPT_REVISION}"
fi
for PART in $1; do
proxy=`echo $PART | sed 's/^.*(/(/'`
......@@ -154,19 +159,23 @@ check_proxies() {
IP_addresses="$IP_addresses $hostname"
fi
for IP_address in $IP_addresses; do
proxy_IP=`echo $proxy | sed "s/$hostname/$IP_address/g"`
echo "Query $proxy started:" `date`
echo 'select 1 from dual' | FRONTIER_SERVER="$proxy_IP(serverurl=http://cmsfrontier.cern.ch:8000/FrontierProd)(failovertoserver=no)" fn-req > $output
if grep -q " 1 NUMBER" $output ; then
echo "$proxy_IP is OK"
ever_succeeded=true
if ($2 && ! $ever_succeeded) || ! $2; then
proxy_IP=`echo $proxy | sed "s/$hostname/$IP_address/g"`
echo "Query $proxy started:" `date`
echo 'select 1 from dual' | FRONTIER_SERVER="$proxy_IP(serverurl=http://cmsfrontier.cern.ch:8000/FrontierProd)(failovertoserver=no)" FRONTIER_ID=$FRONTIER_ID fn-req > $output
if grep -q " 1 NUMBER" $output ; then
echo "$proxy_IP is OK"
ever_succeeded=true
else
echo "$proxy_IP is FAILED:"
cat $output
ever_failed=true
fi
echo "Query $proxy ended:" `date`
echo
else
echo "$proxy_IP is FAILED:"
cat $output
ever_failed=true
return
fi
echo "Query $proxy ended:" `date`
echo
done
;;
*"(proxyconfigurl="*)
......@@ -174,7 +183,7 @@ check_proxies() {
proxy_config_url=$proxy
echo "Converting $proxy_config_url proxyconfigurl to proxyurl/backupproxyurl started:" `date`
echo
echo 'select 1 from dual' | FRONTIER_LOG_LEVEL=debug FRONTIER_SERVER="$proxy(serverurl=http://cmsfrontier.cern.ch:8000/FrontierProd)(failovertoserver=no)" fn-req > $debug_output 2>&1
echo 'select 1 from dual' | FRONTIER_LOG_LEVEL=debug FRONTIER_SERVER="$proxy(serverurl=http://cmsfrontier.cern.ch:8000/FrontierProd)(failovertoserver=no)" FRONTIER_ID=$FRONTIER_ID fn-req > $debug_output 2>&1
if grep -q "FindProxyForURL" $debug_output ; then
found_proxyconfig=true
PROXYLIST="`sed -n '/returned "PROXY/{s/.*returned "//;s/PROXY /(proxyurl=/g;s/;/)/g;s/"/)/;p;q}' $debug_output`"
......@@ -203,7 +212,7 @@ ever_failed=false
ever_succeeded=false
found_proxyconfig=false
found_proxy=false
check_proxies "$FNCONNECT" $includebackups
check_proxies "$FNCONNECT" $pilot
#Check test results
if [ "$failover" == true ]; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment