@@ -24,6 +24,7 @@ LOG_FILE="./alerts/notification_logs/log_$(date +"%Y_%m_%d").txt"
2424batches=0
2525submitted_total=0
2626verified_total=0
27+ unverified_total=0
2728eth_total=" 0"
2829usd_total=" 0"
2930
@@ -62,17 +63,48 @@ if [[ -f "$LOG_FILE" ]]; then
6263 usd_total=$( echo " $usd_total + $usd_spent " | bc -l)
6364 fi
6465 ;;
66+ * " FAILURE:" * )
67+ batches=$(( batches + 1 ))
68+
69+ proofs_submitted=$( printf ' %s\n' " $line " \
70+ | grep -oE ' [0-9]+ proofs submitted' \
71+ | head -1 \
72+ | cut -d' ' -f1)
73+ if [[ -n " $proofs_submitted " ]]; then
74+ submitted_total=$(( submitted_total + proofs_submitted))
75+ fi
76+
77+ proofs_unverified=$( printf ' %s\n' " $line " \
78+ | grep -oE ' \([0-9]+ sent\)' \
79+ | grep -oE ' [0-9]+' \
80+ | head -1)
81+ if [[ -n " $proofs_verified " ]]; then
82+ unverified_total=$(( verified_total + proofs_verified))
83+ fi
84+
85+ eth_spent=$( printf ' %s\n' " $line " \
86+ | sed -n ' s/.*Spent \([0-9.]*\) ETH.*/\1/p' )
87+ if [[ -n " $eth_spent " ]]; then
88+ eth_total=$( echo " $eth_total + $eth_spent " | bc -l)
89+ fi
90+
91+ usd_spent=$( printf ' %s\n' " $line " \
92+ | sed -n ' s/.*(\$ *\([0-9.]*\)).*/\1/p' )
93+ if [[ -n " $usd_spent " ]]; then
94+ usd_total=$( echo " $usd_total + $usd_spent " | bc -l)
95+ fi
6596 esac
6697 done < " $LOG_FILE "
6798
6899 summary=$(
69100 printf " Proof Submission Summary - %s\n" " $( date +' %Y-%m-%d %H:%M:%S' ) "
70101 echo " ----------------------------------------"
71- printf " Processed batches : %d\n" " $batches "
72- printf " Proofs submitted : %d\n" " $submitted_total "
73- printf " Proofs verified : %d\n" " $verified_total "
74- printf " Total spent (ETH) : %.12f ETH\n" " $eth_total "
75- printf " Total spent (USD) : $ %.2f\n" " $usd_total "
102+ printf " Processed batches : %d\n" " $batches "
103+ printf " Proofs submitted : %d\n" " $submitted_total "
104+ printf " Proofs verified : %d\n" " $verified_total "
105+ printf " Proofs not verified : %d\n" " $unverified_total "
106+ printf " Total spent (ETH). : %.12f ETH\n" " $eth_total "
107+ printf " Total spent (USD). : $ %.2f\n" " $usd_total "
76108 echo " ----------------------------------------"
77109 )
78110
0 commit comments