5
probes::DNS - Name Service Probe for SmokePing
23
lookup=www.mozilla.org
27
Integrates dig as a probe into smokeping. The variable B<binary> must
28
point to your copy of the dig program. If it is not installed on
29
your system yet, you should install bind-utils >= 9.0.0.
31
The Probe asks the given host n-times for it's name. Where n is
32
the amount specified in the config File.
34
Supported probe-specific variables:
40
The location of your dig binary.
44
The number of concurrent processes to be run. See probes::basefork(3pm)
49
Supported target-level probe variables:
55
Name of the host to look up in the dns.
62
Igor Petrovski E<lt>pigor@myrealbox.comE<gt>,
63
Carl Elkins E<lt>carl@celkins.org.ukE<gt>,
64
Andre Stolze E<lt>stolze@uni-muenster.deE<gt>,
65
Niko Tyni E<lt>ntyni@iki.fiE<gt>,
66
Chris Poetzel<lt>cpoetzel@anl.gov<gt>
72
use base qw(probes::basefork);
77
my $dig_re=qr/query time:\s+([0-9.]+)\smsec.*/i;
82
my $class = ref($proto) || $proto;
83
my $self = $class->SUPER::new(@_);
85
# no need for this if we run as a cgi
86
unless ( $ENV{SERVER_SOFTWARE} ) {
88
croak "ERROR: DNS 'binary' not defined in FPing probe definition"
89
unless defined $self->{properties}{binary};
91
croak "ERROR: DNS 'binary' does not point to an executable"
92
unless -f $self->{properties}{binary} and -x $self->{properties}{binary};
93
my $call = "$self->{properties}{binary} localhost";
94
my $return = `$call 2>&1`;
95
if ($return =~ m/$dig_re/s){
96
$self->{pingfactor} = 1000;
97
print "### parsing dig output...OK\n";
99
croak "ERROR: output of '$call' does not match $dig_re\n";
108
return "DNS requests";
119
my $host = $target->{addr};
120
my $lookuphost = $target->{vars}{lookup};
121
$lookuphost = $target->{addr} unless defined $lookuphost;
123
#my $host = $target->{addr};
124
my $query = "$self->{properties}{binary} \@$host $lookuphost";
127
$self->do_debug("query=$query\n");
128
for (my $run = 0; $run < $self->pings($target); $run++) {
129
my $pid = open3($inh,$outh,$errh, $query);
141
@times = map {sprintf "%.10e", $_ / $self->{pingfactor}} sort {$a <=> $b} grep {$_ ne "-"} @times;
143
# $self->do_debug("time=@times\n");