pytbox 0.2.5__py3-none-any.whl → 0.2.6__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.
- pytbox/database/victoriametrics.py +27 -1
- pytbox/mingdao.py +3 -2
- {pytbox-0.2.5.dist-info → pytbox-0.2.6.dist-info}/METADATA +1 -1
- {pytbox-0.2.5.dist-info → pytbox-0.2.6.dist-info}/RECORD +7 -7
- {pytbox-0.2.5.dist-info → pytbox-0.2.6.dist-info}/WHEEL +0 -0
- {pytbox-0.2.5.dist-info → pytbox-0.2.6.dist-info}/entry_points.txt +0 -0
- {pytbox-0.2.5.dist-info → pytbox-0.2.6.dist-info}/top_level.txt +0 -0
|
@@ -374,4 +374,30 @@ class VictoriaMetrics:
|
|
|
374
374
|
labels['schedule_type'] = 'cron'
|
|
375
375
|
labels['schedule_cron'] = schedule_cron
|
|
376
376
|
r = self.insert(metric_name="cronjob_run_duration_seconds", labels=labels, value=duration_seconds)
|
|
377
|
-
return r
|
|
377
|
+
return r
|
|
378
|
+
|
|
379
|
+
def get_vmware_esxhostnames(self, vcenter: str=None) -> list:
|
|
380
|
+
'''
|
|
381
|
+
_summary_
|
|
382
|
+
'''
|
|
383
|
+
esxhostnames = []
|
|
384
|
+
query = f'vsphere_host_sys_uptime_latest{{vcenter="{vcenter}"}}'
|
|
385
|
+
metrics = self.query(query=query).data
|
|
386
|
+
for metric in metrics:
|
|
387
|
+
esxhostname = metric['metric']['esxhostname']
|
|
388
|
+
esxhostnames.append(esxhostname)
|
|
389
|
+
return esxhostnames
|
|
390
|
+
|
|
391
|
+
def get_vmware_cpu_usage(self, vcenter: str=None, esxhostname: str=None) -> float:
|
|
392
|
+
'''
|
|
393
|
+
_summary_
|
|
394
|
+
'''
|
|
395
|
+
query = f'vsphere_host_cpu_usage_average{{vcenter="{vcenter}", esxhostname="{esxhostname}"}}'
|
|
396
|
+
return self.query(query=query).data[0]['value'][1]
|
|
397
|
+
|
|
398
|
+
def get_vmware_memory_usage(self, vcenter: str=None, esxhostname: str=None) -> float:
|
|
399
|
+
'''
|
|
400
|
+
_summary_
|
|
401
|
+
'''
|
|
402
|
+
query = f'vsphere_host_mem_usage_average{{vcenter="{vcenter}", esxhostname="{esxhostname}"}}'
|
|
403
|
+
return self.query(query=query).data[0]['value'][1]
|
pytbox/mingdao.py
CHANGED
|
@@ -12,7 +12,7 @@ class Mingdao:
|
|
|
12
12
|
_summary_
|
|
13
13
|
'''
|
|
14
14
|
def __init__(self, app_key: str=None, sign: str=None, timeout: int=5):
|
|
15
|
-
self.base_url = "https://api.mingdao.com
|
|
15
|
+
self.base_url = "https://api.mingdao.com"
|
|
16
16
|
self.headers = {
|
|
17
17
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
18
18
|
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36'
|
|
@@ -20,7 +20,7 @@ class Mingdao:
|
|
|
20
20
|
self.timeout = timeout
|
|
21
21
|
self.app_key = app_key
|
|
22
22
|
self.sign = sign
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
def _build_api_request(self, api_url: str, method: Literal['GET', 'POST'], params: dict=None, body: dict=None, api_version: Literal['v1', 'v2']='v2'):
|
|
25
25
|
body['appKey'] = self.app_key
|
|
26
26
|
body['sign'] = self.sign
|
|
@@ -116,6 +116,7 @@ class Mingdao:
|
|
|
116
116
|
parse_control_id: bool=False,
|
|
117
117
|
page_size: int=100,
|
|
118
118
|
):
|
|
119
|
+
|
|
119
120
|
filters = []
|
|
120
121
|
if project_value:
|
|
121
122
|
filters.append({
|
|
@@ -2,7 +2,7 @@ pytbox/base.py,sha256=WC_p_PYMMpNq-5JRLyZoD74k-d2EQVmO4VjTvnI7VqE,4541
|
|
|
2
2
|
pytbox/cli.py,sha256=N775a0GK80IT2lQC2KRYtkZpIiu9UjavZmaxgNUgJhQ,160
|
|
3
3
|
pytbox/dida365.py,sha256=pUMPB9AyLZpTTbaz2LbtzdEpyjvuGf4YlRrCvM5sbJo,10545
|
|
4
4
|
pytbox/excel.py,sha256=f5XBLCeJbGgxytoSwVhbk03WLTzz8Q3IJ_RZ2-r_w6A,2334
|
|
5
|
-
pytbox/mingdao.py,sha256=
|
|
5
|
+
pytbox/mingdao.py,sha256=afEFJ9NKPdsmAZ4trBEJKl66fMj3Z8TWfaOcomNGhzw,6042
|
|
6
6
|
pytbox/notion.py,sha256=GRPdZAtyG2I6M6pCFbdrTWDACaPsp1RAXrY_RpWYKus,26572
|
|
7
7
|
pytbox/onepassword_connect.py,sha256=nD3xTl1ykQ4ct_dCRRF138gXCtk-phPfKYXuOn-P7Z8,3064
|
|
8
8
|
pytbox/onepassword_sa.py,sha256=08iUcYud3aEHuQcUsem9bWNxdXKgaxFbMy9yvtr-DZQ,6995
|
|
@@ -45,7 +45,7 @@ pytbox/cli/formatters/__init__.py,sha256=4o85w4j-A-O1oBLvuE9q8AFiJ2C9rvB3MIKsy5V
|
|
|
45
45
|
pytbox/cli/formatters/output.py,sha256=h5WhZlQk1rjmxEj88Jy5ODLcv6L5zfGUhks_3AWIkKU,5455
|
|
46
46
|
pytbox/common/__init__.py,sha256=3JWfgCQZKZuSH5NCE7OCzKwq82pkyop9l7sH5YSNyfU,122
|
|
47
47
|
pytbox/database/mongo.py,sha256=AhJ9nCAQHKrrcL-ujeonOwEf3x2QkmT2VhoCdglqJmU,3478
|
|
48
|
-
pytbox/database/victoriametrics.py,sha256
|
|
48
|
+
pytbox/database/victoriametrics.py,sha256=vUv2sRTvtdIRiZWrbLmAp6mrey8bJKVZc3bRFBpFnok,15660
|
|
49
49
|
pytbox/feishu/client.py,sha256=kwGLseGT_iQUFmSqpuS2_77WmxtHstD64nXvktuQ3B4,5865
|
|
50
50
|
pytbox/feishu/endpoints.py,sha256=z3nPOZPC2JGDJlO7SusWBpRA33hZZ4Z-GBhI6F8L_u4,40240
|
|
51
51
|
pytbox/feishu/errors.py,sha256=79qFAHZw7jDj3gnWAjI1-W4tB0q1_aSfdjee4xzXeuI,1179
|
|
@@ -65,8 +65,8 @@ pytbox/utils/response.py,sha256=kXjlwt0WVmLRam2eu1shzX2cQ7ux4cCQryaPGYwle5g,1247
|
|
|
65
65
|
pytbox/utils/richutils.py,sha256=OT9_q2Q1bthzB0g1GlhZVvM4ZAepJRKL6a_Vsr6vEqo,487
|
|
66
66
|
pytbox/utils/timeutils.py,sha256=uSKgwt20mVcgIGKLsH2tNum8v3rcpzgmBibPvyPQFgM,20433
|
|
67
67
|
pytbox/win/ad.py,sha256=-3pWfL3dElz-XoO4j4M9lrgu3KJtlhrS9gCWJBpafAU,1147
|
|
68
|
-
pytbox-0.2.
|
|
69
|
-
pytbox-0.2.
|
|
70
|
-
pytbox-0.2.
|
|
71
|
-
pytbox-0.2.
|
|
72
|
-
pytbox-0.2.
|
|
68
|
+
pytbox-0.2.6.dist-info/METADATA,sha256=imFjJeLVrjd09kC9dBKWYtVIGXH4hphvPh7mTAQTw9A,6319
|
|
69
|
+
pytbox-0.2.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
70
|
+
pytbox-0.2.6.dist-info/entry_points.txt,sha256=YaTOJ2oPjOiv2SZwY0UC-UA9QS2phRH1oMvxGnxO0Js,43
|
|
71
|
+
pytbox-0.2.6.dist-info/top_level.txt,sha256=YADgWue-Oe128ptN3J2hS3GB0Ncc5uZaSUM3e1rwswE,7
|
|
72
|
+
pytbox-0.2.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|