From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- .../382258-nagios-plugins-check_disk_smb.patch | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 web/attachments/382258-nagios-plugins-check_disk_smb.patch (limited to 'web/attachments/382258-nagios-plugins-check_disk_smb.patch') diff --git a/web/attachments/382258-nagios-plugins-check_disk_smb.patch b/web/attachments/382258-nagios-plugins-check_disk_smb.patch new file mode 100644 index 0000000..31c6873 --- /dev/null +++ b/web/attachments/382258-nagios-plugins-check_disk_smb.patch @@ -0,0 +1,62 @@ +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; + } -- cgit v1.2.3-74-g34f1