aboutsummaryrefslogtreecommitdiff
path: root/plugins-scripts/check_disk_smb.pl
diff options
context:
space:
mode:
authorGravatar Rafael <rafa.driutti@gmail.com> 2013-08-12 15:52:22 -0300
committerGravatar Rafael <rafa.driutti@gmail.com> 2013-08-12 15:52:22 -0300
commitfebe7b707524c0bb84271599e94d4effd3c23053 (patch)
tree31c29b96993a8b86b9399441479597b5aad8ec70 /plugins-scripts/check_disk_smb.pl
parentb6f0e755fda5d95ccc7312fd4c99e1e707210d6c (diff)
downloadmonitoring-plugins-febe7b707524c0bb84271599e94d4effd3c23053.tar.gz
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.
Diffstat (limited to 'plugins-scripts/check_disk_smb.pl')
-rwxr-xr-xplugins-scripts/check_disk_smb.pl6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl
index 43841c36..b547615b 100755
--- a/plugins-scripts/check_disk_smb.pl
+++ b/plugins-scripts/check_disk_smb.pl
@@ -176,7 +176,7 @@ $SIG{'ALRM'} = sub {
};
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
my @cmd = (
$smbclient,
@@ -185,7 +185,7 @@ my @cmd = (
defined($workgroup) ? ("-W", $workgroup) : (),
defined($address) ? ("-I", $address) : (),
defined($opt_P) ? ("-p", $opt_P) : (),
- "-c", "ls"
+ "-c", "du"
);
print join(" ", @cmd) . "\n" if ($verbose);
@@ -198,7 +198,7 @@ alarm(0);
@lines = split /\n/, $res;
#Get the last line into $_
-$_ = $lines[$#lines];
+$_ = $lines[$#lines-1];
#print "$_\n";
#Process the last line to get free space.