Merge pull request #2056 from monitoring-plugins/fix_check_http_state_regex
[monitoring-plugins.git] / plugins / t / check_ftp.t
blob93a7d7c3717f8fa5190036e7553dc18e80895b47
1 #! /usr/bin/perl -w -I ..
3 # File Transfer Protocol (FTP) Test via check_ftp
7 use strict;
8 use Test;
9 use NPTest;
11 use vars qw($tests);
12 BEGIN {$tests = 4; plan tests => $tests}
14 my $host_tcp_ftp = getTestParameter("NP_HOST_TCP_FTP", "A host providing the FTP Service (an FTP server)", "localhost");
15 my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1");
16 my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost");
18 my $successOutput = '/FTP OK -\s+[0-9]?\.?[0-9]+ second response time/';
20 my $t;
22 $t += checkCmd( "./check_ftp $host_tcp_ftp -wt 300 -ct 600", 0, $successOutput );
23 $t += checkCmd( "./check_ftp $host_nonresponsive -wt 0 -ct 0 -to 1", 2 );
24 $t += checkCmd( "./check_ftp $hostname_invalid -wt 0 -ct 0", 2 );
26 exit(0) if defined($Test::Harness::VERSION);
27 exit($tests - $t);