Update prometheus_frigate_exporter.py
parent
9b4af20584
commit
e3dd5a41f4
|
@ -13,9 +13,9 @@ from prometheus_client import start_http_server
|
||||||
def add_metric(metric, label, stats, key, multiplier=1.0):
|
def add_metric(metric, label, stats, key, multiplier=1.0):
|
||||||
try:
|
try:
|
||||||
string = str(stats[key])
|
string = str(stats[key])
|
||||||
value = float(re.findall(r'\d+', string)[0])
|
value = float(re.findall(r'-?\d*\.?\d*', string)[0])
|
||||||
metric.add_metric(label, value * multiplier)
|
metric.add_metric(label, value * multiplier)
|
||||||
except (KeyError, TypeError, IndexError):
|
except (KeyError, TypeError, IndexError, ValueError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue