2009-02-06 Sancho Lerena <slerena@artica.es>
* util/plugin/multicast.pl: Multicast check plugin. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1428 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
8482582c9f
commit
c895f84161
|
@ -1,3 +1,7 @@
|
|||
2009-02-06 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* util/plugin/multicast.pl: Multicast check plugin.
|
||||
|
||||
2009-02-04 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* lib/PandoraFMS/DB.pm: Read template default action on alert
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use IO::Socket::Multicast;
|
||||
use Getopt::Long;
|
||||
|
||||
# Sample usage: ./multicast.pl -g 239.255.255.255 -p 1234 -t 30
|
||||
my ($group,$port,$timeout);
|
||||
|
||||
GetOptions(
|
||||
"h" => sub { help() },
|
||||
"help" => sub { help() },
|
||||
"g=s" => \$group,
|
||||
"p=s" => \$port,
|
||||
"t=i" => \$timeout
|
||||
);
|
||||
|
||||
if(!$timeout){
|
||||
$timeout=5
|
||||
};
|
||||
|
||||
alarm($timeout);
|
||||
|
||||
$SIG{ALRM} = sub {print "0"; exit 1; };
|
||||
|
||||
my $sock = IO::Socket::Multicast->new(Proto=>'udp', LocalPort=>$port);
|
||||
$sock->mcast_add($group) || die "0";
|
||||
|
||||
my $data;
|
||||
next unless $sock->recv($data,1024);
|
||||
print "1";
|
||||
exit 0;
|
||||
|
||||
sub help {
|
||||
print "\nPandora FMS Plugin for Check Multicast\n\n";
|
||||
print "Syntax: \n\n ./multicast.pl -g <group> -p <port> -t <timeout> \n\n";
|
||||
print "Sample usage: ./multicast.pl -g 239.255.255.255 -p 1234 -t 10 \n\n";
|
||||
exit -1;
|
||||
}
|
Loading…
Reference in New Issue