#!/bin/bash

DAYS=7
REPORT_PATH="/var/lib/puppet/reports/*"

shopt -s extglob
for report_dir in ${REPORT_PATH}; do
	report_hostname=${report_dir/*\//}
	updated_files=`find $report_dir -type d -mtime -$DAYS 2> /dev/null | head -n1 | wc -l`
	if [ $updated_files == 0 ]; then
		echo "$report_hostname has not reported in $DAYS (or more) day(s)"
	fi
done

