summaryrefslogtreecommitdiff
path: root/httemplate/misc/xmlhttp-ping.html
blob: e99303207f01d1815b4f2660ba60db7cf39ed0c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<% objToJson($return) %>
<%init>

my $conf = new FS::Conf;

my $sub = $cgi->param('sub');

die "$sub not supported" unless $sub eq 'ping';

my $ip = $cgi->param('arg');

my $ping = new Net::Ping('external', 5);
$ping->hires(1);
#my $a=time; warn "pinging\n";
my ($ret, $duration, $ip2) = $ping->ping($ip);
#warn "done pinging (". int(time-$a). "s)\n";

my $return = [ $ret, $duration ];

</%init>