summaryrefslogtreecommitdiffstats
path: root/web/attachments/382258-nagios-plugins-check_disk_smb.patch
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/382258-nagios-plugins-check_disk_smb.patch')
-rw-r--r--web/attachments/382258-nagios-plugins-check_disk_smb.patch62
1 files changed, 62 insertions, 0 deletions
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 @@
1diff -urN nagios-plugins-1.4.15/plugins-scripts/check_disk_smb.pl nagios-plugins-1.4.15.new/plugins-scripts/check_disk_smb.pl
2--- nagios-plugins-1.4.15/plugins-scripts/check_disk_smb.pl 2010-07-27 22:47:16.000000000 +0200
3+++ nagios-plugins-1.4.15.new/plugins-scripts/check_disk_smb.pl 2010-08-04 14:06:46.000000000 +0200
4@@ -208,7 +208,11 @@
5 my ($avail_bytes) = $avail;
6 my ($capper) = int(($3/$1)*100);
7 my ($mountpt) = "\\\\$host\\$share";
8-
9+ my ($mountptprint) = "//$host/$share";
10+ my $warn_bytes;
11+ my $crit_bytes;
12+ my ($tot_bytes) = ($1*$2)/1024;
13+ my ($used_bytes) = (($1-$3)*$2)/1024;
14
15 if (int($avail / 1024) > 0) {
16 $avail = int($avail / 1024);
17@@ -221,19 +225,33 @@
18 } else {
19 $avail = $avail ."K";
20 }
21+
22+ if ($warn_type eq "P") {
23+ $warn_bytes=int($tot_bytes/100*$warn);
24+ } else {
25+ $warn_bytes=$warn;
26+ }
27+
28+ if ($crit_type eq "P") {
29+ $crit_bytes=int($tot_bytes/100*$crit);
30+ } else {
31+ $crit_bytes=$crit;
32+ }
33+
34+ my ($perfdata) = "$mountptprint=$used_bytes;$warn_bytes;$crit_bytes;0;$tot_bytes";
35
36 #print ":$warn:$warn_type:\n";
37 #print ":$crit:$crit_type:\n";
38 #print ":$avail:$avail_bytes:$capper:$mountpt:\n";
39
40 if ((($warn_type eq "P") && (100 - $capper) < $warn) || (($warn_type eq "K") && ($avail_bytes > $warn))) {
41- $answer = "Disk ok - $avail ($capper%) free on $mountpt\n";
42+ $answer = "Disk ok - $avail ($capper%) free on $mountptprint|$perfdata\n";
43 } elsif ((($crit_type eq "P") && (100 - $capper) < $crit) || (($crit_type eq "K") && ($avail_bytes > $crit))) {
44 $state = "WARNING";
45- $answer = "WARNING: Only $avail ($capper%) free on $mountpt\n";
46+ $answer = "WARNING: Only $avail ($capper%) free on $mountptprint|$perfdata\n";
47 } else {
48 $state = "CRITICAL";
49- $answer = "CRITICAL: Only $avail ($capper%) free on $mountpt\n";
50+ $answer = "CRITICAL: Only $avail ($capper%) free on $mountptprint|$perfdata\n";
51 }
52 } else {
53 $answer = "Result from smbclient not suitable\n";
54@@ -250,7 +268,7 @@
55 last;
56 }
57 if (/(You specified an invalid share name|NT_STATUS_BAD_NETWORK_NAME)/) {
58- $answer = "Invalid share name \\\\$host\\$share\n";
59+ $answer = "Invalid share name //$host//$share\n";
60 $state = "CRITICAL";
61 last;
62 }