mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-04 18:25:22 +03:00
wip
This commit is contained in:
parent
cb24625fb3
commit
92b5606ed4
28
frigate/prometheus_exporter2.py
Normal file
28
frigate/prometheus_exporter2.py
Normal file
@ -0,0 +1,28 @@
|
||||
import json
|
||||
from urllib.request import urlopen
|
||||
from prometheus_client import CollectorRegistry
|
||||
from prometheus_client.metrics_core import GaugeMetricFamily
|
||||
from requester import Requester
|
||||
|
||||
|
||||
def setupRegistry():
|
||||
myregistry = CollectorRegistry()
|
||||
myregistry.register(CustomCollector())
|
||||
return myregistry
|
||||
|
||||
|
||||
class CustomCollector():
|
||||
def __init__(self):
|
||||
self.stats_url = "http://localhost:5000/api/stats"
|
||||
|
||||
|
||||
def collect(self):
|
||||
|
||||
|
||||
data = json.loads(urlopen(self.url).read())
|
||||
|
||||
for k, d in data.items():
|
||||
print("".format(k, d))
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user