From 841d5ac3ea39e7733e2444c4a68b0dfe993db11f Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sun, 6 Apr 2025 21:32:53 +0200 Subject: [PATCH] Check for empty streams --- .../rootfs/custom-services.d/30-monitoring.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/birdnet-pi/rootfs/custom-services.d/30-monitoring.sh b/birdnet-pi/rootfs/custom-services.d/30-monitoring.sh index 7b9c1a817..73f2df2ac 100755 --- a/birdnet-pi/rootfs/custom-services.d/30-monitoring.sh +++ b/birdnet-pi/rootfs/custom-services.d/30-monitoring.sh @@ -229,6 +229,18 @@ check_services() { fi } +check_for_empty_stream() { + local log_tail + log_tail=$(timeout 15 cat /proc/1/fd/1 | tail -n 5) + + if echo "$log_tail" | grep -q "Haliastur indus"; then + log_red "$(date) INFO: Potential empty stream detected (frequent 'Haliastur indus')." + apprisealert "Potential empty stream detected — frequent 'Haliastur indus' in log" + return 1 + fi + return 0 +} + ######################################## # Main Monitoring Loop ######################################## @@ -253,6 +265,9 @@ while true; do # 4) Services check check_services || any_issue=1 + # 5) Check for potential empty stream + check_for_empty_stream || any_issue=1 + # Final summary if (( any_issue == 0 )); then log_green "$(date) INFO: All systems are functioning normally"