Bug#379898: exim4-base: Could create cronjob to check paniclog
Marc Haber
mh+debian-packages at zugschlus.de
Fri Jul 28 12:03:14 UTC 2006
On Wed, Jul 26, 2006 at 11:12:42AM +0200, Marc Haber wrote:
> I would be willing to accept a patch to the daily cron job which would
> yell into syslog, try to send an e-mail (by directly calling
> /usr/lib/sendmail and reporting a non-zero exit code to syslog and
> probably somewhere else). A hook would be nice at this place as well,
> allowing the local admin to have his local reporting method (like a
> nagios passive service check or writing a warning to /etc/motd) hooked
> in.
What do you think about this code:
log_this() {
TEXT="$@"
if ! logger -t exim4 -p mail.alert $TEXT; then
RET="$?"
echo >&2 "ALERT: could not syslog $TEXT, logger return value $RET"
fi
}
if [ "$WATCH_PANICLOG" = "yes" ]; then
if [ -s "/var/log/exim4/paniclog" ]; then
if [ -x "/usr/local/lib/exim4/nonzero_paniclog_hook" ]; then
/usr/local/lib/exim4/nonzero_paniclog_hook
fi
log_this "ALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, mail system possibly broken"
if ! echo -e "Subject: exim paniclog on $(hostname) has non-zero size\nTo: root\n\nexim paniclog /var/log/exim4/paniclog on $(hostname) has non-zero size, mail system might be broken" | exim4 root; then
log_this "PANIC: sending out e-mail warning has failed, exim has non-zero return code"
fi
fi
fi
with WATCH_PANICLOG being preset to "yes"?
Greetings
Marc
--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature | How to make an American Quilt | Fax: *49 621 72739835
More information about the Pkg-exim4-maintainers
mailing list