Listing 5: Check for too much or too old mail
internet_tooMuchMail {
description = "Too many messages waiting to be delivered";
type = "compound";
enable = true;
period = 3600;
threshold = 500;
timeout = 21600;
priority = "warning";
product = "internet";
action = "";
trigger = '
set tooMuch [dcf -f %d -h $H_ALERT internet_tooMuchMail \
threshold]
if { [llength [glob $mailDir/*]] > $tooMuch } {
dnotice -n "internet_tooMuchMail" \
-d "There are over $threshold messages waiting for \
delivery" -a none
}
return 0
';
}
internet_tooOldMail {
description = "Mail message has remained in queue too long";
type = "compound";
enable = true;
period = 3600;
threshold = 3;
timeout = 21600;
priority = "warning";
product = "internet";
action = "";
trigger = '
set days [dcf -f %d -h $H_ALERT internet_tooOldMail threshold]
set tooOld [expr [getclock] - ($days *24*60*60)]
set fileList [glob $mailDir/*]
foreach file $fileList {
if { [file mtime $file] < $tooOld }
dnotice -n "internet_tooOldMail" \
-d "Message file $file is over $days days old." \
-a none
}
dpoll -n internet_tooOldMail; # Don't hog too much
# time at once
}
return 0
';
}
# End of File
|