[monitoring-plugins] allow checking 0-sized resource (ex. IPC$)

Elan Ruusamäe git at monitoring-plugins.org
Tue Oct 3 23:00:11 CEST 2023


 Module: monitoring-plugins
 Branch: master
 Commit: 487d64a4e4122ca7b389b5e26b6cdf156c877c04
 Author: Elan Ruusamäe <glen at delfi.ee>
   Date: Thu Mar  3 21:23:49 2016 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=487d64a

allow checking 0-sized resource (ex. IPC$)

patch by Marek Marczykowski <marmarek at staszic.waw.pl>

---

 plugins-scripts/check_disk_smb.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl
index 9899226..4e46397 100755
--- a/plugins-scripts/check_disk_smb.pl
+++ b/plugins-scripts/check_disk_smb.pl
@@ -212,7 +212,8 @@ if (/\s*(\d*) blocks of size (\d*)\. (\d*) blocks available/) {
 	my ($total_bytes) = $1 * $2;
 	my ($occupied_bytes) = $1 * $2 - $avail_bytes;
 	my ($avail) = $avail_bytes/1024;
-	my ($capper) = int(($3/$1)*100);
+	my ($capper);
+	if ($1!=0) { $capper = int(($3/$1)*100) } else { $capper=100 };
 	my ($mountpt) = "\\\\$host\\$share";
 
 	# TODO : why is the kB the standard unit for args ?



More information about the Commits mailing list