scan_bad_signature.sh: add a month-by-month count of bad-signature files, per account and
overall, in both console output and the report file. Helps tell apart a one-off historical incident from an ongoing/recurring problem.
This commit is contained in:
@@ -788,6 +788,7 @@ declare -i total_bad=0
|
||||
declare -i total_failed_users=0
|
||||
overall_date_min=""
|
||||
overall_date_max=""
|
||||
declare -A overall_month_counts=()
|
||||
|
||||
for _user in "${selected_user_arr[@]}" ; do
|
||||
|
||||
@@ -847,6 +848,20 @@ for _user in "${selected_user_arr[@]}" ; do
|
||||
if [[ -z "$overall_date_max" || "$_user_date_max" > "$overall_date_max" ]] ; then
|
||||
overall_date_max="$_user_date_max"
|
||||
fi
|
||||
|
||||
# - Verteilung der betroffenen Dateien nach Monat (YYYY-MM), pro
|
||||
# - Account und gleich mit-aggregiert fuer das Gesamtergebnis -
|
||||
# - zeigt, ob es sich um vereinzelte Cluster oder einen
|
||||
# - durchgehenden Fehlerstrom handelt.
|
||||
# -
|
||||
declare -A _user_month_counts=()
|
||||
while IFS= read -r _d ; do
|
||||
[[ -z "$_d" ]] && continue
|
||||
_m="${_d:0:7}"
|
||||
_user_month_counts["$_m"]=$(( ${_user_month_counts["$_m"]:-0} + 1 ))
|
||||
overall_month_counts["$_m"]=$(( ${overall_month_counts["$_m"]:-0} + 1 ))
|
||||
done <<< "$_dates_sorted"
|
||||
_user_months_sorted=($(printf '%s\n' "${!_user_month_counts[@]}" | sort))
|
||||
else
|
||||
_user_zeitraum="-"
|
||||
fi
|
||||
@@ -893,6 +908,12 @@ for _user in "${selected_user_arr[@]}" ; do
|
||||
echo -e " Dateien mit 'Bad Signature'..............: ${_user_bad} (${_pct} %)"
|
||||
echo -e " Zeitraum betroffener Dateien.............: ${_user_zeitraum}"
|
||||
fi
|
||||
if [[ $_user_bad -gt 0 ]] ; then
|
||||
echo -e " Verteilung nach Monat:"
|
||||
for _m in "${_user_months_sorted[@]}" ; do
|
||||
printf " \033[1;33m%-7s\033[m : %d\n" "$_m" "${_user_month_counts[$_m]}"
|
||||
done
|
||||
fi
|
||||
# - Leerzeile HINTER der Account-Statistik, damit sie nicht am
|
||||
# - 'Scanning account ..' des naechsten Accounts klebt.
|
||||
# -
|
||||
@@ -905,6 +926,12 @@ for _user in "${selected_user_arr[@]}" ; do
|
||||
echo " Uebersprungene Dateien...................: ${_skipped}"
|
||||
echo " Dateien mit 'Bad Signature'..............: ${_user_bad} (${_pct} %)"
|
||||
echo " Zeitraum betroffener Dateien.............: ${_user_zeitraum}"
|
||||
if [[ $_user_bad -gt 0 ]] ; then
|
||||
echo " Verteilung nach Monat:"
|
||||
for _m in "${_user_months_sorted[@]}" ; do
|
||||
printf " %-7s : %d\n" "$_m" "${_user_month_counts[$_m]}"
|
||||
done
|
||||
fi
|
||||
} >> "$report_file"
|
||||
|
||||
done
|
||||
@@ -924,6 +951,8 @@ else
|
||||
overall_zeitraum="-"
|
||||
fi
|
||||
|
||||
overall_months_sorted=($(printf '%s\n' "${!overall_month_counts[@]}" | sort))
|
||||
|
||||
# - Gesamtergebnis ans Ende des Reportfiles - gleiches Looking wie
|
||||
# - die Ergebnis-Bloecke pro Account
|
||||
# -
|
||||
@@ -939,6 +968,12 @@ fi
|
||||
echo "Gescannte Dateien insgesamt.................: ${total_checked}"
|
||||
echo "Dateien mit 'Bad Signature' insgesamt.......: ${total_bad} (${total_pct} %)"
|
||||
echo "Zeitraum betroffener Dateien insgesamt......: ${overall_zeitraum}"
|
||||
if [[ $total_bad -gt 0 ]] ; then
|
||||
echo "Verteilung betroffener Dateien nach Monat (alle Accounts):"
|
||||
for _m in "${overall_months_sorted[@]}" ; do
|
||||
printf " %-7s : %d\n" "$_m" "${overall_month_counts[$_m]}"
|
||||
done
|
||||
fi
|
||||
} >> "$report_file"
|
||||
|
||||
blank_line
|
||||
@@ -952,6 +987,10 @@ if $terminal ; then
|
||||
echo -e " Dateien mit 'Bad Signature' insgesamt.......: \033[1;31m${total_bad} (${total_pct} %)\033[m"
|
||||
if [[ $total_bad -gt 0 ]] ; then
|
||||
echo -e " Zeitraum betroffener Dateien insgesamt......: \033[1;31m${overall_zeitraum}\033[m"
|
||||
echo -e " Verteilung betroffener Dateien nach Monat (alle Accounts):"
|
||||
for _m in "${overall_months_sorted[@]}" ; do
|
||||
printf " \033[1;31m%-7s\033[m : %d\n" "$_m" "${overall_month_counts[$_m]}"
|
||||
done
|
||||
else
|
||||
echo -e " Zeitraum betroffener Dateien insgesamt......: ${overall_zeitraum}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user