From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/239424-check_email_loop.diff | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 web/attachments/239424-check_email_loop.diff (limited to 'web/attachments/239424-check_email_loop.diff') 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 @@ +Index: etch/contrib/check_email_loop.pl +=================================================================== +--- etch/contrib/check_email_loop.pl (revision 172) ++++ etch/contrib/check_email_loop.pl (working copy) +@@ -112,6 +112,7 @@ + # creating new serial id + my $serial = time(); + $serial = "ID#" . $serial . "#$$"; ++push @messageids, $serial; + + + # sending new ping email +@@ -136,6 +137,7 @@ + # no the interessting part: let's if they are receiving ;-) + + $pop = Net::POP3->new( $pophost, ++ Debug=>$debug, + Timeout=>$poptimeout) + || nsexit("POP3 connect timeout (>$poptimeout s, host: $pophost)",'CRITICAL'); + +@@ -154,6 +156,7 @@ + @msglines = @{$pop->top($msgcount,1)}; + for (my $i=0; $i < scalar @messageids; $i++) { + if (messagematchsid(\@msglines,$messageids[$i])) { ++ warn "Found message $messageids[$i]\n" if $debug; + $matchcount++; + # newest received mail than the others, ok remeber id. + if (!defined $newestid) { +@@ -177,6 +180,7 @@ + chomp @msgsubject; + # Scan Subject if email is an Email-Ping. In fact we match and delete also successfully retrieved messages here again. + if (!defined $keeporphaned && $msgsubject[0] =~ /E-Mail Ping \[/) { ++ warn "Deleting orphan: $msgsubject[0]\n"; + $pop->delete($msgcount); # remove E-Mail from POP3 server + } + +@@ -200,10 +204,7 @@ + } + + # Write list to id-Database +-foreach my $id (@messageids) { +- print STATF "$id\n"; +-} +-print STATF "$serial\n"; # remember send mail of this session ++print STATF map { "$_\n" } @messageids; + close STATF; + + # ok - count lost and pending mails; -- cgit v1.2.3-74-g34f1