diff -urN nagios-plugins-1.4.15/plugins-scripts/check_disk_smb.pl nagios-plugins-1.4.15.new/plugins-scripts/check_disk_smb.pl --- nagios-plugins-1.4.15/plugins-scripts/check_disk_smb.pl 2010-07-27 22:47:16.000000000 +0200 +++ nagios-plugins-1.4.15.new/plugins-scripts/check_disk_smb.pl 2010-08-04 14:06:46.000000000 +0200 @@ -208,7 +208,11 @@ my ($avail_bytes) = $avail; my ($capper) = int(($3/$1)*100); my ($mountpt) = "\\\\$host\\$share"; - + my ($mountptprint) = "//$host/$share"; + my $warn_bytes; + my $crit_bytes; + my ($tot_bytes) = ($1*$2)/1024; + my ($used_bytes) = (($1-$3)*$2)/1024; if (int($avail / 1024) > 0) { $avail = int($avail / 1024); @@ -221,19 +225,33 @@ } else { $avail = $avail ."K"; } + + if ($warn_type eq "P") { + $warn_bytes=int($tot_bytes/100*$warn); + } else { + $warn_bytes=$warn; + } + + if ($crit_type eq "P") { + $crit_bytes=int($tot_bytes/100*$crit); + } else { + $crit_bytes=$crit; + } + + my ($perfdata) = "$mountptprint=$used_bytes;$warn_bytes;$crit_bytes;0;$tot_bytes"; #print ":$warn:$warn_type:\n"; #print ":$crit:$crit_type:\n"; #print ":$avail:$avail_bytes:$capper:$mountpt:\n"; if ((($warn_type eq "P") && (100 - $capper) < $warn) || (($warn_type eq "K") && ($avail_bytes > $warn))) { - $answer = "Disk ok - $avail ($capper%) free on $mountpt\n"; + $answer = "Disk ok - $avail ($capper%) free on $mountptprint|$perfdata\n"; } elsif ((($crit_type eq "P") && (100 - $capper) < $crit) || (($crit_type eq "K") && ($avail_bytes > $crit))) { $state = "WARNING"; - $answer = "WARNING: Only $avail ($capper%) free on $mountpt\n"; + $answer = "WARNING: Only $avail ($capper%) free on $mountptprint|$perfdata\n"; } else { $state = "CRITICAL"; - $answer = "CRITICAL: Only $avail ($capper%) free on $mountpt\n"; + $answer = "CRITICAL: Only $avail ($capper%) free on $mountptprint|$perfdata\n"; } } else { $answer = "Result from smbclient not suitable\n"; @@ -250,7 +268,7 @@ last; } if (/(You specified an invalid share name|NT_STATUS_BAD_NETWORK_NAME)/) { - $answer = "Invalid share name \\\\$host\\$share\n"; + $answer = "Invalid share name //$host//$share\n"; $state = "CRITICAL"; last; }