summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorHarper Mann <harpermann@users.sourceforge.net>2005-11-29 23:19:06 (GMT)
committerHarper Mann <harpermann@users.sourceforge.net>2005-11-29 23:19:06 (GMT)
commita15ea2615f337019e2e57310d1b6eb4c09e94ce9 (patch)
treee24622345d065ba86b5ec6caf185af2e9b46df55 /contrib
parent2af811c0a63855561b420d245e634b28de215b3e (diff)
downloadmonitoring-plugins-a15ea2615f337019e2e57310d1b6eb4c09e94ce9.tar.gz
Bug: 1355304 Added patch for ePN and perl warnings. Fixed some text and
a warning about type comparison. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1289 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'contrib')
-rw-r--r--contrib/check_email_loop.pl24
1 files changed, 19 insertions, 5 deletions
diff --git a/contrib/check_email_loop.pl b/contrib/check_email_loop.pl
index 7e0a9f0..bcaf13b 100644
--- a/contrib/check_email_loop.pl
+++ b/contrib/check_email_loop.pl
@@ -1,4 +1,6 @@
1#!/usr/bin/perl 1#!/usr/bin/perl -w
2#
3# $Id$
2# 4#
3# (c)2000 Benjamin Schmid, blueshift@gmx.net (emergency use only ;-) 5# (c)2000 Benjamin Schmid, blueshift@gmx.net (emergency use only ;-)
4# Copyleft by GNU GPL 6# Copyleft by GNU GPL
@@ -48,6 +50,7 @@ my $state = "UNKNOWN";
48my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost,$keeporphaned); 50my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost,$keeporphaned);
49my ($poptimeout,$smtptimeout,$pinginterval,$maxmsg)=(60,60,5,50); 51my ($poptimeout,$smtptimeout,$pinginterval,$maxmsg)=(60,60,5,50);
50my ($lostwarn, $lostcrit,$pendwarn, $pendcrit,$debug); 52my ($lostwarn, $lostcrit,$pendwarn, $pendcrit,$debug);
53$debug = 0;
51 54
52# Internal Vars 55# Internal Vars
53my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid); 56my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid);
@@ -112,7 +115,7 @@ $serial = "ID#" . $serial . "#$$";
112 115
113 116
114# sending new ping email 117# sending new ping email
115%other_smtp_opts={}; 118%other_smtp_opts=();
116if ( $debug == 1 ) { 119if ( $debug == 1 ) {
117 $other_smtp_opts{'Debug'} = 1; 120 $other_smtp_opts{'Debug'} = 1;
118} 121}
@@ -123,8 +126,8 @@ my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout, %other_smtp_opts)
123 $smtp->to($receiver) && 126 $smtp->to($receiver) &&
124 $smtp->data() && 127 $smtp->data() &&
125 $smtp->datasend("To: $receiver\nSubject: E-Mail Ping [$serial]\n\n". 128 $smtp->datasend("To: $receiver\nSubject: E-Mail Ping [$serial]\n\n".
126 "This is a automatically sended E-Mail.\n". 129 "This is an automatically sent E-Mail.\n".
127 "It ist not intended for human reader.\n\n". 130 "It is not intended for a human reader.\n\n".
128 "Serial No: $serial\n") && 131 "Serial No: $serial\n") &&
129 $smtp->dataend() && 132 $smtp->dataend() &&
130 $smtp->quit 133 $smtp->quit
@@ -145,6 +148,7 @@ nsexit("POP3 login failed (user:$popuser)",'CRITICAL') if (!defined($msgcount));
145# Check if more than maxmsg mails in pop3-box 148# Check if more than maxmsg mails in pop3-box
146nsexit(">$maxmsg Mails ($msgcount Mails on POP3); Please delete !",'WARNING') if ($msgcount > $maxmsg); 149nsexit(">$maxmsg Mails ($msgcount Mails on POP3); Please delete !",'WARNING') if ($msgcount > $maxmsg);
147 150
151my ($mid, $nid);
148# Count messages, that we are looking 4: 152# Count messages, that we are looking 4:
149while ($msgcount > 0) { 153while ($msgcount > 0) {
150 @msglines = @{$pop->top($msgcount,1)}; 154 @msglines = @{$pop->top($msgcount,1)};
@@ -152,7 +156,17 @@ while ($msgcount > 0) {
152 if (messagematchsid(\@msglines,$messageids[$i])) { 156 if (messagematchsid(\@msglines,$messageids[$i])) {
153 $matchcount++; 157 $matchcount++;
154 # newest received mail than the others, ok remeber id. 158 # newest received mail than the others, ok remeber id.
155 $newestid = $messageids[$i] if ($messageids[$i] > $newestid || !defined $newestid); 159 if (!defined $newestid) {
160 $newestid = $messageids[$i];
161 } else {
162 $messageids[$i] =~ /\#(\d+)\#/;
163 $mid = $1;
164 $newestid =~ /\#(\d+)\#/;
165 $nid = $1;
166 if ($mid > $nid) {
167 $newestid = $messageids[$i];
168 }
169 }
156 $pop->delete($msgcount); # remove E-Mail from POP3 server 170 $pop->delete($msgcount); # remove E-Mail from POP3 server
157 splice @messageids, $i, 1;# remove id from List 171 splice @messageids, $i, 1;# remove id from List
158 last; # stop looking in list 172 last; # stop looking in list