Friday, June 13, 2008

script to monitor mysql status

#------------------------------------------ BEGIN ---------------------------------------------------------
#Author Jabir Ahmed
# Date : 19th January 2008
# Email : jabirahmed@yahoo.com
# Purpose : cron to check the mysl status at regular interval and send mail to admin
#usage
# sh connection_monitor.sh username password hostname


username=$1;
password=$2;
hostname=$3;
mailid="jabirahmed@yahoo.com";


# if you only want the number of connections then use this line

#mysqladmin extended -u $username -p$password -h $hostname|grep Threads_connected -i|sed "s/|/---/g"|mail -s 'mysql status '`date` $mailid



# for complete mysql info use this line
mysqladmin extended -u $username -p$password -h $hostname|mail -s 'mysql status '`date` $mailid



#------------------------------------------ END OF SCRIPT ---------------------------------------------------------

No comments: