Files
nginx-analize/results/scripts/run-pmi-log-checks.sh
Redsandyg fcc9139361 init
2026-06-15 06:31:35 +03:00

34 lines
1.1 KiB
Bash

#!/bin/sh
# Log checks for PMI items 12 and 13 (runs inside nginx container).
set -eu
REPORT="${REPORT:-/reports/pmi.log}"
ACCESS_LOG="/reports/nginx-file-access.log"
ERROR_LOG="/reports/nginx-file-error.log"
: > "$ACCESS_LOG"
: > "$ERROR_LOG"
curl -s --max-time 5 http://127.0.0.1/test-page > /dev/null
curl -s --max-time 5 http://127.0.0.1/another-page > /dev/null
curl -s --max-time 5 http://127.0.0.1/broken/ > /dev/null || true
sleep 1
if grep -q '/test-page' "$ACCESS_LOG" && grep -q '/another-page' "$ACCESS_LOG"; then
echo "PASS #12 access_log contains test-page and another-page" >> "$REPORT"
echo "PASS #12 access_log contains test-page and another-page"
else
echo "FAIL #12 access_log missing expected entries" >> "$REPORT"
echo "FAIL #12 access_log missing expected entries"
exit 1
fi
if grep -qE 'connect\(\) failed|Connection refused|upstream' "$ERROR_LOG"; then
echo "PASS #13 error_log contains upstream error" >> "$REPORT"
echo "PASS #13 error_log contains upstream error"
else
echo "FAIL #13 error_log missing upstream error" >> "$REPORT"
echo "FAIL #13 error_log missing upstream error"
exit 1
fi