export camera audio stats

main
Rhys Bailey 2024-01-01 12:44:39 +11:00
parent 0acc7a990c
commit d2d7878ecd
1 changed files with 13 additions and 5 deletions

View File

@ -60,16 +60,20 @@ class CustomCollector(object):
labels=['pid', 'name', 'process', 'type', 'cmdline']) labels=['pid', 'name', 'process', 'type', 'cmdline'])
# camera stats # camera stats
audio_dBFS = GaugeMetricFamily('frigate_audio_dBFS', 'Audio dBFS for camera',
labels=['camera_name'])
audio_rms = GaugeMetricFamily('frigate_audio_rms', 'Audio RMS for camera',
labels=['camera_name'])
camera_fps = GaugeMetricFamily('frigate_camera_fps', 'Frames per second being consumed from your camera.', camera_fps = GaugeMetricFamily('frigate_camera_fps', 'Frames per second being consumed from your camera.',
labels=['camera_name']) labels=['camera_name'])
detection_enabled = GaugeMetricFamily('frigate_detection_enabled', 'Detection enabled for camera',
labels=['camera_name'])
detection_fps = GaugeMetricFamily('frigate_detection_fps', 'Number of times detection is run per second.', detection_fps = GaugeMetricFamily('frigate_detection_fps', 'Number of times detection is run per second.',
labels=['camera_name']) labels=['camera_name'])
process_fps = GaugeMetricFamily('frigate_process_fps', 'Frames per second being processed by frigate.', process_fps = GaugeMetricFamily('frigate_process_fps', 'Frames per second being processed by frigate.',
labels=['camera_name']) labels=['camera_name'])
skipped_fps = GaugeMetricFamily('frigate_skipped_fps', 'Frames per second skip for processing by frigate.', skipped_fps = GaugeMetricFamily('frigate_skipped_fps', 'Frames per second skip for processing by frigate.',
labels=['camera_name']) labels=['camera_name'])
detection_enabled = GaugeMetricFamily('frigate_detection_enabled', 'Detection enabled for camera',
labels=['camera_name'])
# read camera stats assuming version < frigate:0.13.0-beta3 # read camera stats assuming version < frigate:0.13.0-beta3
cameras = stats cameras = stats
@ -80,11 +84,13 @@ class CustomCollector(object):
pass pass
for camera_name, camera_stats in cameras.items(): for camera_name, camera_stats in cameras.items():
add_metric(audio_dBFS, [camera_name], camera_stats, 'audio_dBFS')
add_metric(audio_rms, [camera_name], camera_stats, 'audio_rms')
add_metric(camera_fps, [camera_name], camera_stats, 'camera_fps') add_metric(camera_fps, [camera_name], camera_stats, 'camera_fps')
add_metric(detection_enabled, [camera_name], camera_stats, 'detection_enabled')
add_metric(detection_fps, [camera_name], camera_stats, 'detection_fps') add_metric(detection_fps, [camera_name], camera_stats, 'detection_fps')
add_metric(process_fps, [camera_name], camera_stats, 'process_fps') add_metric(process_fps, [camera_name], camera_stats, 'process_fps')
add_metric(skipped_fps, [camera_name], camera_stats, 'skipped_fps') add_metric(skipped_fps, [camera_name], camera_stats, 'skipped_fps')
add_metric(detection_enabled, [camera_name], camera_stats, 'detection_enabled')
self.add_metric_process(cpu_usages, camera_stats, camera_name, 'ffmpeg_pid', 'ffmpeg', 'cpu', 'Camera') self.add_metric_process(cpu_usages, camera_stats, camera_name, 'ffmpeg_pid', 'ffmpeg', 'cpu', 'Camera')
self.add_metric_process(cpu_usages, camera_stats, camera_name, 'capture_pid', 'capture', 'cpu', 'Camera') self.add_metric_process(cpu_usages, camera_stats, camera_name, 'capture_pid', 'capture', 'cpu', 'Camera')
@ -94,11 +100,13 @@ class CustomCollector(object):
self.add_metric_process(mem_usages, camera_stats, camera_name, 'capture_pid', 'capture', 'mem', 'Camera') self.add_metric_process(mem_usages, camera_stats, camera_name, 'capture_pid', 'capture', 'mem', 'Camera')
self.add_metric_process(mem_usages, camera_stats, camera_name, 'pid', 'detect', 'mem', 'Camera') self.add_metric_process(mem_usages, camera_stats, camera_name, 'pid', 'detect', 'mem', 'Camera')
yield audio_dBFS
yield audio_rms
yield camera_fps yield camera_fps
yield detection_enabled
yield detection_fps yield detection_fps
yield process_fps yield process_fps
yield skipped_fps yield skipped_fps
yield detection_enabled
# detector stats # detector stats
try: try: