Explorar el Código

Changed the smbclient command used to fetch the free space available on the samba shares. Using du instead of ls, since it's much faster, specially with shares that have a lot of files.

Rafael hace 12 años
padre
commit
febe7b7075
Se han modificado 1 ficheros con 3 adiciones y 3 borrados
  1. 3 3
      plugins-scripts/check_disk_smb.pl

+ 3 - 3
plugins-scripts/check_disk_smb.pl

@@ -176,7 +176,7 @@ $SIG{'ALRM'} = sub {
 };
 };
 alarm($TIMEOUT);
 alarm($TIMEOUT);
 
 
-# Execute an "ls" on the share using smbclient program
+# Execute a "du" on the share using smbclient program
 # get the results into $res
 # get the results into $res
 my @cmd = (
 my @cmd = (
 	$smbclient,
 	$smbclient,
@@ -185,7 +185,7 @@ my @cmd = (
 	defined($workgroup) ? ("-W", $workgroup) : (),
 	defined($workgroup) ? ("-W", $workgroup) : (),
 	defined($address) ? ("-I", $address) : (),
 	defined($address) ? ("-I", $address) : (),
 	defined($opt_P) ? ("-p", $opt_P) : (),
 	defined($opt_P) ? ("-p", $opt_P) : (),
-	"-c", "ls"
+	"-c", "du"
 );
 );
 
 
 print join(" ", @cmd) . "\n" if ($verbose);
 print join(" ", @cmd) . "\n" if ($verbose);
@@ -198,7 +198,7 @@ alarm(0);
 @lines = split /\n/, $res;
 @lines = split /\n/, $res;
 
 
 #Get the last line into $_
 #Get the last line into $_
-$_ = $lines[$#lines];
+$_ = $lines[$#lines-1];
 #print "$_\n";
 #print "$_\n";
 
 
 #Process the last line to get free space.  
 #Process the last line to get free space.