mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-02 22:04:06 +02:00
Check for empty streams
This commit is contained in:
@@ -229,6 +229,18 @@ check_services() {
|
|||||||
fi
|
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
|
# Main Monitoring Loop
|
||||||
########################################
|
########################################
|
||||||
@@ -253,6 +265,9 @@ while true; do
|
|||||||
# 4) Services check
|
# 4) Services check
|
||||||
check_services || any_issue=1
|
check_services || any_issue=1
|
||||||
|
|
||||||
|
# 5) Check for potential empty stream
|
||||||
|
check_for_empty_stream || any_issue=1
|
||||||
|
|
||||||
# Final summary
|
# Final summary
|
||||||
if (( any_issue == 0 )); then
|
if (( any_issue == 0 )); then
|
||||||
log_green "$(date) INFO: All systems are functioning normally"
|
log_green "$(date) INFO: All systems are functioning normally"
|
||||||
|
|||||||
Reference in New Issue
Block a user