Kaynağa Gözat

Fixed --mismatch option for check_tcp. Added tests into check_imap
(Rick Fey - 1339134)


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1273 f882894a-f735-0410-b71e-b25c423dba1c

Ton Voon 20 yıl önce
ebeveyn
işleme
003c6dea15
3 değiştirilmiş dosya ile 6 ekleme ve 2 silme
  1. 2 0
      THANKS.in
  2. 1 1
      plugins/check_tcp.c
  3. 3 1
      plugins/t/check_imap.t

+ 2 - 0
THANKS.in

@@ -169,3 +169,5 @@ Chester Hosey
 Pascal Larisch
 Pascal Larisch
 David Sullivan
 David Sullivan
 Bob Ingraham
 Bob Ingraham
+Hans Engelen
+Rick Frey

+ 1 - 1
plugins/check_tcp.c

@@ -311,7 +311,7 @@ main (int argc, char **argv)
 
 
 	/* did we get the response we hoped? */
 	/* did we get the response we hoped? */
 	if(match == -2 && result != STATE_CRITICAL)
 	if(match == -2 && result != STATE_CRITICAL)
-		result = STATE_WARNING;
+		result = expect_mismatch_state;
 
 
 	/* reset the alarm */
 	/* reset the alarm */
 	alarm (0);
 	alarm (0);

+ 3 - 1
plugins/t/check_imap.t

@@ -10,7 +10,7 @@ use Test;
 use NPTest;
 use NPTest;
 
 
 use vars qw($tests);
 use vars qw($tests);
-BEGIN {$tests = 5; plan tests => $tests}
+BEGIN {$tests = 7; plan tests => $tests}
 
 
 my $host_tcp_smtp      = getTestParameter( "host_tcp_smtp",      "NP_HOST_TCP_SMTP",      "mailhost",
 my $host_tcp_smtp      = getTestParameter( "host_tcp_smtp",      "NP_HOST_TCP_SMTP",      "mailhost",
 					   "A host providing an STMP Service (a mail server)");
 					   "A host providing an STMP Service (a mail server)");
@@ -33,6 +33,8 @@ $t += checkCmd( "./check_imap -H $host_tcp_imap -p 143 -w  9 -c  9 -t  10 -e '*
 $t += checkCmd( "./check_imap    $host_tcp_imap -p 143 -wt 9 -ct 9 -to 10 -e '* OK'", 0, undef, %exceptions );
 $t += checkCmd( "./check_imap    $host_tcp_imap -p 143 -wt 9 -ct 9 -to 10 -e '* OK'", 0, undef, %exceptions );
 $t += checkCmd( "./check_imap    $host_nonresponsive", 2 );
 $t += checkCmd( "./check_imap    $host_nonresponsive", 2 );
 $t += checkCmd( "./check_imap    $hostname_invalid",   2 );
 $t += checkCmd( "./check_imap    $hostname_invalid",   2 );
+$t += checkCmd( "./check_imap -H $host_tcp_imap -e unlikely_string",                  1);
+$t += checkCmd( "./check_imap -H $host_tcp_imap -e unlikely_string -M crit",          2);
 
 
 
 
 exit(0) if defined($Test::Harness::VERSION);
 exit(0) if defined($Test::Harness::VERSION);