summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael <rafa.driutti@gmail.com>2013-08-12 18:52:22 (GMT)
committerRafael <rafa.driutti@gmail.com>2013-08-12 18:52:22 (GMT)
commitfebe7b707524c0bb84271599e94d4effd3c23053 (patch)
tree31c29b96993a8b86b9399441479597b5aad8ec70
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.refs/pull/63/head
-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 43841c3..b547615 100755
--- a/plugins-scripts/check_disk_smb.pl
+++ b/plugins-scripts/check_disk_smb.pl
@@ -176,7 +176,7 @@ $SIG{'ALRM'} = sub {
176}; 176};
177alarm($TIMEOUT); 177alarm($TIMEOUT);
178 178
179# Execute an "ls" on the share using smbclient program 179# Execute a "du" on the share using smbclient program
180# get the results into $res 180# get the results into $res
181my @cmd = ( 181my @cmd = (
182 $smbclient, 182 $smbclient,
@@ -185,7 +185,7 @@ my @cmd = (
185 defined($workgroup) ? ("-W", $workgroup) : (), 185 defined($workgroup) ? ("-W", $workgroup) : (),
186 defined($address) ? ("-I", $address) : (), 186 defined($address) ? ("-I", $address) : (),
187 defined($opt_P) ? ("-p", $opt_P) : (), 187 defined($opt_P) ? ("-p", $opt_P) : (),
188 "-c", "ls" 188 "-c", "du"
189); 189);
190 190
191print join(" ", @cmd) . "\n" if ($verbose); 191print join(" ", @cmd) . "\n" if ($verbose);
@@ -198,7 +198,7 @@ alarm(0);
198@lines = split /\n/, $res; 198@lines = split /\n/, $res;
199 199
200#Get the last line into $_ 200#Get the last line into $_
201$_ = $lines[$#lines]; 201$_ = $lines[$#lines-1];
202#print "$_\n"; 202#print "$_\n";
203 203
204#Process the last line to get free space. 204#Process the last line to get free space.