1 #! /usr/bin/perl -w -I ..
2 #
3 # FPing Tests via check_fping
4 #
5 # $Id$
6 #
8 use strict;
9 use Test;
10 use NPTest;
12 use vars qw($tests);
14 BEGIN {$tests = 4; plan tests => $tests}
16 my $successOutput = '/^FPING OK - /';
17 my $failureOutput = '/^FPING CRITICAL - /';
19 my $host_responsive = getTestParameter( "host_responsive", "NP_HOST_RESPONSIVE", "localhost",
20 "The hostname of system responsive to network requests" );
22 my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1",
23 "The hostname of system not responsive to network requests" );
25 my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost",
26 "An invalid (not known to DNS) hostname" );
29 my $t;
31 if ( -x "./check_fping" )
32 {
33 $t += checkCmd( "./check_fping $host_responsive", 0, $successOutput );
34 $t += checkCmd( "./check_fping $host_nonresponsive", [ 1, 2 ] );
35 $t += checkCmd( "./check_fping $hostname_invalid", [ 1, 2 ] );
36 }
37 else
38 {
39 $t += skipMissingCmd( "./check_fping", $tests );
40 }
42 exit(0) if defined($Test::Harness::VERSION);
43 exit($tests - $t);