From 1fa9566e915cbbfcdca004d128721ed5ec7207b8 Mon Sep 17 00:00:00 2001 From: neingeist Date: Thu, 19 Jan 2017 16:30:58 +0100 Subject: [PATCH] Add option --no-thinpools-ok to silence warning when no pools are found --- check_lvm_thinpools | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/check_lvm_thinpools b/check_lvm_thinpools index 46f573b..3166815 100755 --- a/check_lvm_thinpools +++ b/check_lvm_thinpools @@ -1,6 +1,7 @@ #!/usr/bin/perl use strict; use warnings; +use Getopt::Long; my $warn = 92.0; my $crit = 96.0; @@ -74,12 +75,22 @@ sub aggregate_errors { return; } + +my $no_thinpools_ok = 0; +GetOptions("no-thinpools-ok" => \$no_thinpools_ok) + or die("Error in command line arguments\n"); + my @thinpools = get_thinpools(); # No thinpool found? if (scalar @thinpools == 0) { - print "UNKNOWN: No thinpools found.\n"; - exit 3; + if ($no_thinpools_ok == 1) { + print "OK: No thinpools found.\n"; + exit 0; + } else { + print "UNKNOWN: No thinpools found.\n"; + exit 3; + } } else { check_thinpools(); aggregate_errors();