Compare commits
No commits in common. "cbd8a3dad9af26aad56b060d10e811b65f8d94d3" and "9b4af205845ca204968562ccecc9f256b0700777" have entirely different histories.
cbd8a3dad9
...
9b4af20584
|
@ -2,37 +2,32 @@ name: Docker Image CI
|
|||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/prometheus-frigate-exporter
|
||||
tags: type=semver,pattern={{version}}
|
||||
|
||||
- name: Set up QEMU
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
-
|
||||
name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
-
|
||||
name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: true
|
||||
file: Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/prometheus-frigate-exporter:latest
|
|
@ -1,7 +1,7 @@
|
|||
FROM alpine
|
||||
RUN --mount=type=cache,target=/var/cache apk update && apk add py3-prometheus-client
|
||||
COPY prometheus_frigate_exporter.py /prometheus_frigate_exporter.py
|
||||
ENTRYPOINT ["/usr/bin/python3", "/prometheus_frigate_exporter.py"]
|
||||
RUN apk update && apk add py3-prometheus-client
|
||||
COPY prometheus_frigate_exporter.py /var/python_scripts/prometheus_frigate_exporter.py
|
||||
CMD /usr/bin/python3 /var/python_scripts/prometheus_frigate_exporter.py $FRIGATE_STATS_URL
|
||||
|
||||
# docker build -t rhysbailey/prometheus-frigate-exporter .
|
||||
# docker push rhysbailey/prometheus-frigate-exporter:latest
|
||||
# docker push rhysbailey/prometheus-frigate-exporter:latest
|
10
README.md
10
README.md
|
@ -2,7 +2,7 @@
|
|||
|
||||
This is a docker container that runs a Prometheus exporter for [Frigate](https://frigate.video/) stats.
|
||||
|
||||
Tested with 0.13.0 and 0.14.0 Frigate docker images.
|
||||
Tested with 0.12.0 and 0.13.2 Frigate docker images.
|
||||
|
||||
Exports from Frigate API:
|
||||
|
||||
|
@ -313,10 +313,10 @@ frigate_storage_free_bytes{storage="/media/frigate/recordings"} 2e+09
|
|||
frigate_storage_free_bytes{storage="/tmp/cache"} 2e+09
|
||||
# HELP frigate_storage_mount_type_info Storage mount type
|
||||
# TYPE frigate_storage_mount_type_info gauge
|
||||
frigate_storage_mount_type_info{mount_type="tmpfs",storage="/dev/shm"} 1.0
|
||||
frigate_storage_mount_type_info{mount_type="ext4",storage="/media/frigate/clips"} 1.0
|
||||
frigate_storage_mount_type_info{mount_type="ext4",storage="/media/frigate/recordings"} 1.0
|
||||
frigate_storage_mount_type_info{mount_type="overlay",storage="/tmp/cache"} 1.0
|
||||
frigate_storage_mount_type_info{mount_type="tmpfs",storage="/"} 1.0
|
||||
frigate_storage_mount_type_info{mount_type="ext4",storage="/"} 1.0
|
||||
frigate_storage_mount_type_info{mount_type="ext4",storage="/"} 1.0
|
||||
frigate_storage_mount_type_info{mount_type="overlay",storage="/"} 1.0
|
||||
# HELP frigate_storage_total_bytes Storage total bytes
|
||||
# TYPE frigate_storage_total_bytes gauge
|
||||
frigate_storage_total_bytes{storage="/dev/shm"} 3e+09
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
buildContainerImage2()
|
File diff suppressed because it is too large
Load Diff
|
@ -13,9 +13,9 @@ from prometheus_client import start_http_server
|
|||
def add_metric(metric, label, stats, key, multiplier=1.0):
|
||||
try:
|
||||
string = str(stats[key])
|
||||
value = float(re.findall(r'-?\d*\.?\d*', string)[0])
|
||||
value = float(re.findall(r'\d+', string)[0])
|
||||
metric.add_metric(label, value * multiplier)
|
||||
except (KeyError, TypeError, IndexError, ValueError):
|
||||
except (KeyError, TypeError, IndexError):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -231,7 +231,7 @@ class CustomCollector(object):
|
|||
try:
|
||||
for gpu_name, gpu_stats in stats['gpu_usages'].items():
|
||||
add_metric(gpu_usages, [gpu_name], gpu_stats, 'gpu')
|
||||
add_metric(gpu_mem_usages, [gpu_name], gpu_stats, 'mem')
|
||||
add_metric(gpu_usages, [gpu_name], gpu_stats, 'mem')
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
@ -267,7 +267,7 @@ class CustomCollector(object):
|
|||
yield temperatures
|
||||
|
||||
storage_free = GaugeMetricFamily('frigate_storage_free_bytes', 'Storage free bytes', labels=['storage'])
|
||||
storage_mount_type = InfoMetricFamily('frigate_storage_mount_type', 'Storage mount type', labels=['mount_type', 'storage'])
|
||||
storage_mount_type = InfoMetricFamily('frigate_storage_mount_type', 'Storage mount type', labels=['storage'])
|
||||
storage_total = GaugeMetricFamily('frigate_storage_total_bytes', 'Storage total bytes', labels=['storage'])
|
||||
storage_used = GaugeMetricFamily('frigate_storage_used_bytes', 'Storage used bytes', labels=['storage'])
|
||||
|
||||
|
@ -276,7 +276,7 @@ class CustomCollector(object):
|
|||
add_metric(storage_free, [storage_path], storage_stats, 'free', 1e6) # MB to bytes
|
||||
add_metric(storage_total, [storage_path], storage_stats, 'total', 1e6) # MB to bytes
|
||||
add_metric(storage_used, [storage_path], storage_stats, 'used', 1e6) # MB to bytes
|
||||
storage_mount_type.add_metric(storage_path, {'mount_type': storage_stats['mount_type'], 'storage': storage_path})
|
||||
storage_mount_type.add_metric(storage_path, {'mount_type': storage_stats['mount_type']})
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in New Issue