Created
July 17, 2013 06:59
-
-
Save tairov/6018239 to your computer and use it in GitHub Desktop.
get connections from backends
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# получить открытые коннекты к mongos на балансере | |
HOSTS=('pm.back4' 'pm.back5' 'pm.back6') | |
file_name=$(date +"%F_%H_%M_%S") | |
for host in ${HOSTS[@]}; do | |
remote_cmd="sudo -u www-data netstat -ntp 2>/dev/null | grep 27027 | grep ESTABLISHED" | |
conn=$(ssh -p 60222 atairov@$host $remote_cmd | awk '{print $4, $7}' | sort) | |
echo "$conn" | |
echo "$conn" >> ./mongo_conn/$(echo $file_name)_$host.log | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment