diff options
Diffstat (limited to 'nagios-check-libs')
-rwxr-xr-x | nagios-check-libs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/nagios-check-libs b/nagios-check-libs index 0a16b79..f357a73 100755 --- a/nagios-check-libs +++ b/nagios-check-libs @@ -21,12 +21,18 @@ my $UNKNOWN = 3; my $params; Getopt::Long::config('bundling'); + +sub dief { + print STDERR $_; + exit $UNKNOWN; +} + if (!GetOptions ( '--help' => \$params->{'help'}, '--version' => \$params->{'version'}, '--verbose' => \$params->{'verbose'}, )) { - die ("$PROGRAM_NAME: Usage: $PROGRAM_NAME [--help|--version] [--verbose]\n"); + dief ("$PROGRAM_NAME: Usage: $PROGRAM_NAME [--help|--version] [--verbose]\n"); }; if ($params->{'help'}) { print "$PROGRAM_NAME: Usage: $PROGRAM_NAME [--help|--version] [--verbose]\n"; @@ -40,12 +46,6 @@ if ($params->{'version'}) { exit (0); }; -$SIG{'__DIE__'} = sub { - print STDERR @_; - exit $UNKNOWN; -}; - - my %processes; sub getPIDs($$) { @@ -84,11 +84,11 @@ sub inVserver() { my $INVSERVER = inVserver(); print STDERR "Running $LSOF -n\n" if $params->{'verbose'}; -open (LSOF, "$LSOF -n|") or die ("Cannot run $LSOF -n: $!\n"); +open (LSOF, "$LSOF -n|") or dief ("Cannot run $LSOF -n: $!\n"); my @lsof=<LSOF>; close LSOF; if ($CHILD_ERROR) { # program failed - die("$LSOF -n returned with non-zero exit code: ".($CHILD_ERROR / 256)."\n"); + dief("$LSOF -n returned with non-zero exit code: ".($CHILD_ERROR / 256)."\n"); }; for my $line (@lsof) { |