check_fping.t 1.1 KB

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