This commit is contained in:
parent
d2f37ec192
commit
c3f225847a
30
camdetect.py
30
camdetect.py
@ -47,15 +47,10 @@ counter_tx_events = Counter(
|
|||||||
counter_eos = Counter(
|
counter_eos = Counter(
|
||||||
"camtiler_client_eos",
|
"camtiler_client_eos",
|
||||||
"Count of End of Stream occurrences")
|
"Count of End of Stream occurrences")
|
||||||
counter_timeout_errors = Counter(
|
counter_connection_errors = Counter(
|
||||||
"camtiler_client_timeout_errors",
|
"camtiler_client_connection_errors",
|
||||||
"Upstream connection timeout errors")
|
"Upstream connection errors",
|
||||||
counter_cancelled_errors = Counter(
|
["error"])
|
||||||
"camtiler_client_cancelled_errors",
|
|
||||||
"Upstream connection cancelled errors")
|
|
||||||
counter_incomplete_read_errors = Counter(
|
|
||||||
"camtiler_client_incomplete_read_errors",
|
|
||||||
"Upstream incomplete read errors")
|
|
||||||
counter_movement_frames = Counter(
|
counter_movement_frames = Counter(
|
||||||
"camtiler_client_movement_frames",
|
"camtiler_client_movement_frames",
|
||||||
"Frames with movement detected in them")
|
"Frames with movement detected in them")
|
||||||
@ -147,17 +142,16 @@ async def client_connect(resp):
|
|||||||
|
|
||||||
|
|
||||||
async def client():
|
async def client():
|
||||||
print("Opening upstream connection...")
|
while True:
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(connect=5, sock_read=2)) as session:
|
||||||
async with session.get(url) as resp:
|
print("Opening upstream connection to %s" % url)
|
||||||
try:
|
try:
|
||||||
|
async with session.get(url) as resp:
|
||||||
await client_connect(resp)
|
await client_connect(resp)
|
||||||
except asyncio.TimeoutError:
|
except aiohttp.ClientConnectorError as e:
|
||||||
counter_timeout_errors.inc()
|
counter_connection_errors.labels(error=e.strerror).inc()
|
||||||
except asyncio.CancelledError:
|
except asyncio.exceptions.TimeoutError:
|
||||||
counter_cancelled_errors.inc()
|
counter_connection_errors.labels(error="Timeout").inc()
|
||||||
except asyncio.IncompleteReadError:
|
|
||||||
counter_incomplete_read_errors.inc()
|
|
||||||
|
|
||||||
|
|
||||||
app = Sanic("lease")
|
app = Sanic("lease")
|
||||||
|
9
config/prometheus.yml
Normal file
9
config/prometheus.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
global:
|
||||||
|
scrape_interval: 1s
|
||||||
|
|
||||||
|
scrape_configs:
|
||||||
|
- job_name: camtiler
|
||||||
|
static_configs:
|
||||||
|
- targets:
|
||||||
|
- 127.0.0.1:5000
|
||||||
|
|
11
mongo-init.sh
Normal file
11
mongo-init.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
mongo <<EOF
|
||||||
|
|
||||||
|
rs.initiate({
|
||||||
|
_id: 'rs0',
|
||||||
|
members: [
|
||||||
|
{_id: 0, host: '127.0.0.1:27017'}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
EOF
|
Loading…
Reference in New Issue
Block a user