Allow for _ in original dataset name

The current code escapes / (which is legal as part of a dataset name for ZFS, but illegal as part of a munin graph name) into _ (which is legal for both). The result is that any _ characters in the original filename get changed into / in the legend, which is confusing.

Fix by escaping any existing _ characters into __ first, and then later replacing // into _ again. // is a sequence that will not occur in a ZFS dataset name, so any double-/ sequence must therefore have been a _ originally.
This commit is contained in:
Wouter Verhelst 2017-09-18 13:56:29 +02:00 committed by GitHub
parent a8d117a3f0
commit 608a2a5ad7
1 changed files with 2 additions and 0 deletions

View File

@ -160,6 +160,7 @@ sub do_collect {
foreach my $line (split(/\n/, `$fsget` )) {
my ($name, $key, $value, undef ) = (split(/\t/,$line));
($name =~ s/_/__/g);
($name =~ s/\//_/g);
$filesystems->{$name}->{$key}=$value;
}
@ -170,6 +171,7 @@ sub do_config_fs {
my ($fs) = @_;
my $fs_slash = ($fs);
($fs_slash =~ s/_/\//g);
($fs_slash =~ s/\/\//_/g);
if ( $fs ne $zpool ) {
printf( "multigraph zfs_usage_%s.%s\n",