From 571ee6425884a5c0f092ade4e3737d0d38bcf046 Mon Sep 17 00:00:00 2001 From: Aroosha Pervaiz Date: Sun, 1 Sep 2024 23:26:48 +0200 Subject: [PATCH 1/6] Script to test APS endpoints. --- kubernetes/cmsweb/scripts/test_k8s_aps.sh | 120 ++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100755 kubernetes/cmsweb/scripts/test_k8s_aps.sh diff --git a/kubernetes/cmsweb/scripts/test_k8s_aps.sh b/kubernetes/cmsweb/scripts/test_k8s_aps.sh new file mode 100755 index 000000000..d5e0eb145 --- /dev/null +++ b/kubernetes/cmsweb/scripts/test_k8s_aps.sh @@ -0,0 +1,120 @@ +#!/bin/bash +##H Usage: test_k8s.sh +##H + +if [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ] || [ "$1" == "help" ] || [ "$1" == "" ]; then + perl -ne '/^##H/ && do { s/^##H ?//; print }' < $0 + exit 1 +fi + +X509_USER_KEY=$HOME/.globus/userkey.pem +X509_USER_CERT=$HOME/.globus/usercert.pem + +base_url=$1 + +# Function to perform the request with automatic redirect following +perform_request() { + local target_url="$1" + final_status_code=$(curl -L -i --key $X509_USER_KEY --cert $X509_USER_CERT -o /dev/null -w '%{http_code}' -s "$target_url") + echo "$target_url HTTP code: $final_status_code" +} + +# CouchDB +echo "CouchDB:" +urls_couchdb=" +/couchdb/ +" +for u in $urls_couchdb; do + perform_request "${base_url}${u}" +done +echo + +# Crabserver +echo "Crabserver:" +urls_crabserver=" +/crabserver/preprod/info +/scheddmon/059/crabint1/ +" +for u in $urls_crabserver; do + perform_request "${base_url}${u}" +done +echo + +# DAS +echo "DAS:" +urls_das=" +/das +" +for u in $urls_das; do + perform_request "${base_url}${u}" +done +echo + +# DBS +echo "DBS:" +urls_dbs=" +/dbs/int/global/DBSReader/serverinfo +/dbs/int/global/DBSReader/datasets?dataset=%2FWplusToJJZToLNuJJ_mjj100_pTj10_QCD_LO_TuneCP5_13TeV-madgraph-pythia8%2FRunIISummer20UL17MiniAODv2-106X_mc2017_realistic_v9-v2%2FMINIAODSIM&dataset_access_type=%2A&detail=False +/dbs/int/global/DBSReader/blocks?dataset=%2FWplusToJJZToLNuJJ_mjj100_pTj10_QCD_LO_TuneCP5_13TeV-madgraph-pythia8%2FRunIISummer20UL17MiniAODv2-106X_mc2017_realistic_v9-v2%2FMINIAODSIM&detail=False +/dbs/int/global/DBSReader/blocks?block_name=%2FWplusToJJZToLNuJJ_mjj100_pTj10_QCD_LO_TuneCP5_13TeV-madgraph-pythia8%2FRunIISummer20UL17MiniAODv2-106X_mc2017_realistic_v9-v2%2FMINIAODSIM%23f6557ea8-2493-4644-90a2-8a2fbb070abc +" +for u in $urls_dbs; do + perform_request "${base_url}${u}" +done +echo + +# DMWM +echo "DMWM:" +urls_dmwm=" +/couchdb/ +/acdcserver/_all_docs +/reqmgr2/data/info +/workqueue/index.html +/t0_reqmon/data/info +/wmstatsserver/data/info +/wmstats/index.html +/exitcodes +/wmarchive/data +/ms-transferor/data/status +/ms-monitor/data/status +/ms-output/data/status +/ms-rulecleaner/data/status +/ms-unmerged/data/status?rse_type=t1 +/ms-unmerged/data/status?rse_type=t2t3 +/ms-unmerged/data/status?rse_type=t2t3us +" +for u in $urls_dmwm; do + perform_request "${base_url}${u}" +done +echo + +# DQM +echo "DQM:" +urls_dqm=" +/dqm/dqm-square/ +/dqm/online/ +/dqm/online-playback/ +/dqm/offline/ +/dqm/relval/ +/dqm/dev/ +/dqm/offline-test/ +/dqm/relval-test/ +" +for u in $urls_dqm; do + perform_request "${base_url}${u}" +done +echo + +# T0 +echo "T0:" +urls_t0=" +/t0wmadatasvc/prod/firstconditionsaferun +/t0wmadatasvc/prod/config +/t0wmadatasvc/prod/express_config +/t0wmadatasvc/prod/reco_config +" +for u in $urls_t0; do + perform_request "${base_url}${u}" +done +echo + From 0fcd57e1841bade855be7a5ae945f9a1db4f4462 Mon Sep 17 00:00:00 2001 From: Aroosha Pervaiz Date: Sun, 1 Sep 2024 23:28:54 +0200 Subject: [PATCH 2/6] Remove redundant couchdb URL. --- kubernetes/cmsweb/scripts/test_k8s_aps.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/kubernetes/cmsweb/scripts/test_k8s_aps.sh b/kubernetes/cmsweb/scripts/test_k8s_aps.sh index d5e0eb145..261787db9 100755 --- a/kubernetes/cmsweb/scripts/test_k8s_aps.sh +++ b/kubernetes/cmsweb/scripts/test_k8s_aps.sh @@ -66,7 +66,6 @@ echo # DMWM echo "DMWM:" urls_dmwm=" -/couchdb/ /acdcserver/_all_docs /reqmgr2/data/info /workqueue/index.html From 16da1d6db19cc4364570c526612d6e7f359390c1 Mon Sep 17 00:00:00 2001 From: Aroosha Pervaiz Date: Sun, 1 Sep 2024 23:29:46 +0200 Subject: [PATCH 3/6] Fix file name. --- kubernetes/cmsweb/scripts/test_k8s_aps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/cmsweb/scripts/test_k8s_aps.sh b/kubernetes/cmsweb/scripts/test_k8s_aps.sh index 261787db9..ad9d7e4c7 100755 --- a/kubernetes/cmsweb/scripts/test_k8s_aps.sh +++ b/kubernetes/cmsweb/scripts/test_k8s_aps.sh @@ -1,5 +1,5 @@ #!/bin/bash -##H Usage: test_k8s.sh +##H Usage: test_k8s_aps.sh ##H if [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ] || [ "$1" == "help" ] || [ "$1" == "" ]; then From 11bd2b199da525a84ae1f9109efe80b3caffb7a2 Mon Sep 17 00:00:00 2001 From: Aroosha Pervaiz Date: Mon, 9 Sep 2024 16:47:42 +0200 Subject: [PATCH 4/6] Separating URL file from script --- kubernetes/cmsweb/scripts/test_k8s_aps.sh | 133 ++++++---------------- kubernetes/cmsweb/scripts/urls.txt | 49 ++++++++ 2 files changed, 82 insertions(+), 100 deletions(-) create mode 100644 kubernetes/cmsweb/scripts/urls.txt diff --git a/kubernetes/cmsweb/scripts/test_k8s_aps.sh b/kubernetes/cmsweb/scripts/test_k8s_aps.sh index ad9d7e4c7..b06767578 100755 --- a/kubernetes/cmsweb/scripts/test_k8s_aps.sh +++ b/kubernetes/cmsweb/scripts/test_k8s_aps.sh @@ -1,9 +1,16 @@ #!/bin/bash -##H Usage: test_k8s_aps.sh +##H Usage: test_k8s_aps.sh ##H if [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ] || [ "$1" == "help" ] || [ "$1" == "" ]; then - perl -ne '/^##H/ && do { s/^##H ?//; print }' < $0 + grep "##H" $0 | sed -e "s,##H,,g" + exit 1 +fi + +# Check if required arguments are provided +if [ $# -ne 2 ]; then + echo "Error: You need to provide and " + grep "##H" $0 | sed -e "s,##H,,g" exit 1 fi @@ -11,109 +18,35 @@ X509_USER_KEY=$HOME/.globus/userkey.pem X509_USER_CERT=$HOME/.globus/usercert.pem base_url=$1 +url_list_file=$2 + +# Check if the URL list file exists +if [ ! -f "$url_list_file" ]; then + echo "Error: File $url_list_file not found!" + exit 1 +fi # Function to perform the request with automatic redirect following perform_request() { local target_url="$1" final_status_code=$(curl -L -i --key $X509_USER_KEY --cert $X509_USER_CERT -o /dev/null -w '%{http_code}' -s "$target_url") - echo "$target_url HTTP code: $final_status_code" + echo " $target_url -> HTTP code: $final_status_code" } -# CouchDB -echo "CouchDB:" -urls_couchdb=" -/couchdb/ -" -for u in $urls_couchdb; do - perform_request "${base_url}${u}" -done -echo - -# Crabserver -echo "Crabserver:" -urls_crabserver=" -/crabserver/preprod/info -/scheddmon/059/crabint1/ -" -for u in $urls_crabserver; do - perform_request "${base_url}${u}" -done -echo - -# DAS -echo "DAS:" -urls_das=" -/das -" -for u in $urls_das; do - perform_request "${base_url}${u}" -done -echo - -# DBS -echo "DBS:" -urls_dbs=" -/dbs/int/global/DBSReader/serverinfo -/dbs/int/global/DBSReader/datasets?dataset=%2FWplusToJJZToLNuJJ_mjj100_pTj10_QCD_LO_TuneCP5_13TeV-madgraph-pythia8%2FRunIISummer20UL17MiniAODv2-106X_mc2017_realistic_v9-v2%2FMINIAODSIM&dataset_access_type=%2A&detail=False -/dbs/int/global/DBSReader/blocks?dataset=%2FWplusToJJZToLNuJJ_mjj100_pTj10_QCD_LO_TuneCP5_13TeV-madgraph-pythia8%2FRunIISummer20UL17MiniAODv2-106X_mc2017_realistic_v9-v2%2FMINIAODSIM&detail=False -/dbs/int/global/DBSReader/blocks?block_name=%2FWplusToJJZToLNuJJ_mjj100_pTj10_QCD_LO_TuneCP5_13TeV-madgraph-pythia8%2FRunIISummer20UL17MiniAODv2-106X_mc2017_realistic_v9-v2%2FMINIAODSIM%23f6557ea8-2493-4644-90a2-8a2fbb070abc -" -for u in $urls_dbs; do - perform_request "${base_url}${u}" -done -echo - -# DMWM -echo "DMWM:" -urls_dmwm=" -/acdcserver/_all_docs -/reqmgr2/data/info -/workqueue/index.html -/t0_reqmon/data/info -/wmstatsserver/data/info -/wmstats/index.html -/exitcodes -/wmarchive/data -/ms-transferor/data/status -/ms-monitor/data/status -/ms-output/data/status -/ms-rulecleaner/data/status -/ms-unmerged/data/status?rse_type=t1 -/ms-unmerged/data/status?rse_type=t2t3 -/ms-unmerged/data/status?rse_type=t2t3us -" -for u in $urls_dmwm; do - perform_request "${base_url}${u}" -done -echo - -# DQM -echo "DQM:" -urls_dqm=" -/dqm/dqm-square/ -/dqm/online/ -/dqm/online-playback/ -/dqm/offline/ -/dqm/relval/ -/dqm/dev/ -/dqm/offline-test/ -/dqm/relval-test/ -" -for u in $urls_dqm; do - perform_request "${base_url}${u}" -done -echo - -# T0 -echo "T0:" -urls_t0=" -/t0wmadatasvc/prod/firstconditionsaferun -/t0wmadatasvc/prod/config -/t0wmadatasvc/prod/express_config -/t0wmadatasvc/prod/reco_config -" -for u in $urls_t0; do - perform_request "${base_url}${u}" -done -echo +# Read the list of URLs from the file and process each +current_section="" +while read -r line; do + # If the line is a comment, treat it as a section heading + if [[ "$line" =~ ^#.*$ ]]; then + section_header="${line/#\# /}" # Remove "# " from the start of the comment + if [[ "$section_header" != "$current_section" ]]; then + current_section="$section_header" + echo + echo "== $current_section ==" + fi + # If the line is not empty or a comment, process the URL + elif [[ ! -z "$line" ]]; then + perform_request "${base_url}${line}" + fi +done < "$url_list_file" diff --git a/kubernetes/cmsweb/scripts/urls.txt b/kubernetes/cmsweb/scripts/urls.txt new file mode 100644 index 000000000..0f11107e2 --- /dev/null +++ b/kubernetes/cmsweb/scripts/urls.txt @@ -0,0 +1,49 @@ +# CouchDB +/couchdb/ + +# Crabserver +/crabserver/preprod/info +/scheddmon/059/crabint1/ + +# DAS +/das + +# DBS +/dbs/int/global/DBSReader/serverinfo +/dbs/int/global/DBSReader/datasets?dataset=%2FWplusToJJZToLNuJJ_mjj100_pTj10_QCD_LO_TuneCP5_13TeV-madgraph-pythia8%2FRunIISummer20UL17MiniAODv2-106X_mc2017_realistic_v9-v2%2FMINIAODSIM&dataset_access_type=%2A&detail=False +/dbs/int/global/DBSReader/blocks?dataset=%2FWplusToJJZToLNuJJ_mjj100_pTj10_QCD_LO_TuneCP5_13TeV-madgraph-pythia8%2FRunIISummer20UL17MiniAODv2-106X_mc2017_realistic_v9-v2%2FMINIAODSIM&detail=False +/dbs/int/global/DBSReader/blocks?block_name=%2FWplusToJJZToLNuJJ_mjj100_pTj10_QCD_LO_TuneCP5_13TeV-madgraph-pythia8%2FRunIISummer20UL17MiniAODv2-106X_mc2017_realistic_v9-v2%2FMINIAODSIM%23f6557ea8-2493-4644-90a2-8a2fbb070abc + +# DMWM +/acdcserver/_all_docs +/reqmgr2/data/info +/workqueue/index.html +/t0_reqmon/data/info +/wmstatsserver/data/info +/wmstats/index.html +/exitcodes +/wmarchive/data +/ms-transferor/data/status +/ms-monitor/data/status +/ms-output/data/status +/ms-rulecleaner/data/status +/ms-unmerged/data/status?rse_type=t1 +/ms-unmerged/data/status?rse_type=t2t3 +/ms-unmerged/data/status?rse_type=t2t3us + +# DQM +/dqm/dqm-square/ +/dqm/online/ +/dqm/online-playback/ +/dqm/offline/ +/dqm/relval/ +/dqm/dev/ +/dqm/offline-test/ +/dqm/relval-test/ + +# T0 +/t0wmadatasvc/prod/firstconditionsaferun +/t0wmadatasvc/prod/config +/t0wmadatasvc/prod/express_config +/t0wmadatasvc/prod/reco_config + From 629ea3f4b4fd61b606baba5e753e6155713a5c36 Mon Sep 17 00:00:00 2001 From: Aroosha Pervaiz Date: Tue, 10 Sep 2024 18:54:51 +0200 Subject: [PATCH 5/6] Adding functionality with PROXY --- kubernetes/cmsweb/scripts/test_k8s_aps.sh | 51 ++++++++++++++++------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/kubernetes/cmsweb/scripts/test_k8s_aps.sh b/kubernetes/cmsweb/scripts/test_k8s_aps.sh index b06767578..ed94abf2c 100755 --- a/kubernetes/cmsweb/scripts/test_k8s_aps.sh +++ b/kubernetes/cmsweb/scripts/test_k8s_aps.sh @@ -2,6 +2,7 @@ ##H Usage: test_k8s_aps.sh ##H +# Replace Perl usage with standard UNIX tools if [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ] || [ "$1" == "help" ] || [ "$1" == "" ]; then grep "##H" $0 | sed -e "s,##H,,g" exit 1 @@ -29,24 +30,44 @@ fi # Function to perform the request with automatic redirect following perform_request() { local target_url="$1" - final_status_code=$(curl -L -i --key $X509_USER_KEY --cert $X509_USER_CERT -o /dev/null -w '%{http_code}' -s "$target_url") + local cert="$2" + local key="$3" + final_status_code=$(curl -L -i --key "$key" --cert "$cert" -o /dev/null -w '%{http_code}' -s "$target_url") echo " $target_url -> HTTP code: $final_status_code" } # Read the list of URLs from the file and process each -current_section="" -while read -r line; do - # If the line is a comment, treat it as a section heading - if [[ "$line" =~ ^#.*$ ]]; then - section_header="${line/#\# /}" # Remove "# " from the start of the comment - if [[ "$section_header" != "$current_section" ]]; then - current_section="$section_header" - echo - echo "== $current_section ==" +run_tests() { + local cert="$1" + local key="$2" + current_section="" + while read -r line; do + # If the line is a comment, treat it as a section heading + if [[ "$line" =~ ^#.*$ ]]; then + section_header="${line/#\# /}" # Remove "# " from the start of the comment + if [[ "$section_header" != "$current_section" ]]; then + current_section="$section_header" + echo + echo "== $current_section ==" + fi + # If the line is not empty or a comment, process the URL + elif [[ ! -z "$line" ]]; then + perform_request "${base_url}${line}" "$cert" "$key" fi - # If the line is not empty or a comment, process the URL - elif [[ ! -z "$line" ]]; then - perform_request "${base_url}${line}" - fi -done < "$url_list_file" + done < "$url_list_file" +} + +# Run tests with X509_USER_CERT and X509_USER_KEY +echo "### Running tests with X509_USER_CERT and X509_USER_KEY" +run_tests "$X509_USER_CERT" "$X509_USER_KEY" + +# Generate and use the proxy certificate +echo "### Running tests with X509_USER_PROXY" +unset X509_USER_PROXY +voms-proxy-init -voms cms -rfc +export X509_USER_PROXY=/tmp/x509up_u`id -u` + +echo +echo "### Testing with proxy: $X509_USER_PROXY" +run_tests "$X509_USER_PROXY" "$X509_USER_PROXY" From e4dc3fa149f86381dc68703267726a98c1f5e8de Mon Sep 17 00:00:00 2001 From: Aroosha Pervaiz Date: Tue, 10 Sep 2024 18:57:26 +0200 Subject: [PATCH 6/6] Adding functionality with PROXY --- kubernetes/cmsweb/scripts/test_k8s_aps.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/kubernetes/cmsweb/scripts/test_k8s_aps.sh b/kubernetes/cmsweb/scripts/test_k8s_aps.sh index ed94abf2c..f0ab94b1e 100755 --- a/kubernetes/cmsweb/scripts/test_k8s_aps.sh +++ b/kubernetes/cmsweb/scripts/test_k8s_aps.sh @@ -2,7 +2,6 @@ ##H Usage: test_k8s_aps.sh ##H -# Replace Perl usage with standard UNIX tools if [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ] || [ "$1" == "help" ] || [ "$1" == "" ]; then grep "##H" $0 | sed -e "s,##H,,g" exit 1