Skip to content

Commit

Permalink
nfsping always reports in milliseconds
Browse files Browse the repository at this point in the history
  • Loading branch information
mprovost committed Aug 26, 2016
1 parent cb5aa0a commit afb3f8b
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions Smokeping/NFSping.pm
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,14 @@ sub new($$$)
# no need for this if we run as a cgi
unless ( $ENV{SERVER_SOFTWARE} ) {
my $binary = join(" ", $self->binary);
my $testhost = $self->testhost;
my $testhost = $self->testhost;
my $return = `$binary -C 1 $testhost 2>&1`;
croak "ERROR: nfsping ('$binary -C 1 $testhost') could not be run: $return"
if $return =~ m/not found/;

if ($return =~ m/([0-9.]+)\sms\s+.*\n.*\n.*:\s+([0-9.]+)/ and $1 > 0){
$self->{pingfactor} = 1000 * $2/$1;
if ($1 != $2){
warn "### nfsping seems to report in ", $2/$1, " milliseconds (old version?)";
}
} else {
$self->{pingfactor} = 1000; # Gives us a good-guess default
warn "### assuming you are using an nfsping copy reporting in milliseconds\n";
}
};

$self->{pingfactor} = 1000; # nfsping always reports in milliseconds

return $self;
}

Expand Down

0 comments on commit afb3f8b

Please sign in to comment.