summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2010-10-07 11:38:10 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2010-10-07 11:38:10 +0000
commit7011353c35e0a11c06647d9f573b221209832bf2 (patch)
treec7dc2e408b59d3a9d5519010d7abb207f66f7801
parent859d4335dfbcf10ffd774151ff7cc40950478e72 (diff)
Add a --quiet to nagios-check-libs to make it shut up when all is well. Based on patch by Holger Levsen
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@457 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
-rwxr-xr-xnagios-check-libs13
1 files changed, 7 insertions, 6 deletions
diff --git a/nagios-check-libs b/nagios-check-libs
index 1ad3458..b041144 100755
--- a/nagios-check-libs
+++ b/nagios-check-libs
@@ -49,12 +49,13 @@ sub dief {
if (!GetOptions (
'--help' => \$params->{'help'},
'--version' => \$params->{'version'},
+ '--quiet' => \$params->{'quiet'},
'--verbose' => \$params->{'verbose'},
)) {
- dief ("$PROGRAM_NAME: Usage: $PROGRAM_NAME [--help|--version] [--verbose]\n");
+ dief ("$PROGRAM_NAME: Usage: $PROGRAM_NAME [--help|--version] [--verbose] [--quiet]\n");
};
if ($params->{'help'}) {
- print "$PROGRAM_NAME: Usage: $PROGRAM_NAME [--help|--version] [--verbose]\n";
+ print "$PROGRAM_NAME: Usage: $PROGRAM_NAME [--help|--version] [--verbose] [--quiet]\n";
print "Reports processes that are linked against libraries that no longer exist.\n";
exit (0);
};
@@ -125,14 +126,14 @@ for my $line (@lsof) {
-my $message;
+my $message='';
my $exit = $OK;
if (keys %processes) {
$exit = $WARNING;
- $message = 'The following processes have libs linked that were upgraded: '. getUsers();
+ $message = 'The following processes have libs linked that were upgraded: '. getUsers()."\n";
} else {
- $message = 'No upgraded libs linked in running processes';
+ $message = "No upgraded libs linked in running processes\n" unless $params->{'quiet'};
};
-print $message,"\n";
+print $message;
exit $exit;