jool-exporter 21.6.15__py3-none-any.whl → 26.2.3__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.
@@ -1,22 +1,29 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: jool-exporter
3
- Version: 21.6.15
3
+ Version: 26.2.3
4
4
  Summary: Export `jool stats display` for prometheus
5
5
  Home-page: http://github.com/cooperlees/jool-exporter
6
6
  Author: Cooper Lees
7
7
  Author-email: me@cooperlees.com
8
- License: BSD
9
- Platform: UNKNOWN
8
+ License: BSD-3-Clause
10
9
  Classifier: Development Status :: 3 - Alpha
11
- Classifier: License :: OSI Approved :: BSD License
12
10
  Classifier: Programming Language :: Python :: 3
13
11
  Classifier: Programming Language :: Python :: 3 :: Only
14
- Classifier: Programming Language :: Python :: 3.8
15
- Classifier: Programming Language :: Python :: 3.9
16
12
  Requires-Python: >=3.8
17
13
  Description-Content-Type: text/markdown
18
14
  License-File: LICENSE
19
- Requires-Dist: prometheus-client
15
+ Requires-Dist: prometheus_client
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: classifier
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: license
23
+ Dynamic: license-file
24
+ Dynamic: requires-dist
25
+ Dynamic: requires-python
26
+ Dynamic: summary
20
27
 
21
28
  # jool-exporter
22
29
 
@@ -175,5 +182,3 @@ We use Facebook's [ptr](https://github.com/facebookincubator/ptr) for testing.
175
182
  It is driven by config in setup.py.
176
183
 
177
184
 
178
-
179
-
@@ -0,0 +1,7 @@
1
+ jool_exporter.py,sha256=1cj9mmU8_JPj79dO-AAQ0msMbBMhFAD1TYowexFdNHw,4134
2
+ jool_exporter-26.2.3.dist-info/licenses/LICENSE,sha256=Nk_wwh_-xaIa8gwgiHAnfZqw8O0AaIawc2Wle2JoUCg,1321
3
+ jool_exporter-26.2.3.dist-info/METADATA,sha256=sZUKclHcfHcC4Fo7NLiT9xuVNuUruID4W9wctQfySiA,8173
4
+ jool_exporter-26.2.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
5
+ jool_exporter-26.2.3.dist-info/entry_points.txt,sha256=t84r-KaB7nTKr0GEpcUco1ueXh39-56igLzN49ME8vw,53
6
+ jool_exporter-26.2.3.dist-info/top_level.txt,sha256=SmhUI8tDD36vZuSOg0nbROONpGvBfjVH5AjwfnnVIlI,14
7
+ jool_exporter-26.2.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.36.2)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,3 +1,2 @@
1
1
  [console_scripts]
2
2
  jool-exporter = jool_exporter:main
3
-
jool_exporter.py CHANGED
@@ -14,19 +14,26 @@ from socket import getfqdn
14
14
  from subprocess import CompletedProcess, PIPE, run
15
15
  from typing import Generator, Union
16
16
 
17
- from prometheus_client import start_http_server # type: ignore
18
- from prometheus_client.core import GaugeMetricFamily, REGISTRY # type: ignore
19
-
17
+ from prometheus_client import start_http_server
18
+ from prometheus_client.core import GaugeMetricFamily, REGISTRY
19
+ from prometheus_client.registry import Collector
20
20
 
21
+ DEFAULT_CLI = "jool"
22
+ DEFAULT_INSTANCE = "default"
23
+ DEFAULT_ADDR = "0.0.0.0"
21
24
  DEFAULT_PORT = 6971
22
25
  HOSTNAME = getfqdn()
23
26
  LOG = logging.getLogger(__name__)
24
27
 
25
28
 
26
- class JoolCollector:
29
+ class JoolCollector(Collector):
27
30
  key_prefix = "jool"
28
31
  labels = ["hostname"]
29
32
 
33
+ def __init__(self, args: argparse.Namespace):
34
+ super().__init__()
35
+ self.args = args
36
+
30
37
  def _handle_counter(
31
38
  self, category: str, value: float, explanation: str
32
39
  ) -> GaugeMetricFamily:
@@ -62,7 +69,8 @@ class JoolCollector:
62
69
 
63
70
  def run_jool(self) -> Union[str, CompletedProcess]:
64
71
  cmd = [
65
- "jool",
72
+ self.args.cli,
73
+ f"-i {self.args.instance}",
66
74
  "stats",
67
75
  "display",
68
76
  "--csv",
@@ -89,6 +97,12 @@ def main() -> int:
89
97
  parser = argparse.ArgumentParser(
90
98
  description="Export `jool stats display` for prometheus"
91
99
  )
100
+ parser.add_argument(
101
+ "-a",
102
+ "--addr",
103
+ default=DEFAULT_ADDR,
104
+ help=f"Address to bind socket to [Default = {DEFAULT_ADDR}]",
105
+ )
92
106
  parser.add_argument(
93
107
  "-d", "--debug", action="store_true", help="Verbose debug output"
94
108
  )
@@ -99,12 +113,24 @@ def main() -> int:
99
113
  default=DEFAULT_PORT,
100
114
  help=f"Port to run webserver on [Default = {DEFAULT_PORT}]",
101
115
  )
116
+ parser.add_argument(
117
+ "-i",
118
+ "--instance",
119
+ default=DEFAULT_INSTANCE,
120
+ help=f"Instance to listen to [Default = {DEFAULT_INSTANCE}]",
121
+ )
122
+ parser.add_argument(
123
+ "-c",
124
+ "--cli",
125
+ default=DEFAULT_CLI,
126
+ help=f"Cli to use (for instance jool or jool_siit) [Default = {DEFAULT_CLI}]",
127
+ )
102
128
  args = parser.parse_args()
103
129
  _handle_debug(args.debug)
104
130
 
105
131
  LOG.info(f"Starting {sys.argv[0]}")
106
- start_http_server(args.port)
107
- REGISTRY.register(JoolCollector())
132
+ start_http_server(args.port, args.addr)
133
+ REGISTRY.register(JoolCollector(args))
108
134
  LOG.info(f"jool prometheus exporter - listening on {args.port}")
109
135
  try:
110
136
  while True:
@@ -1,7 +0,0 @@
1
- jool_exporter.py,sha256=prKXT3yKwO3HlqKjEOpvO2_dkjxl4HkhaEAEMFd4t7s,3355
2
- jool_exporter-21.6.15.dist-info/LICENSE,sha256=Nk_wwh_-xaIa8gwgiHAnfZqw8O0AaIawc2Wle2JoUCg,1321
3
- jool_exporter-21.6.15.dist-info/METADATA,sha256=Vqm8O1k3wql651VwvkbfAX4LrkoesE52yEP0o7MWRks,8100
4
- jool_exporter-21.6.15.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
5
- jool_exporter-21.6.15.dist-info/entry_points.txt,sha256=QpzQw2sQ6T7pdUNvXMn1p8tBgElBe4PvCjKY2trUnVQ,54
6
- jool_exporter-21.6.15.dist-info/top_level.txt,sha256=SmhUI8tDD36vZuSOg0nbROONpGvBfjVH5AjwfnnVIlI,14
7
- jool_exporter-21.6.15.dist-info/RECORD,,