*** /tools/nagios/libexec/check_email_loop.pl.orig Fri Jan 28 08:08:29 2005 --- /tools/nagios/libexec/check_email_loop.pl Fri Jan 28 08:38:01 2005 *************** *** 42,51 **** my $state = "UNKNOWN"; my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost); my ($poptimeout,$smtptimeout,$pinginterval)=(60,60,5); ! my ($lostwarn, $lostcrit,$pendwarn, $pendcrit); # Internal Vars my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid); my ($matchcount,$statfile) = (0,"check_email_loop.stat"); # Subs declaration --- 42,52 ---- my $state = "UNKNOWN"; my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost); my ($poptimeout,$smtptimeout,$pinginterval)=(60,60,5); ! my ($lostwarn, $lostcrit,$pendwarn, $pendcrit, $debug); # Internal Vars my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid); + my(%other_smtp_opts); my ($matchcount,$statfile) = (0,"check_email_loop.stat"); # Subs declaration *************** *** 65,70 **** --- 66,72 ---- my $status = GetOptions( "from=s",\$sender, "to=s",\$receiver, + "debug", \$debug, "pophost=s",\$pophost, "popuser=s",\$popuser, "passwd=s",\$poppasswd, *************** *** 101,108 **** my $serial = time(); $serial = "ID#" . $serial . "#$$"; # sending new ping email ! my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout) || nsexit("SMTP connect timeout ($smtptimeout s)",'CRITICAL'); ($smtp->mail($sender) && $smtp->to($receiver) && --- 103,116 ---- my $serial = time(); $serial = "ID#" . $serial . "#$$"; + # sending new ping email ! %other_smtp_opts={}; ! if ( $debug == 1 ) { ! $other_smtp_opts{'Debug'} = 1; ! } ! ! my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout, %other_smtp_opts) || nsexit("SMTP connect timeout ($smtptimeout s)",'CRITICAL'); ($smtp->mail($sender) && $smtp->to($receiver) && *************** *** 216,221 **** --- 224,230 ---- print " -lostcrit=num CRITICAL \n"; print " -pendwarn=num WARNING-state if more than num pending emails\n"; print " -pendcrit=num CRITICAL \n"; + print " -debug send SMTP tranaction info to stderr\n"; print " Options may abbreviated!\n"; print " LOST mails are mails, being sent before the last mail arrived back.\n"; print " PENDING mails are those, which are not. (supposed to be on the way)\n";