diff --git a/utilities/aquilon/checkhost.sh b/utilities/aquilon/checkhost.sh new file mode 100644 index 0000000..5e29ab7 --- /dev/null +++ b/utilities/aquilon/checkhost.sh @@ -0,0 +1,9 @@ +hosts=`cat hostlist.txt` +#run aq show_hosts over multiple hosts and searches for passed string +#example: basheckhost.sh Sandbox checks if hosts are in a sandbox +# +for t in ${hosts}; do + echo "--------------------------------------------------------------------------------------------------------------" + echo $t + aq show_host --hostname ${t} | grep -i ${1} +done diff --git a/utilities/aquilon/compilehosts.sh b/utilities/aquilon/compilehosts.sh new file mode 100644 index 0000000..96a1264 --- /dev/null +++ b/utilities/aquilon/compilehosts.sh @@ -0,0 +1,9 @@ +hosts=`cat hostlist.txt` +#compiles all hosts in the hostlist file +#example: bash compilehosts.sh +# +for t in ${hosts}; do + echo "--------------------------------------------------------------------------------------------------------------" + echo $t + aq compile --hostname ${t} +done diff --git a/utilities/aquilon/hostlist.txt b/utilities/aquilon/hostlist.txt new file mode 100644 index 0000000..eca1762 --- /dev/null +++ b/utilities/aquilon/hostlist.txt @@ -0,0 +1,22 @@ +ceph-gw1.gridpp.rl.ac.uk +ceph-gw2.gridpp.rl.ac.uk +ceph-gw3.gridpp.rl.ac.uk +ceph-gw4.gridpp.rl.ac.uk +ceph-gw5.gridpp.rl.ac.uk +ceph-gw6.gridpp.rl.ac.uk +ceph-gw7.gridpp.rl.ac.uk +ceph-gw8.gridpp.rl.ac.uk +ceph-gw10.gridpp.rl.ac.uk +ceph-gw11.gridpp.rl.ac.uk +ceph-gw12.gridpp.rl.ac.uk +ceph-gw13.gridpp.rl.ac.uk +ceph-gw14.gridpp.rl.ac.uk +ceph-gw15.gridpp.rl.ac.uk +ceph-gw16.gridpp.rl.ac.uk +ceph-svc01.gridpp.rl.ac.uk +ceph-svc02.gridpp.rl.ac.uk +ceph-svc03.gridpp.rl.ac.uk +ceph-svc05.gridpp.rl.ac.uk +ceph-svc97.gridpp.rl.ac.uk +ceph-svc98.gridpp.rl.ac.uk +ceph-svc99.gridpp.rl.ac.uk diff --git a/utilities/hostlist.txt b/utilities/hostlist.txt new file mode 100644 index 0000000..eca1762 --- /dev/null +++ b/utilities/hostlist.txt @@ -0,0 +1,22 @@ +ceph-gw1.gridpp.rl.ac.uk +ceph-gw2.gridpp.rl.ac.uk +ceph-gw3.gridpp.rl.ac.uk +ceph-gw4.gridpp.rl.ac.uk +ceph-gw5.gridpp.rl.ac.uk +ceph-gw6.gridpp.rl.ac.uk +ceph-gw7.gridpp.rl.ac.uk +ceph-gw8.gridpp.rl.ac.uk +ceph-gw10.gridpp.rl.ac.uk +ceph-gw11.gridpp.rl.ac.uk +ceph-gw12.gridpp.rl.ac.uk +ceph-gw13.gridpp.rl.ac.uk +ceph-gw14.gridpp.rl.ac.uk +ceph-gw15.gridpp.rl.ac.uk +ceph-gw16.gridpp.rl.ac.uk +ceph-svc01.gridpp.rl.ac.uk +ceph-svc02.gridpp.rl.ac.uk +ceph-svc03.gridpp.rl.ac.uk +ceph-svc05.gridpp.rl.ac.uk +ceph-svc97.gridpp.rl.ac.uk +ceph-svc98.gridpp.rl.ac.uk +ceph-svc99.gridpp.rl.ac.uk diff --git a/utilities/logsearch.sh b/utilities/logsearch.sh new file mode 100644 index 0000000..3ef3c28 --- /dev/null +++ b/utilities/logsearch.sh @@ -0,0 +1,11 @@ +hosts=`cat hostlist.txt` +#searches xrootd and gridftp logs and ip address gw hosts listed above for parameter passed to script +#example: bash logsearch.sh 31.147.202.178 searches for that ip address in logs and ssh +# +for t in ${hosts[@]}; do + echo "--------------------------------------------------------------------------------------------------------------" + echo $t + ( ssh root@${t} "cat /var/log/xrootd/unified/xrootd.log | grep -i \"${1}\"") + ( ssh root@${t} "cat /var/log/gridftp/* | grep -i \"${1}\"") + ( ssh root@${t} "ss -a | grep -i \"${1}\"") +done diff --git a/utilities/serviceop.sh b/utilities/serviceop.sh new file mode 100644 index 0000000..46d74bf --- /dev/null +++ b/utilities/serviceop.sh @@ -0,0 +1,30 @@ +hosts=`cat hostlist.txt` +# helper function to check if string is in list +function exists_in_list() { + LIST=$1 + DELIMITER=$2 + VALUE=$3 + LIST_WHITESPACES=`echo $LIST | tr "$DELIMITER" " "` + for x in $LIST_WHITESPACES; do + if [ "$x" = "$VALUE" ]; then + return 0 + fi + done + return 1 +} + +#run service operations on targetted services over multiple hosts +#example: bash serviceop.sh status xrootd@* reports the service status of all xrootd services on the hosts +# +if exists_in_list "start stop status restart" " " ${1} +then + echo "start" +else + echo "invalid op. valid ops are: start stop status restart" + exit +fi +for t in ${hosts}; do + echo "--------------------------------------------------------------------------------------------------------------" + echo $t + ( ssh root@${t} "systemctl ${1} ${2}" ) +done