commit
ba203cd8b7
|
@ -6,6 +6,7 @@ import re
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
def add_metric(metric, label, stats, key, multiplier=1.0):
|
def add_metric(metric, label, stats, key, multiplier=1.0):
|
||||||
|
@ -200,7 +201,7 @@ if __name__ == '__main__':
|
||||||
logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.INFO)
|
logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.INFO)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
url = sys.argv[1]
|
url = str(os.environ.get('FRIGATE_STATS_URL', 'http://localhost:5000/api/stats'))
|
||||||
REGISTRY.register(CustomCollector(url))
|
REGISTRY.register(CustomCollector(url))
|
||||||
except IndexError:
|
except IndexError:
|
||||||
logging.error(
|
logging.error(
|
||||||
|
@ -208,10 +209,11 @@ if __name__ == '__main__':
|
||||||
"e.g. FRIGATE_STATS_URL=http://<your-frigate-ip>:5000/api/stats")
|
"e.g. FRIGATE_STATS_URL=http://<your-frigate-ip>:5000/api/stats")
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
start_http_server(9100)
|
port = int(os.environ.get('PORT', 9100))
|
||||||
|
start_http_server(port)
|
||||||
|
|
||||||
logging.info('Started, Frigate API URL: ' + sys.argv[1])
|
logging.info('Started, Frigate API URL: ' + url)
|
||||||
logging.info('Metrics at: http://localhost:9100/metrics')
|
logging.info('Metrics at: http://localhost:' + str(port) + '/metrics')
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
Loading…
Reference in New Issue