aboutsummaryrefslogtreecommitdiff
path: root/plugins-scripts/check_mailq.pl
diff options
context:
space:
mode:
authorGravatar Evgeni Golov <evgeni@golov.de> 2014-02-27 08:31:05 +0100
committerGravatar Jan Wagner <waja@cyconet.org> 2014-02-27 20:33:14 +0100
commitbe9aa5aba24640b15205060cda442d02f7be799c (patch)
tree1291db590c2ea70a72093589af5918d80b704cd9 /plugins-scripts/check_mailq.pl
parent19c493e54c27a51d7a5372ff4b4cb4fa5ad74733 (diff)
downloadmonitoring-plugins-be9aa5aba24640b15205060cda442d02f7be799c.tar.gz
check_mailq: try to autodetect which mailq implementation we are using
This is done by looking at some common directories and files each MTA installs on the system. If no known file is found, the old default sendmail is used. Of course this still can be overridden by -M.
Diffstat (limited to 'plugins-scripts/check_mailq.pl')
-rwxr-xr-xplugins-scripts/check_mailq.pl25
1 files changed, 24 insertions, 1 deletions
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl
index 2a805b62..cc040ebb 100755
--- a/plugins-scripts/check_mailq.pl
+++ b/plugins-scripts/check_mailq.pl
@@ -605,7 +605,30 @@ sub process_arguments(){
exit $ERRORS{'UNKNOWN'};
}
}else{
- $mailq = 'sendmail' ;
+ if (defined $utils::PATH_TO_QMAIL_QSTAT
+ && -x $utils::PATH_TO_QMAIL_QSTAT)
+ {
+ $mailq = 'qmail';
+ }
+ elsif (-d '/var/lib/postfix' || -d '/var/local/lib/postfix'
+ || -e '/usr/sbin/postfix' || -e '/usr/local/sbin/postfix')
+ {
+ $mailq = 'postfix';
+ }
+ elsif (-d '/usr/lib/exim4' || -d '/usr/local/lib/exim4'
+ || -e '/usr/sbin/exim' || -e '/usr/local/sbin/exim')
+ {
+ $mailq = 'exim';
+ }
+ elsif (-d '/usr/lib/nullmailer' || -d '/usr/local/lib/nullmailer'
+ || -e '/usr/sbin/nullmailer-send'
+ || -e '/usr/local/sbin/nullmailer-send')
+ {
+ $mailq = 'nullmailer';
+ }
+ else {
+ $mailq = 'sendmail';
+ }
}
return $ERRORS{'OK'};