diff options
author | Rafael <rafa.driutti@gmail.com> | 2013-08-12 15:52:22 -0300 |
---|---|---|
committer | Rafael <rafa.driutti@gmail.com> | 2013-08-12 15:52:22 -0300 |
commit | febe7b707524c0bb84271599e94d4effd3c23053 (patch) | |
tree | 31c29b96993a8b86b9399441479597b5aad8ec70 /plugins-scripts | |
parent | b6f0e755fda5d95ccc7312fd4c99e1e707210d6c (diff) | |
download | monitoring-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')
-rwxr-xr-x | plugins-scripts/check_disk_smb.pl | 6 |
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 { | |||
176 | }; | 176 | }; |
177 | alarm($TIMEOUT); | 177 | alarm($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 |
181 | my @cmd = ( | 181 | my @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 | ||
191 | print join(" ", @cmd) . "\n" if ($verbose); | 191 | print 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. |