mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
dirsizes: use clean_fieldnames
This commit is contained in:
parent
9c5d4d673c
commit
879686e59c
1 changed files with 3 additions and 16 deletions
|
@ -26,6 +26,7 @@
|
|||
#
|
||||
|
||||
use strict;
|
||||
use Munin::Plugin;
|
||||
my @watchdirs;
|
||||
|
||||
if ( exists $ARGV[0] and $ARGV[0] eq "test" ) {
|
||||
|
@ -59,8 +60,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
|
|||
foreach my $dir (@watchdirs) {
|
||||
|
||||
# Remove illegal characters
|
||||
my $label = $dir;
|
||||
$label =~ s@[\/-]@_@g;
|
||||
my $label = clean_fieldname($dir);
|
||||
|
||||
# Print name
|
||||
print "dir", $label, ".label ", $dir, "\n";
|
||||
|
@ -72,17 +72,12 @@ else {
|
|||
|
||||
# All available directories
|
||||
foreach my $dir (@watchdirs) {
|
||||
|
||||
# Remove illegal characters
|
||||
my $label = $dir;
|
||||
$label =~ s@[\/-]@_@g;
|
||||
my $label = clean_fieldname($dir);
|
||||
|
||||
# Get the dirsize
|
||||
my $dirsize = getSize($dir);
|
||||
|
||||
# Get the label
|
||||
my $label = niceLabelname($dir);
|
||||
|
||||
# Print name
|
||||
print "dir", $label, ".value ", $dirsize, ".0\n";
|
||||
}
|
||||
|
@ -97,13 +92,5 @@ sub getSize {
|
|||
return @dirsize[0];
|
||||
}
|
||||
|
||||
# Remove illegal characters
|
||||
sub niceLabelname {
|
||||
my ($label) = @_;
|
||||
|
||||
$label =~ s@[\/-]@_@g;
|
||||
return $label;
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue