Created
March 7, 2012 12:47
-
-
Save sergeylukin/1992915 to your computer and use it in GitHub Desktop.
Bash: launch monitoring terminals
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 | |
# | |
# Script Name: Launch terminals for monitoring | |
# Author: Sergey Lukin | |
# | |
# | |
# Wait for Network to be available. | |
while true | |
do | |
ping -c 1 10.0.0.248 | |
if [[ $? == 0 ]]; | |
then | |
#echo 'Network available' | |
break; | |
else | |
echo 'Network is not available, waiting..' | |
sleep 5 | |
fi | |
done | |
# Wait for Desktop GUI to load first. | |
while true | |
do | |
if ps -A | grep gnome-panel > /dev/null; | |
then | |
#echo 'X loaded' | |
break; | |
else | |
echo 'X not loaded, waiting...' | |
sleep 5 | |
fi | |
done | |
# Watch CPU processes on SERVER1 and SERVER2 | |
gnome-terminal --geometry=77x10+0+0 -t "SERVER1" -e "ssh -t user@SERVER1 top" | |
gnome-terminal --geometry=77x10-0+0 -t "SERVER2" -e "ssh -t user@SERVER2 top" | |
# Watch DEBUG.LOG for MYWEBSITE1.com and MYWEBSITE2.com | |
gnome-terminal --geometry=77x10+0+255 -t "MYWEBSITE1.com/log/debug.log" -e "ssh -t user@SERVER1 tail -f /var/www/html/MYWEBSITE1.com/log/debug.log" | |
gnome-terminal --geometry=77x10-0+255 -t "MYWEBSITE2.com/log/debug.log" -e "ssh -t user@SERVER2 tail -f /var/www/html/MYWEBSITE2.com/log/debug.log" | |
# Watch ERROR_LOG for MYWEBSITE1.com and MYWEBSITE2.com | |
gnome-terminal --geometry=77x10+0+485 -t "MYWEBSITE1.com-error_log" -e "ssh -t user@SERVER1 tail -f /var/log/httpd/MYWEBSITE1.com-error_log" | |
gnome-terminal --geometry=77x10-0+485 -t "MYWEBSITE2.com-error_log" -e "ssh -t user@SERVER2 tail -f /var/log/httpd/MYWEBSITE2.com-error_log" | |
# Watch MYSQL-SLOW.LOG for DBSERVER | |
gnome-terminal --geometry=160x13+0-0 -t "DBSERVER-mysql-slow.log" -e "ssh -t user@DBSERVER tail -f /var/log/mysql-slow.log" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment