add stream_on metric
This commit is contained in:
parent
ae72627756
commit
17986590d6
@ -8,6 +8,7 @@ from prometheus_client import start_http_server, Counter, Gauge
|
|||||||
|
|
||||||
cut_count = Counter('cut_count', 'Total number of jebnięcie')
|
cut_count = Counter('cut_count', 'Total number of jebnięcie')
|
||||||
machine_on = Gauge('machine_on', 'Current machine engine status')
|
machine_on = Gauge('machine_on', 'Current machine engine status')
|
||||||
|
stream_on = Gauge('stream_on', 'Current camera stream status')
|
||||||
|
|
||||||
start_http_server(8888)
|
start_http_server(8888)
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ def dist(pos1, pos2):
|
|||||||
def run(path):
|
def run(path):
|
||||||
gui = 'DISPLAY' in os.environ
|
gui = 'DISPLAY' in os.environ
|
||||||
|
|
||||||
|
stream_on.set(0)
|
||||||
machine_on.set(0)
|
machine_on.set(0)
|
||||||
|
|
||||||
# Create a VideoCapture object and read from input file
|
# Create a VideoCapture object and read from input file
|
||||||
@ -31,6 +33,7 @@ def run(path):
|
|||||||
raise Exception('VideoCapture not opened')
|
raise Exception('VideoCapture not opened')
|
||||||
|
|
||||||
print('Opened')
|
print('Opened')
|
||||||
|
stream_on.set(1)
|
||||||
|
|
||||||
spots = []
|
spots = []
|
||||||
|
|
||||||
@ -120,4 +123,5 @@ while True:
|
|||||||
run(sys.argv[1])
|
run(sys.argv[1])
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
print(exc)
|
print(exc)
|
||||||
|
stream_on.set(0)
|
||||||
time.sleep(5.0)
|
time.sleep(5.0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user