提交 dac80d95d2d0a4e377b2c58969ebb00df979f65e

作者 qianyingz
1 个父辈 5bde3e49

监控模块

... ... @@ -127,14 +127,16 @@ class Api(ApiTemplate):
127 127 size = len(orginal)
128 128 orginal_stamp = {'head': 1, 'tail': size}
129 129 if size > 1:
130   - stamp = {'P0': 1,
  130 + stamp = {
  131 + # 'P0': 1,
131 132 'P50': math.floor(0.5*size),
132 133 'P90': math.floor(0.9*size),
133 134 'P95': math.floor(0.95*size),
134 135 # 'P99': math.floor(0.99*size),
135 136 'P100': size}
136 137 elif size == 1:
137   - stamp = {'P0': 1,
  138 + stamp = {
  139 + # 'P0': 1,
138 140 'P50': size,
139 141 'P90': size,
140 142 'P95': size,
... ...
... ... @@ -10,12 +10,12 @@ class Api(ApiTemplate):
10 10 def para_check(self):
11 11 if not self.para.get("host"):
12 12 raise Exception("缺乏host参数")
13   - if not self.para.get("user"):
14   - raise Exception("缺乏user参数")
15   - if not self.para.get("type"):
16   - raise Exception("缺乏type参数")
17   - if not self.para.get("passwd"):
18   - raise Exception("缺乏passwd参数")
  13 + # if not self.para.get("user"):
  14 + # raise Exception("缺乏user参数")
  15 + # if not self.para.get("type"):
  16 + # raise Exception("缺乏type参数")
  17 + # if not self.para.get("passwd"):
  18 + # raise Exception("缺乏passwd参数")
19 19
20 20 def process(self):
21 21
... ... @@ -24,9 +24,9 @@ class Api(ApiTemplate):
24 24 res["data"] = {}
25 25 try:
26 26 host = self.para.get("host") # server
27   - user = self.para.get("user")
28   - password = self.para.get("passwd")
29   - type = self.para.get("type")
  27 + # user = self.para.get("user")
  28 + # password = self.para.get("passwd")
  29 + # type = self.para.get("type")
30 30 host_name = self.para.get("host_name")
31 31 srcid = uuid.uuid1().__str__()
32 32
... ... @@ -35,7 +35,7 @@ class Api(ApiTemplate):
35 35 res["result"] = False
36 36 else:
37 37 monitorHost = MonitorHost(
38   - srcid=srcid, host=host, user=user, password=password, type=type, host_name=host_name)
  38 + srcid=srcid, host=host, host_name=host_name)
39 39 db.session.add(monitorHost)
40 40 db.session.commit()
41 41 res['data'] = {'host': host, 'srcid': srcid}
... ... @@ -53,21 +53,21 @@ class Api(ApiTemplate):
53 53 "type": "string",
54 54 "description": "主机地址",
55 55 "required": "true"},
56   - {"name": "user",
57   - "in": "formData",
58   - "type": "string",
59   - "description": "用户",
60   - "required": "true"},
61   - {"name": "passwd",
62   - "in": "formData",
63   - "type": "string",
64   - "description": "密码",
65   - "required": "true"},
66   - {"name": "type",
67   - "in": "formData",
68   - "type": "string",
69   - "description": "服务器类型",
70   - "required": "true"},
  56 + # {"name": "user",
  57 + # "in": "formData",
  58 + # "type": "string",
  59 + # "description": "用户",
  60 + # "required": "true"},
  61 + # {"name": "passwd",
  62 + # "in": "formData",
  63 + # "type": "string",
  64 + # "description": "密码",
  65 + # "required": "true"},
  66 + # {"name": "type",
  67 + # "in": "formData",
  68 + # "type": "string",
  69 + # "description": "服务器类型",
  70 + # "required": "true"},
71 71 {"name": "host_name",
72 72 "in": "formData",
73 73 "type": "string",
... ...
... ... @@ -18,14 +18,14 @@ class Api(ApiTemplate):
18 18 res["data"] = {}
19 19 try:
20 20 srcid = self.para.get("srcid") # server
21   - passwd = self.para.get("passwd")
  21 + passwd = None
22 22 host_name = self.para.get("host_name")
23 23 # Catalog.query.filter_by(guid=self.para.get("guid")).update({"name":self.para.get("name")})
24 24
25 25 if passwd or host_name:
26 26 monitor_host = MonitorHost.query.filter_by(srcid=srcid)
27   - if passwd:
28   - monitor_host.update({"password": passwd})
  27 + # if passwd:
  28 + # monitor_host.update({"password": passwd})
29 29 if host_name:
30 30 monitor_host.update({"host_name": host_name})
31 31 db.session.commit()
... ... @@ -50,10 +50,10 @@ class Api(ApiTemplate):
50 50 "in": "formData",
51 51 "type": "string",
52 52 "description": "主机名"},
53   - {"name": "passwd",
54   - "in": "formData",
55   - "type": "string",
56   - "description": "密码"}
  53 + # {"name": "passwd",
  54 + # "in": "formData",
  55 + # "type": "string",
  56 + # "description": "密码"}
57 57 ],
58 58 "responses": {
59 59 200: {
... ...
... ... @@ -49,7 +49,7 @@ def pull_metric():
49 49
50 50 type_list = ["cpu_per", "memory_per", "disk_per",
51 51 "disk_read", "disk_write","disk_read_count",
52   - "disk_write_count","network_sent","network_recv"]
  52 + "disk_write_count","network_send","network_recv"]
53 53 for type in type_list:
54 54 sample_data = get_sample_data(
55 55 metric_data, type, host_name)
... ...
注册登录 后发表评论