[Mimedefang] HUGE problem with mimedefang

Paul Whittney pwhittney at net.arrivetech.com
Fri Apr 22 12:00:53 EDT 2005


Listening to all the issues, and seeing James' reply of checking
the status, I thought I'd see what people think of an alternative
may of monitoring.

This method came about due to using a monitoring server on our site.

It's not pretty, nor perfect, but I'd appreciate any comments.

Its installed on the mail exchanger to be monitored, under its
own user account (monitor, say), and the monitoring server uses
ssh (with keys, although a blank passphrase, so there are possible
side effects to this) to just run the command:
	ssh monitor at mx "bin/mimedefangCheck.pl"

Ive used it with v2.39 to v2.51.

#!/usr/bin/perl
###############################
# Monitoring Script for MIMEDefang equipped machines
# By PWhittney [AT] net [DOT] arrivetech [DOT] com
# 
$unixSock = "/proc/net/unix";

$multiPlexSock = "mimedefang-multiplexor.sock";
$mimedefangSock = "mimedefang.sock";

%count =(
        "multiplex" => 0,
        "mimedefang" => 0
);

open (UNIXSOCK,$unixSock) ||
        die "MimedefangCheck UNKNOWN: $unixSock failed to open\n";

while (<UNIXSOCK>) {
        chomp;
        # looking for:
        # /var/spool/MIMEDefang/mimedefang-multiplexor.sock
        # and number of /var/spool/MIMEDefang/mimedefang.sock
        if (m/$multiPlexSock/) {
                $count{multiplex}++;
        } elsif (m/$mimedefangSock/) {
                $count{mimedefang}++;
        }
}; # end of while unixsock...

close UNIXSOCK;

if ($count{multiplex} && $count{mimedefang}) {
        # everything seems in order, for this check..
        $status = "OK";
        $exitVal= 0;
        $output = sprintf ("Multiplex socket count = %d, mimedefang = %d",
                $count{multiplex},
                $count{mimedefang}
        );
} else {
        $status = "CRITICAL";
        $exitVal= 2;
        if ($count{multiplex}) {
                $output = "multiplex socket fails to exist";
        } elsif ($count{mimedefang}) {
                $output = "mimedefang socket fails to exist";
        } else {
                $output = "mimedefang and multiplex sockets fails to exist";
        }
}

print "MimedefangCheck $status: $output\n";

exit $exitVal;
######################### END ######################

I admit, it doesn't restart the service, but then if it failed, I prefer
an SMTP tempfail from sendmail, then forcing a restart-failed type
of cycle. In fact, if it fails, a server that has rights to bypass
the mail exchanger emails my cell phone (and if the internet is down
it phones me.. However, if the internet is down, the last thing
I'm worried about is the lack of email ;-)

Hope this helps someone out. Also, I've only tested it on linux.

-Paul Whittney
Network Engineer
www.ArriveTech.com

On Thu, Apr 21, 2005 at 02:08:29PM -0400, James Ebright wrote:
> On Thu, 21 Apr 2005 11:27:44 -0400, Lisa Casey wrote
> > status is not an option to /etc/init.d/mimedefang 
> > on my system:
> > 
> > [root at Raydeus-Dee init.d]# /etc/init.d/mimedefang
> > Usage: /etc/init.d/mimedefang {start|stop|restart|reread|reload}
> 
> It is part of the redhat init script included with the tarball but you can
> easily duplicate it on other systems, I just ripped this out of the redhat
> init.d functions library (add this to your init.d/mimedefang):
> 
<snipped>



More information about the MIMEDefang mailing list