不要追求绝对的公平,红尘之中没有公平而言,人活一世,难得糊涂。
it is no use doing what you like, you have got to like what you do.
监控程序MYSQL
上一篇 /
下一篇 2007-06-15 15:14:13
/ 个人分类:Mercury LoadRunner
51Testing软件测试网"H\h-NPY监控程序:
Q%GE PSR0#!/usr/bin/env python51Testing软件测试网r`9g5nQ Q0y(Q
#-*- coding: cp936 -*-51Testing软件测试网-ZS2aWL[IE
n
import threading,os,time51Testing软件测试网ZdMW&m%v.JB
+~IZ_l@A^R0class Config_th:51Testing软件测试网3h4|3H1h9Cz)bQ#j
pn)[d-x_0 def Config_m(self):51Testing软件测试网;[ l2ha6n5E2cS
51Testing软件测试网+IgXW9Z{e~
#global set_workpath,set_commandpath,set_looptime,set_loophour,set_loopday
_0]w1F*}0 path = "monitor_config."51Testing软件测试网1b }
u [ fQ
monitor_config_path = open(path,'r')
d[R(B.h$[9X3@0 config_list = monitor_config_path.readlines()51Testing软件测试网"O8n_6\7?-P^
#Set WorkPath Config 51Testing软件测试网
C
LDUl}h5q&z
set_workpath = config_list[1][10:-1]51Testing软件测试网.cJ?2m5YqEX&W
#set CommandPath Config
6`)N&_-Q/`0 set_commandpath = config_list[2][13:-1]51Testing软件测试网Q0T8w$P|(n1S
#set looptime Config
MLdO)YsL0 set_looptime = config_list[3][17:-1]
6]z,Y3UsM {0 #set loopdata Config51Testing软件测试网bX#gOx'h7FX
set_loophour = config_list[4][14:-1]
Bn.v'_/u
i Fu A0 #set loopday Config51Testing软件测试网F]5l^"@:O
set_loopday = config_list[5][14:-1]51Testing软件测试网9Be6E8SnN!i{a
X
#test(os.system("echo %s" % (set_loopday)))51Testing软件测试网:oI t4N
F)b]
a2_m4T
return set_workpath,set_commandpath,set_looptime,set_loophour,set_loopday
Kp(u#C mjm051Testing软件测试网 ^*Z#|9sB.w^
class Cpuinfo_th(threading.Thread,Config_th):51Testing软件测试网
u0i"L J
ak
!j+{)TF@0 def __init__(self):51Testing软件测试网'm1\@C/NB
threading.Thread.__init__(self)
x2Ea.O8Hd0 def run(self):
#EF3`jiqr}!eK0 #global set_workpath,set_commandpath,set_looptime,set_loophour,set_loopday
!T
MQUQ0 set_workpath,set_commandpath,set_looptime,set_loophour,set_loopday = self.Config_m()
:^bZp0Ti+zE0 os.system("%s/iostat -t -c 1 1 >> %s/cpu_info.txt" % (set_commandpath,set_workpath))
3a9os!wK4t2e]0
4L'hru9Mh(N;J0class Memoryinfo_th(threading.Thread,Config_th):51Testing软件测试网c%I+Of(Kf%s4L
51Testing软件测试网x"f/om$DqR
def __init__(self):
0z J0R-d(]~Lt0 threading.Thread.__init__(self)
lLU/n8B:{,Y*P0 def run(self):
)qA3DX7PsJw0 #global set_workpath,set_commandpath,set_looptime,set_loophour,set_loopday
r\4\4ey0 set_workpath,set_commandpath,set_looptime,set_loophour,set_loopday = self.Config_m()
2Mc ej(M4W0 os.system("/usr/bin/vmstat -S K 1 1 >> %s/memory_info.txt" % (set_workpath))
&BEL @tz9^[
Q&o0
V@,S]XhrR6z0class Deciveinfo_th(threading.Thread,Config_th):51Testing软件测试网rJN+dgQ
51Testing软件测试网S[&p+Q1F-Y`D
def __init__(self):
[
{djQ?k0 threading.Thread.__init__(self)
5[;c_%W&cMX0tM0 def run(self):51Testing软件测试网+J ASR O#Or.Y$v;P?
#global set_workpath,set_commandpath,set_looptime,set_loophour,set_loopday51Testing软件测试网f/T5JAt1X
set_workpath,set_commandpath,set_looptime,set_loophour,set_loopday = self.Config_m()51Testing软件测试网.{/w^O)BP
os.system("%s/iostat -d 1 1 >> %s/decive_io_info.txt" % (set_commandpath,set_workpath))
l-o
rT[)e051Testing软件测试网#r3PW8o)rz
class Totalinfo_th(threading.Thread,Config_th):51Testing软件测试网7c!h7U1X,P
An+O5V8z
x8|(z'q!Uoe0 def __init__(self):51Testing软件测试网R O_qgy
threading.Thread.__init__(self)51Testing软件测试网:p]y/[y]|f9Uh
def run(self):51Testing软件测试网Z)sv0|mI
#global set_workpath,set_commandpath,set_looptime,set_loophour,set_loopday