diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2012-02-15 07:09:57 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2012-02-15 07:09:57 +0000 |
commit | a2a262f5ee5ccfdf07f8b2bff9674fd00de5914b (patch) | |
tree | 9673f4b4afc0f5b3ec15bc1aa1511d0b754615e8 /munin-plugin | |
parent | a7ca2ad457f6d73669b3959e8f2864a6341765e5 (diff) | |
download | sitesummary-a2a262f5ee5ccfdf07f8b2bff9674fd00de5914b.tar.gz sitesummary-a2a262f5ee5ccfdf07f8b2bff9674fd00de5914b.tar.bz2 sitesummary-a2a262f5ee5ccfdf07f8b2bff9674fd00de5914b.tar.xz |
Correct how to generate label names used by Munin plugins using
the translation rule proposed by the Munin project.
Diffstat (limited to 'munin-plugin')
-rwxr-xr-x | munin-plugin | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/munin-plugin b/munin-plugin index 8c18a87..ecd8764 100755 --- a/munin-plugin +++ b/munin-plugin @@ -50,10 +50,12 @@ if (!$ARGV[0]) { sub label2key { my $label = shift; - # Removing illegal characters. Apparently using '_' as a - # replacement character break graph generation with version 1.2.5. - $label =~ s/[^a-zA-Z0-9]+//g; - return $label; + # Clean using method described on + # http://munin-monitoring.org/wiki/notes_on_datasource_names + $label =~ s/^[^A-Za-z_]/_/; + $label =~ s/[^A-Za-z0-9_]/_/g; + + return "$label"; } sub handle_host { |