4
0

check_fping.t 1.1 KB

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