fi
mprom=/var/lib/prometheus/node-exporter/mailtest-check.prom
- if grep -qE 'mailtest_check_(unexpected|missing).*[^ ][^0]$' $mprom; then
- chars+=("MTEST_SPAM")
- fi
- mtest_found=false
- for t in $(grep -E ^mailtest_check_last_usec $mprom | awk '{print $NF}'); do
- if (( t + 60 * 20 < EPOCHSECONDS )); then
- mtest_found=true
+ if [[ -s $mprom ]]; then
+ if grep -qE 'mailtest_check_(unexpected|missing).*[^ ][^0]$' $mprom; then
+ chars+=("MTEST_SPAM")
+ fi
+ mtest_found=false
+ # shellcheck disable=SC2013 # these are words
+ for t in $(grep -E ^mailtest_check_last_usec $mprom | awk '{print $NF}'); do
+ if (( t + 60 * 20 < EPOCHSECONDS )); then
+ mtest_found=true
+ fi
+ done
+ if $mtest_found; then
+ chars+=("MTEST_AGE")
fi
- done
- if $mtest_found; then
- chars+=("MTEST_AGE")
fi
if [[ ! -e $status_file || -w $status_file ]]; then