提交 3538b30667011f5ffc4abfee49db5e1a57c5bbc8
Merge branch 'master' of http://gitlab.ctune.cn/weijunh/DMapManager
2022.01.12
正在显示
4 个修改的文件
包含
57 行增加
和
53 行删除
... | ... | @@ -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: { | ... | ... |
... | ... | @@ -48,8 +48,8 @@ def pull_metric(): |
48 | 48 | continue |
49 | 49 | |
50 | 50 | type_list = ["cpu_per", "memory_per", "disk_per", |
51 | - "disk_read", "disk_write","disk_read_count", | |
52 | - "disk_write_count","network_sent","network_recv"] | |
51 | + "disk_read", "disk_write", "disk_read_count", | |
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) |
... | ... | @@ -88,28 +88,30 @@ def start_schedule(): |
88 | 88 | def get_sample_data(orginal, name, host): |
89 | 89 | res = [] |
90 | 90 | size = len(orginal) |
91 | - orginal_stamp = {'head': 1, 'tail': size} | |
91 | + # orginal_stamp = {'head': 1, 'tail': size} | |
92 | 92 | if size > 1: |
93 | - stamp = {'P0': 1, | |
94 | - 'P50': math.floor(0.5*size), | |
95 | - 'P90': math.floor(0.9*size), | |
96 | - 'P95': math.floor(0.95*size), | |
97 | - # 'P99': math.floor(0.99*size), | |
98 | - 'P100': size} | |
93 | + stamp = { | |
94 | + # 'P0': 1, | |
95 | + 'P50': math.floor(0.5*size), | |
96 | + # 'P90': math.floor(0.9*size), | |
97 | + 'P95': math.floor(0.95*size), | |
98 | + # 'P99': math.floor(0.99*size), | |
99 | + 'P100': size} | |
99 | 100 | elif size == 1: |
100 | - stamp = {'P0': 1, | |
101 | - 'P50': size, | |
102 | - 'P90': size, | |
103 | - 'P95': size, | |
104 | - # 'P99': size, | |
105 | - 'P100': size} | |
101 | + stamp = { | |
102 | + # 'P0': 1, | |
103 | + 'P50': size, | |
104 | + # 'P90': size, | |
105 | + 'P95': size, | |
106 | + # 'P99': size, | |
107 | + 'P100': size} | |
106 | 108 | else: |
107 | 109 | return res |
108 | 110 | |
109 | - for key in dict.keys(orginal_stamp): | |
110 | - cur_data = orginal[orginal_stamp[key]-1] | |
111 | - info = get_data(key, host, name, cur_data) | |
112 | - res.append(info) | |
111 | + # for key in dict.keys(orginal_stamp): | |
112 | + # cur_data = orginal[orginal_stamp[key]-1] | |
113 | + # info = get_data(key, host, name, cur_data) | |
114 | + # res.append(info) | |
113 | 115 | |
114 | 116 | data = sorted(orginal, key=lambda x: x[name]) |
115 | 117 | for key in dict.keys(stamp): | ... | ... |
请
注册
或
登录
后发表评论