pytbox 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pytbox might be problematic. Click here for more details.
- pytbox/database/victoriametrics.py +26 -4
- {pytbox-0.2.2.dist-info → pytbox-0.2.4.dist-info}/METADATA +1 -1
- {pytbox-0.2.2.dist-info → pytbox-0.2.4.dist-info}/RECORD +6 -6
- {pytbox-0.2.2.dist-info → pytbox-0.2.4.dist-info}/WHEEL +0 -0
- {pytbox-0.2.2.dist-info → pytbox-0.2.4.dist-info}/entry_points.txt +0 -0
- {pytbox-0.2.2.dist-info → pytbox-0.2.4.dist-info}/top_level.txt +0 -0
|
@@ -204,6 +204,28 @@ class VictoriaMetrics:
|
|
|
204
204
|
|
|
205
205
|
return ReturnResponse(code=code, msg=msg, data=data)
|
|
206
206
|
|
|
207
|
+
def check_unreachable_ping_result(self, dev_file: str='') -> ReturnResponse:
|
|
208
|
+
'''
|
|
209
|
+
检查ping结果
|
|
210
|
+
|
|
211
|
+
Args:
|
|
212
|
+
target (str): 目标地址
|
|
213
|
+
last_minute (int, optional): 最近多少分钟. Defaults to 10.
|
|
214
|
+
env (str, optional): 环境. Defaults to 'prod'.
|
|
215
|
+
dev_file (str, optional): 开发文件. Defaults to ''.
|
|
216
|
+
|
|
217
|
+
Returns:
|
|
218
|
+
ReturnResponse:
|
|
219
|
+
code = 0 正常, code = 1 异常, code = 2 没有查询到数据, 建议将其判断为正常
|
|
220
|
+
'''
|
|
221
|
+
query = "ping_result_code == 1"
|
|
222
|
+
|
|
223
|
+
if self.env == 'dev':
|
|
224
|
+
r = load_dev_file(dev_file)
|
|
225
|
+
else:
|
|
226
|
+
r = self.query(query=query)
|
|
227
|
+
return r
|
|
228
|
+
|
|
207
229
|
def check_interface_rate(self,
|
|
208
230
|
direction: Literal['in', 'out'],
|
|
209
231
|
sysName: str,
|
|
@@ -251,9 +273,9 @@ class VictoriaMetrics:
|
|
|
251
273
|
ReturnResponse: _description_
|
|
252
274
|
'''
|
|
253
275
|
if direction == 'in':
|
|
254
|
-
query = f'avg_over_time(rate(snmp_interface_ifHCInOctets{{sysName="{sysname}", ifName="{ifname}"}}[{last_minutes}m]) * 8 [{last_hours}h:]) / 1e6'
|
|
276
|
+
query = f'avg_over_time((rate(snmp_interface_ifHCInOctets{{sysName="{sysname}", ifName="{ifname}"}}[{last_minutes}m]) * 8) [{last_hours}h:]) / 1e6'
|
|
255
277
|
else:
|
|
256
|
-
query = f'avg_over_time(rate(snmp_interface_ifHCOutOctets{{sysName="{sysname}", ifName="{ifname}"}}[{last_minutes}m]) * 8 [{last_hours}h:]) / 1e6'
|
|
278
|
+
query = f'avg_over_time((rate(snmp_interface_ifHCOutOctets{{sysName="{sysname}", ifName="{ifname}"}}[{last_minutes}m]) * 8) [{last_hours}h:]) / 1e6'
|
|
257
279
|
r = self.query(query)
|
|
258
280
|
try:
|
|
259
281
|
rate = r.data[0]['value'][1]
|
|
@@ -282,9 +304,9 @@ class VictoriaMetrics:
|
|
|
282
304
|
ReturnResponse: _description_
|
|
283
305
|
'''
|
|
284
306
|
if direction == 'in':
|
|
285
|
-
query = f'max_over_time(rate(snmp_interface_ifHCInOctets{{sysName="{sysname}", ifName="{ifname}"}}[{last_minutes}m]) * 8 [{last_hours}h:]) / 1e6'
|
|
307
|
+
query = f'max_over_time((rate(snmp_interface_ifHCInOctets{{sysName="{sysname}", ifName="{ifname}"}}[{last_minutes}m]) * 8) [{last_hours}h:]) / 1e6'
|
|
286
308
|
else:
|
|
287
|
-
query = f'max_over_time(rate(snmp_interface_ifHCOutOctets{{sysName="{sysname}", ifName="{ifname}"}}[{last_minutes}m]) * 8 [{last_hours}h:]) / 1e6'
|
|
309
|
+
query = f'max_over_time((rate(snmp_interface_ifHCOutOctets{{sysName="{sysname}", ifName="{ifname}"}}[{last_minutes}m]) * 8) [{last_hours}h:]) / 1e6'
|
|
288
310
|
r = self.query(query)
|
|
289
311
|
try:
|
|
290
312
|
rate = r.data[0]['value'][1]
|
|
@@ -43,7 +43,7 @@ pytbox/cli/formatters/__init__.py,sha256=4o85w4j-A-O1oBLvuE9q8AFiJ2C9rvB3MIKsy5V
|
|
|
43
43
|
pytbox/cli/formatters/output.py,sha256=h5WhZlQk1rjmxEj88Jy5ODLcv6L5zfGUhks_3AWIkKU,5455
|
|
44
44
|
pytbox/common/__init__.py,sha256=3JWfgCQZKZuSH5NCE7OCzKwq82pkyop9l7sH5YSNyfU,122
|
|
45
45
|
pytbox/database/mongo.py,sha256=AhJ9nCAQHKrrcL-ujeonOwEf3x2QkmT2VhoCdglqJmU,3478
|
|
46
|
-
pytbox/database/victoriametrics.py,sha256=
|
|
46
|
+
pytbox/database/victoriametrics.py,sha256=EqKJag3s-E0V4Xb3vQNc82w6tOth2Q0_0dC15AKOgRs,15344
|
|
47
47
|
pytbox/feishu/client.py,sha256=kwGLseGT_iQUFmSqpuS2_77WmxtHstD64nXvktuQ3B4,5865
|
|
48
48
|
pytbox/feishu/endpoints.py,sha256=z3nPOZPC2JGDJlO7SusWBpRA33hZZ4Z-GBhI6F8L_u4,40240
|
|
49
49
|
pytbox/feishu/errors.py,sha256=79qFAHZw7jDj3gnWAjI1-W4tB0q1_aSfdjee4xzXeuI,1179
|
|
@@ -63,8 +63,8 @@ pytbox/utils/response.py,sha256=kXjlwt0WVmLRam2eu1shzX2cQ7ux4cCQryaPGYwle5g,1247
|
|
|
63
63
|
pytbox/utils/richutils.py,sha256=OT9_q2Q1bthzB0g1GlhZVvM4ZAepJRKL6a_Vsr6vEqo,487
|
|
64
64
|
pytbox/utils/timeutils.py,sha256=uSKgwt20mVcgIGKLsH2tNum8v3rcpzgmBibPvyPQFgM,20433
|
|
65
65
|
pytbox/win/ad.py,sha256=-3pWfL3dElz-XoO4j4M9lrgu3KJtlhrS9gCWJBpafAU,1147
|
|
66
|
-
pytbox-0.2.
|
|
67
|
-
pytbox-0.2.
|
|
68
|
-
pytbox-0.2.
|
|
69
|
-
pytbox-0.2.
|
|
70
|
-
pytbox-0.2.
|
|
66
|
+
pytbox-0.2.4.dist-info/METADATA,sha256=29ykO-NI1Kbh7ceqr8--Lzx7_2hz-Cu-croz2RhdHOU,6319
|
|
67
|
+
pytbox-0.2.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
68
|
+
pytbox-0.2.4.dist-info/entry_points.txt,sha256=YaTOJ2oPjOiv2SZwY0UC-UA9QS2phRH1oMvxGnxO0Js,43
|
|
69
|
+
pytbox-0.2.4.dist-info/top_level.txt,sha256=YADgWue-Oe128ptN3J2hS3GB0Ncc5uZaSUM3e1rwswE,7
|
|
70
|
+
pytbox-0.2.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|