From 7011353c35e0a11c06647d9f573b221209832bf2 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 7 Oct 2010 11:38:10 +0000 Subject: 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 --- nagios-check-libs | 13 +++++++------ 1 file 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; -- cgit v1.2.3