diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-30 00:03:24 +0200 |
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-30 00:03:24 +0200 |
| commit | 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 (patch) | |
| tree | 1c2b6b21704a294940f87c7892676998d8371707 /web/attachments/239424-check_email_loop.diff | |
| download | site-0b6423f9c99d9edf8c96fefd0f6c453859395aa1.tar.gz | |
Import Nagios Plugins site
Import the Nagios Plugins web site, Cronjobs, infrastructure scripts,
and configuration files.
Diffstat (limited to 'web/attachments/239424-check_email_loop.diff')
| -rw-r--r-- | web/attachments/239424-check_email_loop.diff | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/web/attachments/239424-check_email_loop.diff b/web/attachments/239424-check_email_loop.diff new file mode 100644 index 0000000..e06de63 --- /dev/null +++ b/web/attachments/239424-check_email_loop.diff | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | Index: etch/contrib/check_email_loop.pl | ||
| 2 | =================================================================== | ||
| 3 | --- etch/contrib/check_email_loop.pl (revision 172) | ||
| 4 | +++ etch/contrib/check_email_loop.pl (working copy) | ||
| 5 | @@ -112,6 +112,7 @@ | ||
| 6 | # creating new serial id | ||
| 7 | my $serial = time(); | ||
| 8 | $serial = "ID#" . $serial . "#$$"; | ||
| 9 | +push @messageids, $serial; | ||
| 10 | |||
| 11 | |||
| 12 | # sending new ping email | ||
| 13 | @@ -136,6 +137,7 @@ | ||
| 14 | # no the interessting part: let's if they are receiving ;-) | ||
| 15 | |||
| 16 | $pop = Net::POP3->new( $pophost, | ||
| 17 | + Debug=>$debug, | ||
| 18 | Timeout=>$poptimeout) | ||
| 19 | || nsexit("POP3 connect timeout (>$poptimeout s, host: $pophost)",'CRITICAL'); | ||
| 20 | |||
| 21 | @@ -154,6 +156,7 @@ | ||
| 22 | @msglines = @{$pop->top($msgcount,1)}; | ||
| 23 | for (my $i=0; $i < scalar @messageids; $i++) { | ||
| 24 | if (messagematchsid(\@msglines,$messageids[$i])) { | ||
| 25 | + warn "Found message $messageids[$i]\n" if $debug; | ||
| 26 | $matchcount++; | ||
| 27 | # newest received mail than the others, ok remeber id. | ||
| 28 | if (!defined $newestid) { | ||
| 29 | @@ -177,6 +180,7 @@ | ||
| 30 | chomp @msgsubject; | ||
| 31 | # Scan Subject if email is an Email-Ping. In fact we match and delete also successfully retrieved messages here again. | ||
| 32 | if (!defined $keeporphaned && $msgsubject[0] =~ /E-Mail Ping \[/) { | ||
| 33 | + warn "Deleting orphan: $msgsubject[0]\n"; | ||
| 34 | $pop->delete($msgcount); # remove E-Mail from POP3 server | ||
| 35 | } | ||
| 36 | |||
| 37 | @@ -200,10 +204,7 @@ | ||
| 38 | } | ||
| 39 | |||
| 40 | # Write list to id-Database | ||
| 41 | -foreach my $id (@messageids) { | ||
| 42 | - print STATF "$id\n"; | ||
| 43 | -} | ||
| 44 | -print STATF "$serial\n"; # remember send mail of this session | ||
| 45 | +print STATF map { "$_\n" } @messageids; | ||
| 46 | close STATF; | ||
| 47 | |||
| 48 | # ok - count lost and pending mails; | ||
