From cd3c2b0f1760c894075893ee7a6689eaa6fc2c6b Mon Sep 17 00:00:00 2001 From: Sergey Ivanov <seriv@cs.umd.edu> Date: Tue, 5 Jun 2012 01:10:07 -0400 Subject: [PATCH] Fix regexp check to match '^$' When ./check_resmon_metric -H myhost -M Core::Fmadm -C failures -m resources -r '^$' Use of uninitialized value $value in pattern match (m//) at /etc/nagios3/CS.conf.d/check_resmon_metric line 378. Use of uninitialized value $value in concatenation (.) or string at /etc/nagios3/CS.conf.d/check_resmon_metric line 383. OK: resources - To avoid false critical status check if $value is not defined and if so define as empty string --- resources/check_resmon_metric | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/check_resmon_metric b/resources/check_resmon_metric index dda6845..1171f1d 100755 --- a/resources/check_resmon_metric +++ b/resources/check_resmon_metric @@ -374,6 +374,9 @@ eval { } if (defined $regex) { + if (!defined($value)) { + $value = ''; + } if ($value =~ /$regex/) { $state = "OK"; } else { -- GitLab