From 97ff6b23a01b763795bf328aa4852b0fb8aacac1 Mon Sep 17 00:00:00 2001
From: Mark Harrison <mark@omniti.com>
Date: Tue, 17 Dec 2013 11:32:42 -0500
Subject: [PATCH] Fix error when reading meminfo

On some systems, there are lines in /proc/meminfo that don't match the regex.
Currently these cause resmon to throw an error and give a blank metric. This
change skips those metrics rather than throwing an error.
---
 lib/Core/Memstat.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/Core/Memstat.pm b/lib/Core/Memstat.pm
index 567cab0..7bc58a9 100644
--- a/lib/Core/Memstat.pm
+++ b/lib/Core/Memstat.pm
@@ -131,6 +131,7 @@ sub handler {
         open(MEMINFO, '/proc/meminfo') || die "Unable to read proc: $!\n";
         while (<MEMINFO>) {
             /(\w+)\:\s+(\d+).*/;
+            next unless defined($1);
             $metrics{$1} = [$2, 'L'];
         }
         close(MEMINFO);
-- 
GitLab