X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=mailtest-check;h=d5d30aa6ae2f275654ed391053bbaa1bafb87657;hb=6f02137f46c6e692a4775e4600f102cf942138fa;hp=cce5908fb78267d53c06a8bb224df0248b40daca;hpb=b28eebdf9143aa17733f233b30b96f462008f3b6;p=distro-setup diff --git a/mailtest-check b/mailtest-check index cce5908..d5d30aa 100755 --- a/mailtest-check +++ b/mailtest-check @@ -28,11 +28,6 @@ getspamdpid() { done fi } -pr() { - if $doprom && [[ -e /var/lib/prometheus/node-exporter ]]; then - cat >>/var/lib/prometheus/node-exporter/mailtest-check.prom.$$ - fi -} #### begin arg processing #### @@ -81,6 +76,7 @@ esac main() { + local -a p_unexpected_spamd_results p_missing_dnswl p_last_usec case $HOSTNAME in bk) folders=(/m/md/{expertpathologyreview.com,amnimal.ninja}/testignore) @@ -104,6 +100,7 @@ main() { try_left=$(( try_limit - ( EPOCHSECONDS - try_start_time) )) timeout=120 # somewhat arbitrary value if (( try_left < 0 )); then + echo "mailtest-check: failed to rsync fencepost > $try_limit seconds" break fi if (( try_left < timeout )); then @@ -145,10 +142,11 @@ EOF fi tmpfile=$(mktemp) declare -i unexpected=0 - declare -i missing_dnswl=0 - declare -i dnsfail=0 for folder in ${folders[@]}; do for from in ${froms[@]}; do + declare -i missing_dnswl=0 + declare -i dnsfail=0 + declare -i unexpected=0 latest= last_sec=0 @@ -217,8 +215,8 @@ EOF # eggs has RCVD_IN_DNSWL_MED keys+=(RCVD_IN_DNSWL_MED) elif [[ $from == *@gnu.org ]]; then - # eggs has these - keys+=(RCVD_IN_DNSWL_MED DKIMWL_WL_HIGH) + # eggs has this. it used to have DKIMWL_WL_HIGH sometime in 2022 + keys+=(RCVD_IN_DNSWL_MED) fi for t in ${keys[@]}; do @@ -289,6 +287,12 @@ EOF ;; esac done + mapfile -O ${#p_missing_dnswl[@]} -t p_missing_dnswl <>$path + done + for l in "${p_missing_dnswl[@]}"; do + printf "%s\n" "$l" >>$path + done + for l in "${p_last_usec[@]}"; do + printf "%s\n" "$l" >>$path + done + mv $path $dir/mailtest-check.prom # note: node_textfile_mtime_seconds will tell us when this last happened. useful for debugging. fi }