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.
This commit is contained in:
parent
2e16d2f845
commit
065d4f129c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue