From 065d4f129c3bf5ff78f26adcea82ee2b184f3db1 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Sat, 1 Feb 2020 16:44:44 -0500 Subject: [PATCH] relayd: avoid matching table defs within comments if a table is commented out, you currently get an entry for the hosts that the entry contains but you'll get NaN for those hosts all the time if they are not defined elsewhere. to avoid that we anchor our match to the beginning of lines and permit leading spaces since some folks might like to indent lines. --- plugins/relayd/relayd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/relayd/relayd b/plugins/relayd/relayd index aef563ae..bddbbdcf 100755 --- a/plugins/relayd/relayd +++ b/plugins/relayd/relayd @@ -68,7 +68,7 @@ my $cmd = (defined($ARGV[0])) ? $ARGV[0] : ''; my @hosts = (); open(my $conf, "<", $configfile) or die "can't open $configfile: $!"; my $content = join("", <$conf>); -while ( $content =~ /table\s*<([^>]+)>\s*{([^}]+)}/g) { +while ( $content =~ /^\s*table\s*<([^>]+)>\s*{([^}]+)}/mg) { my $hosts = $2; print "table: $1, " if $Munin::Plugin::DEBUG; $hosts =~ s/#.*$//mg; # comments