Skip to main content

Posts

Showing posts from May, 2017

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 23importos,MySQLdbdefmain(): """ 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, user = MYSQLUSERNAME, …

Sending request using request library

Using request library for Pirates  Few years ago using urllib2 was a simplest way for sending and receiving  HTTP Request. But now I'm using  Request library . This  is more simple and powerful. Unfortunately Request is not include in default install and Pip  should be used .  Installation  Procedure is really simple  and near to standard :
MacBook-Pro-Hohlov:pirates skhohlov$ virtualenv ./env New python executable in ./env/bin/python2.7 Also creating executable in ./env/bin/python Installing setuptools, pip, wheel...done. MacBook-Pro-Hohlov:pirates skhohlov$ source ./env/bin/activate (env)MacBook-Pro-Hohlov:pirates skhohlov$ (env)MacBook-Pro-Hohlov:pirates skhohlov$ (env)MacBook-Pro-Hohlov:pirates skhohlov$ pip install requests Collecting requests Using cached requests-2.13.0-py2.py3-none-any.whl Installing collected packages: requests Successfully installed requests-2.13.0 You are using pip version 7.1.2, however version 9.0.1 is available. You should consider upgrading via th…