fix(ops): réduire les faux positifs de supervision
This commit is contained in:
@@ -30,7 +30,9 @@ mark_failure() {
|
||||
}
|
||||
|
||||
is_healthy_http_status() {
|
||||
[[ "$1" =~ ^2[0-9][0-9]$ || "$1" =~ ^3[0-9][0-9]$ ]]
|
||||
# Toute réponse HTTP (< 500) confirme que Traefik et le service restent joignables.
|
||||
# Les 401/404 sont légitimes pour les tableaux protégés ou API sans page racine.
|
||||
[[ "$1" =~ ^[1-4][0-9][0-9]$ ]]
|
||||
}
|
||||
|
||||
check_http_route() {
|
||||
@@ -60,7 +62,7 @@ check_http_route() {
|
||||
}
|
||||
|
||||
check_containers() {
|
||||
local container_id name project workdir config_files status health restart_policy
|
||||
local container_id name project workdir config_files status health restart_policy exit_code
|
||||
mapfile -t container_ids < <(docker ps -aq --filter label=com.docker.compose.project)
|
||||
|
||||
if [[ "${#container_ids[@]}" -eq 0 ]]; then
|
||||
@@ -76,8 +78,13 @@ check_containers() {
|
||||
status="$(docker inspect -f '{{.State.Status}}' "$container_id")"
|
||||
health="$(docker inspect -f '{{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}}' "$container_id")"
|
||||
restart_policy="$(docker inspect -f '{{.HostConfig.RestartPolicy.Name}}' "$container_id")"
|
||||
exit_code="$(docker inspect -f '{{.State.ExitCode}}' "$container_id")"
|
||||
|
||||
if [[ "$status" != "running" ]]; then
|
||||
if [[ "$status" == "exited" && "$exit_code" == "0" ]]; then
|
||||
log_line "INFO" "${project}/${name}: tâche ponctuelle terminée"
|
||||
continue
|
||||
fi
|
||||
mark_failure "${project}/${name}: état Docker ${status}"
|
||||
continue
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user