use strict; use IO::Select; use IO::Socket; use Fcntl; use POSIX qw(:signal_h WNOHANG); use Net::SNMP; use DBI; use Sys::Hostname; use Getopt::Long qw(:config pass_through ); $|++; umask(0177); (my $VERSION = '$Revision: 1.23 $') =~ s/\$(.+) \$/$1/; my $MAXCHILDREN = 10; my $inputFile = "./mping.lookup"; my $path = "./unix_socket"; my $OID = '.1.3.6.1.4.1.15102.2.1.1.1'; my $interval = 60; my %source; my %failures; my $dump = 0; my $run = 0; my $version = 0; my %options = ( 'version' => \$version, 'children=i' => \$MAXCHILDREN, 'input' => \$inputFile, 'socket' => \$path, 'dump' => \$dump, 'run' => \$run, ); $SIG{TERM} = $SIG{INT} = sub { unlink $path; exit 0 }; GetOptions(%options); if (${$options{dump}}) { print $VERSION,"\n"; print "There are $MAXCHILDREN child processes by default\n"; print "Input file is ",${$options{input}},":\n"; print "Comm socket is ",${$options{socket}},":\n"; exit if ! ${$options{run}}; } if (${$options{version}}) { print $VERSION,"\n"; exit if ! ${$options{run}}; }