pytbox 0.0.6__py3-none-any.whl → 0.0.7__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.

@@ -26,8 +26,19 @@ class BuildConfig:
26
26
  self.instances = load_config_by_file(instances)
27
27
  self.output_dir = output_dir
28
28
 
29
-
30
-
29
+ def _get_template(self, template_name):
30
+ return env.get_template(template_name)
31
+
32
+ def common(self, input_name):
33
+ template = self._get_template(f'input.{input_name}/{input_name}.toml.j2')
34
+ render_data = template.render()
35
+ target_dir = Path(self.output_dir) / f'input.{input_name}'
36
+ if not target_dir.exists():
37
+ target_dir.mkdir(parents=True, exist_ok=True)
38
+
39
+ with open(Path(self.output_dir) / f'input.{input_name}' / f'{input_name}.toml', 'w', encoding='utf-8') as f:
40
+ f.write(render_data)
41
+
31
42
  def ping(self):
32
43
  instances = self.instances['ping']['instance']
33
44
  render_data = ping_template.render(instances=instances)
@@ -44,10 +55,26 @@ class BuildConfig:
44
55
  target_dir = Path(self.output_dir) / 'input.prometheus'
45
56
  if not target_dir.exists():
46
57
  target_dir.mkdir(parents=True, exist_ok=True)
47
-
48
58
  with open(Path(self.output_dir) / 'input.prometheus' / 'prometheus.toml', 'w', encoding='utf-8') as f:
49
59
  f.write(render_data)
50
60
 
61
+ def vsphere(self):
62
+ template = self._get_template('input.vsphere/vsphere.toml.j2')
63
+ instances = self.instances['vsphere']['instance']
64
+ print(instances)
65
+ render_data = template.render(instances=instances)
66
+ target_dir = Path(self.output_dir) / 'input.vsphere'
67
+ if not target_dir.exists():
68
+ target_dir.mkdir(parents=True, exist_ok=True)
69
+ with open(Path(self.output_dir) / 'input.vsphere' / 'vsphere.toml', 'w', encoding='utf-8') as f:
70
+ f.write(render_data)
71
+
51
72
  def run(self):
73
+ # self.common('cpu')
74
+ # self.common('mem')
75
+ # self.common('net')
76
+ # self.common('disk')
77
+ # self.common('diskio')
78
+ self.vsphere()
52
79
  # self.ping()
53
- self.prometheus()
80
+ # self.prometheus()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytbox
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: A collection of Python integrations and utilities (Feishu, Dida365, VictoriaMetrics, ...)
5
5
  Author-email: mingming hou <houm01@foxmail.com>
6
6
  License: MIT
@@ -6,7 +6,7 @@ pytbox/onepassword_sa.py,sha256=08iUcYud3aEHuQcUsem9bWNxdXKgaxFbMy9yvtr-DZQ,6995
6
6
  pytbox/alert/alert_handler.py,sha256=FePPQS4LyGphSJ0QMv0_pLWaXxEqsRlcTKMfUjtsNfk,5048
7
7
  pytbox/alert/ping.py,sha256=g36X0U3U8ndZqfpVIcuoxJJ0X5gST3I_IwjTQC1roHA,779
8
8
  pytbox/alicloud/sls.py,sha256=UR4GdI86dCKAFI2xt_1DELu7q743dpd3xrYtuNpfC5A,4065
9
- pytbox/categraf/build_config.py,sha256=PQkxTgc8AORQJbkOrd-kJ8IC4USnp4IFQA9LZW0LBI4,1695
9
+ pytbox/categraf/build_config.py,sha256=DBBKjqCJZ3a6BbVuJbN_C573Z-K3p43iDbB9Ahaw3Tw,2944
10
10
  pytbox/cli/__init__.py,sha256=5ID4-oXrMsHFcfDsQeXDYeThPOuQ1Fl2x2kHWfgfOEw,67
11
11
  pytbox/cli/main.py,sha256=S-DBp-1d0BCpvZ7jRE3bYmhKSiPpCJHFGsbdVF485BY,322
12
12
  pytbox/cli/categraf/__init__.py,sha256=HfhDhWiWEuT5e6fXb6fs7UgoZPwn9WQ1wdFoza2muaI,96
@@ -32,8 +32,8 @@ pytbox/utils/ping_checker.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,
32
32
  pytbox/utils/response.py,sha256=kXjlwt0WVmLRam2eu1shzX2cQ7ux4cCQryaPGYwle5g,1247
33
33
  pytbox/utils/richutils.py,sha256=OT9_q2Q1bthzB0g1GlhZVvM4ZAepJRKL6a_Vsr6vEqo,487
34
34
  pytbox/utils/timeutils.py,sha256=XbK2KB-SVi7agNqoQN7i40wysrZvrGuwebViv1Cw-Ok,20226
35
- pytbox-0.0.6.dist-info/METADATA,sha256=XTF_u4mj5KSUyGRNBtrFiA-UHffcS0gZwsYH62DPKl4,6245
36
- pytbox-0.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
- pytbox-0.0.6.dist-info/entry_points.txt,sha256=YaTOJ2oPjOiv2SZwY0UC-UA9QS2phRH1oMvxGnxO0Js,43
38
- pytbox-0.0.6.dist-info/top_level.txt,sha256=YADgWue-Oe128ptN3J2hS3GB0Ncc5uZaSUM3e1rwswE,7
39
- pytbox-0.0.6.dist-info/RECORD,,
35
+ pytbox-0.0.7.dist-info/METADATA,sha256=veBpwrGnlKlCI5E9XVzVYmW2dVsLQXqSgeMXe0F2cXU,6245
36
+ pytbox-0.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
+ pytbox-0.0.7.dist-info/entry_points.txt,sha256=YaTOJ2oPjOiv2SZwY0UC-UA9QS2phRH1oMvxGnxO0Js,43
38
+ pytbox-0.0.7.dist-info/top_level.txt,sha256=YADgWue-Oe128ptN3J2hS3GB0Ncc5uZaSUM3e1rwswE,7
39
+ pytbox-0.0.7.dist-info/RECORD,,
File without changes