[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



1.  Send test email:

#!/usr/bin/perl

open(O, ">> /home/cfowler/send_test.out");
open(STDOUT,">&O");
open(STDERR,">&O");


use Net::SMTP;
my $smtp = Net::SMTP->new("192.168.2.254") or die "$!\n";
$smtp->mail("cfowler\@opsup.com");
$smtp->to("cfowler\@opsup.com");
$smtp->data();
$smtp->datasend("Subject: [STEST]\r\n\r\n");
$smtp->datasend("Time: ".time()."\r\n");
$smtp->dataend();
$smtp->quit();

$l = localtime(time);

print "Sending mail out at $l\n";


2.  Receive it in.
:0:
* ^Subject.*\[STEST\]*
| /home/cfowler/stest.pl

3.  Stest.pl#!/usr/bin/perl

use Net::SMTP;
use IO::Handle;

my $from = "root\@opsup.com";
my @emailaddrs = ();
push @emailaddrs, "ppickerign\@opsup.com";
push @emailaddrs, "cfowler\@opsup.com";
my $THRESH = 3600;
my $SMTPSERVER="192.168.2.254";

sub report {
        my ($s, $r) = @_;
        foreach my $ref (@emailaddrs) {
                print "Sending email to $ref\n";
                my $smtp = Net::SMTP->new($SMTPSERVER) or die "SMTP
ERR:$!\n";
                $smtp->mail($from);
                $smtp->to($ref);
                $smtp->data();
                $smtp->datasend("To: $ref\r\n");
                $smtp->datasend("From: $from\r\n");
                $smtp->datasend("Subject: Mail error!\r\n");
                $smtp->datasend("\r\n");
                my $data = <<EOF;
Mail timeout has occured.  Test email sent on $s. Received on
$r.  The difference is greater than the threshhold of $THRESH.

EOF
                $smtp->datasend($data);
                $smtp->dataend();
                $smtp->quit();
                print "Email set\n";
        }
}


open (LOG, ">> /home/cfowler/stest.log");
print LOG
"-------------------------------------------------------------------------------\r\n";

close(STDOUT);
close(STDERR);
open(STDOUT, ">&LOG");
open(STDERR, ">&LOG");
while(<STDIN>) {
        next unless m/^Time:/;
        my $now = time();
        m/^Time: (\d+)/;
        next unless $1;
        my $diff = ($now - $1);
        print LOG time().":$1:$diff:$THRESH\n";
        report($1, $now) if $diff >= $THRESH;
}

\*LOG->flush();
print LOG
"-------------------------------------------------------------------------------\r\n";
close(LOG);


Here is the story.

A partner of mine was complaining that he was not getting emails.  Then
he complained that he was getting emails late.  After I experienced this
problem I then started this program.  If a server is down should it be
down for more than 1 hour?  I've been notified by this program many
times since I created it.  Sure it uses the same path to get to me but I
do not care about getting them smtp server at Earthlink back up.  I just
want to know when it happens.  



On Mon, 2004-11-29 at 14:10, Jerald Sheets wrote:
> Why don't you post a message to our Earthlink employees here on the network.
> You may:
> 
> A) inadvertently help a fellow ale'er
> B) get your problems resolved.
> 
> 
> ....just an idea... 
> 
> -----Original Message-----
&gt; From: ale-bounces at ale.org [<a  rel="nofollow" href="mailto:ale-bounces";>mailto:ale-bounces</a> at ale.org] On Behalf Of
&gt; Christopher Fowler
&gt; Sent: Monday, November 29, 2004 2:01 PM
&gt; To: Atlanta Linux Enthusiasts
&gt; Subject: Re: [ale] Re: vonage outage?
&gt; 
&gt; On Mon, 2004-11-29 at 13:53, Eric Anderson wrote:
&gt; &gt; Geoffrey wrote:
&gt; &gt; &gt; Any of you folks using vonage experiencing an outage?  No dialtone 
&gt; &gt; &gt; here and the 1-866 # for vonage is busy. :(
&gt; &gt; 
&gt; &gt; No problem here. Sometimes I think the Vonage box gets confused. Have 
&gt; &gt; you tried resetting your Vonage box? Just unplug it, wait a min or 
&gt; &gt; two, then plug it back in. Also of course make sure your ISP is up.
&gt; &gt; 
&gt; 
&gt; You know what is sad?  Earthlink.  Earhlink's mail service is so bad that
&gt; I've written a program that emails me a time stamped email and then when it
&gt; comes back it validates via the time stamp that it took the email less than
&gt; 1 hour to go through.  If it is greater than one hour I'm notified.
&gt; 
&gt; So in effect I'm doing network monitoring on Earthlink's crappy stuff. 
&gt; But what do you expect for $8/mon?  You should expect horrible service and
&gt; downtime.
&gt;  
&gt; 
&gt; &gt; Eric
&gt; &gt; 
&gt; &gt; ______________________________________________________________________
&gt; &gt; _______________________________________________
&gt; &gt; Ale mailing list
&gt; &gt; Ale at ale.org
&gt; &gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>
&gt; 
&gt; _______________________________________________
&gt; Ale mailing list
&gt; Ale at ale.org
&gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>
&gt; 
&gt; ---
&gt; Incoming mail is certified Virus Free.
&gt; Checked by AVG anti-virus system (<a  rel="nofollow" href="http://www.grisoft.com";>http://www.grisoft.com</a>).
&gt; Version: 6.0.802 / Virus Database: 545 - Release Date: 11/26/2004
&gt;  
&gt; 
&gt; ---
&gt; Outgoing mail is certified Virus Free.
&gt; Checked by AVG anti-virus system (<a  rel="nofollow" href="http://www.grisoft.com";>http://www.grisoft.com</a>).
&gt; Version: 6.0.802 / Virus Database: 545 - Release Date: 11/26/2004
&gt;  


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg01082.html">[ale] vonage outage?</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg01084.html">[ale] vonage outage?</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg01109.html">[ale] Memory on AMD Opteron</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg01087.html">[ale] TFTP server for RH9</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#01083"><strong>Date</strong></a></li>
<li><a href="threads.html#01083"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>