Projet

Général

Profil

Révision 879686e5

ID879686e59c12fc893aef4f6e82c44282825f029d
Parent 9c5d4d67
Enfant 835b2e3f

Ajouté par Nicolas Joyard il y a presque 9 ans

dirsizes: use clean_fieldnames

Voir les différences:

plugins/disk/dirsizes
26 26
#
27 27

  
28 28
use strict;
29
use Munin::Plugin;
29 30
my @watchdirs;
30 31

  
31 32
if ( exists $ARGV[0] and $ARGV[0] eq "test" ) {
......
59 60
    foreach my $dir (@watchdirs) {
60 61

  
61 62
        # Remove illegal characters
62
        my $label = $dir;
63
        $label =~ s@[\/-]@_@g;
63
        my $label = clean_fieldname($dir);
64 64

  
65 65
        # Print name
66 66
        print "dir", $label, ".label ", $dir, "\n";
......
72 72

  
73 73
    # All available directories
74 74
    foreach my $dir (@watchdirs) {
75

  
76 75
        # Remove illegal characters
77
        my $label = $dir;
78
        $label =~ s@[\/-]@_@g;
76
        my $label = clean_fieldname($dir);
79 77

  
80 78
        # Get the dirsize
81 79
        my $dirsize = getSize($dir);
82 80

  
83
        # Get the label
84
        my $label = niceLabelname($dir);
85

  
86 81
        # Print name
87 82
        print "dir", $label, ".value ", $dirsize, ".0\n";
88 83
    }
......
97 92
    return @dirsize[0];
98 93
}
99 94

  
100
# Remove illegal characters
101
sub niceLabelname {
102
    my ($label) = @_;
103

  
104
    $label =~ s@[\/-]@_@g;
105
    return $label;
106
}
107

  
108 95
exit 0;
109 96

  

Formats disponibles : Unified diff