-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcl-ping.pl
executable file
·55 lines (37 loc) · 1.28 KB
/
cl-ping.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env perl
$|++;
###########################################################################
# #
# Cluster Tools: cl-ping.pl #
# Copyright 2007-2011, Albert P. Tobey <[email protected]> #
# #
###########################################################################
=head1 NAME
cl-ping.pl - ping the cluster
=head1 SYNOPSIS
cl-ping.pl
=cut
use strict;
use warnings;
use Getopt::Long;
use Pod::Usage;
use FindBin qw($Bin);
use lib $Bin;
use DshPerlHostLoop;
func_loop( sub {
my $hostname = shift;
my @out = `ping -c 1 -W 2 $hostname 2>&1`;
if ($? != 0) {
print "DOWN: $hostname\n";
}
print grep {/bytes from/} @out;
} );
# vim: et ts=4 sw=4 ai smarttab
__END__
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2007-2011 by Al Tobey.
This is free software; you can redistribute it and/or modify it under the terms
of the Artistic License 2.0. (Note that, unlike the Artistic License 1.0,
version 2.0 is GPL compatible by itself, hence there is no benefit to having an
Artistic 2.0 / GPL disjunction.) See the file LICENSE for details.
=cut