Skip to content

Commit

Permalink
workaround "root" field name bug
Browse files Browse the repository at this point in the history
2.0 master has a bug that makes a field named "root" not allowed anymore.
This commit is a workaround in order for these graphs to be displayed again.

Proper resolution is due in master, not in the plugins. But patch is much more
invasive. So delaying it to 2.1.
  • Loading branch information
steveschnepp committed Jun 27, 2012
1 parent 4693bc3 commit 5774c17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions plugins/lib/Munin/Plugin.pm
Expand Up @@ -167,6 +167,9 @@ sub clean_fieldname ($) {
# Replace remaining illegals with _
$name =~ s/[^A-Za-z0-9_]/_/g;

# "root" is *not* allowed due to a 2.0 bug
$name = "__root" if $name eq "root";

return $name;
}

Expand Down
5 changes: 3 additions & 2 deletions plugins/plugin.sh.in
Expand Up @@ -9,8 +9,9 @@ clean_fieldname () {
# very much still break munin.
#
# usage: name="$(clean_fieldname "$item")"
#
echo "$@" | sed -e 's/^[^A-Za-z_]/_/' -e 's/[^A-Za-z0-9_]/_/g'

# "root" is *not* allowed due to a 2.0 bug
echo "$@" | sed -e 's/^[^A-Za-z_]/_/' -e 's/[^A-Za-z0-9_]/_/g' -e 's/^root$/__root/'
}


Expand Down

0 comments on commit 5774c17

Please sign in to comment.