Skip to main content

Posts

Showing posts with the label MySQL python performance

Another one MySQL monitor

Detecting MySQL loading I've seen strange and randomize increasing  of the  MySQL db loading but mytop did not help to sorted out with this issue. I'm not Mike Tyson and my reaction is more slow then CPU. If I don't catch this dynamically I will catch this statistically.  Main idea Select active request by cron and write it ti file. After this statistic analyze for long period of time sort  this problem out.  Selecting information  from  MySQL  Please add python mod MySQLdb  and set correct credentials up. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 import os , MySQLdb def main (): """ checking process list and save it to file""" LOGFILENAME = 'dbusage.log' MYSQLUSERNAME = 'root' MYSQLPASSWORD = 'password' MYSQLHOST = 'localhost' logfile = open (LOGFILENAME, 'a' ) mydb = MySQLdb . connect(host = MYSQLHOST, ...