diff options
author | Greg Sabino Mullane | 2010-11-08 18:00:10 +0000 |
---|---|---|
committer | Greg Sabino Mullane | 2010-11-08 18:00:10 +0000 |
commit | c54c4d041bb164c201f5da2de217496c9f4e261c (patch) | |
tree | 24e9e86d13bfd712db03c785c1f22c566c6f7c69 /check_postgres.pl | |
parent | 5c210e8f42b1a3bc8cfc7de57756a53ea0b78caf (diff) |
Add --quiet argument.
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-x | check_postgres.pl | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/check_postgres.pl b/check_postgres.pl index 002c92053..fb79e5944 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -675,6 +675,7 @@ die $USAGE unless 'version|V', 'verbose|v+', 'help|h', + 'quiet|q', 'man', 'output=s', 'simple', @@ -1164,7 +1165,12 @@ sub finishup { $action =~ s/^\s*(\S+)\s*$/$1/; my $service = sprintf "%s$action", $FANCYNAME ? 'postgres_' : ''; if (keys %critical or keys %warning or keys %ok or keys %unknown) { - printf '%s ', $YELLNAME ? uc $service : $service; + ## If in quiet mode, print nothing if all is ok + if ($opt{quiet} and ! keys %critical and ! keys %warning and ! keys %unknown) { + } + else { + printf '%s ', $YELLNAME ? uc $service : $service; + } } sub dumpresult { @@ -1208,8 +1214,11 @@ sub finishup { exit 1; } if (keys %ok) { - print 'OK: '; - dumpresult(o => \%ok); + ## We print nothing if in quiet mode + if (! $opt{quiet}) { + print 'OK: '; + dumpresult(o => \%ok); + } exit 0; } if (keys %unknown) { @@ -8740,6 +8749,7 @@ Items not specifically attributed are by Greg Sabino Mullane. =item B<Version 2.15.0> + Add --quiet argument to surpress output on OK Nagios results Add index comparison for same_schema (Norman Yamada and Greg Sabino Mullane) Use $ENV{PGSERVICE} instead of "service=" to prevent problems (Guillaume Lelarge) Add --man option to show the entire manual. (Andy Lester) |