diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-29 22:03:24 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-29 22:03:24 (GMT) |
commit | 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 (patch) | |
tree | 1c2b6b21704a294940f87c7892676998d8371707 /web/attachments/144080-check_disk_smb.smbclient-args-patch | |
download | site-0b6423f9c99d9edf8c96fefd0f6c453859395aa1.tar.gz |
Import Nagios Plugins site
Import the Nagios Plugins web site, Cronjobs, infrastructure scripts,
and configuration files.
Diffstat (limited to 'web/attachments/144080-check_disk_smb.smbclient-args-patch')
-rw-r--r-- | web/attachments/144080-check_disk_smb.smbclient-args-patch | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/web/attachments/144080-check_disk_smb.smbclient-args-patch b/web/attachments/144080-check_disk_smb.smbclient-args-patch new file mode 100644 index 0000000..8886e03 --- /dev/null +++ b/web/attachments/144080-check_disk_smb.smbclient-args-patch | |||
@@ -0,0 +1,99 @@ | |||
1 | *** check_disk_smb 2005-06-08 11:09:01.720711352 -0500 | ||
2 | --- check_disk_smb.ultra 2005-06-08 11:05:52.927412296 -0500 | ||
3 | *************** | ||
4 | *** 15,22 **** | ||
5 | # allow setting of limits in MBytes or GBytes. Percentage settings for large | ||
6 | # drives is a pain in the butt | ||
7 | # 2-May-2002 - SGhosh fix for embedded perl | ||
8 | # | ||
9 | ! # $Id: check_disk_smb.pl,v 1.8.2.1 2003/07/02 15:52:23 tonvoon Exp $ | ||
10 | # | ||
11 | |||
12 | require 5.004; | ||
13 | --- 15,24 ---- | ||
14 | # allow setting of limits in MBytes or GBytes. Percentage settings for large | ||
15 | # drives is a pain in the butt | ||
16 | # 2-May-2002 - SGhosh fix for embedded perl | ||
17 | + # 8-Jun-2005 - Andrey Warkentin | ||
18 | + # Fixed the way smbclient gets called. The share path was malformed. | ||
19 | # | ||
20 | ! # $Id: check_disk_smb.pl,v 1.8.2.1 2005/06/08 10:44:21 root Exp $ | ||
21 | # | ||
22 | |||
23 | require 5.004; | ||
24 | *************** | ||
25 | *** 60,67 **** | ||
26 | my $smbclient= "$utils::PATH_TO_SMBCLIENT " ; | ||
27 | my $smbclientoptions=""; | ||
28 | |||
29 | ! # Options checking | ||
30 | ! | ||
31 | ($opt_H) || ($opt_H = shift) || usage("Host name not specified\n"); | ||
32 | my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9]+\$?)$/); | ||
33 | ($host) || usage("Invalid host: $opt_H\n"); | ||
34 | --- 62,68 ---- | ||
35 | my $smbclient= "$utils::PATH_TO_SMBCLIENT " ; | ||
36 | my $smbclientoptions=""; | ||
37 | |||
38 | ! # Options checking. | ||
39 | ($opt_H) || ($opt_H = shift) || usage("Host name not specified\n"); | ||
40 | my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9]+\$?)$/); | ||
41 | ($host) || usage("Invalid host: $opt_H\n"); | ||
42 | *************** | ||
43 | *** 105,111 **** | ||
44 | |||
45 | # end of options checking | ||
46 | |||
47 | - | ||
48 | my $state = "OK"; | ||
49 | my $answer = undef; | ||
50 | my $res = undef; | ||
51 | --- 106,111 ---- | ||
52 | *************** | ||
53 | *** 118,130 **** | ||
54 | }; | ||
55 | alarm($TIMEOUT); | ||
56 | |||
57 | # Execute an "ls" on the share using smbclient program | ||
58 | # get the results into $res | ||
59 | if (defined($workgroup)) { | ||
60 | ! $res = qx/$smbclient \/\/$host\/$share $pass -W $workgroup -U $user $smbclientoptions -c ls/; | ||
61 | } else { | ||
62 | ! print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -c ls\n" if ($verbose); | ||
63 | ! $res = qx/$smbclient \/\/$host\/$share $pass -U $user $smbclientoptions -c ls/; | ||
64 | } | ||
65 | #Turn off alarm | ||
66 | alarm(0); | ||
67 | --- 118,149 ---- | ||
68 | }; | ||
69 | alarm($TIMEOUT); | ||
70 | |||
71 | + # Check Samba version. Version 3 changed the way we pass the server path. | ||
72 | + my $samba_ver = qx/$smbclient --version 2>&1/; | ||
73 | + if($samba_ver =~ /Version (\d)/) | ||
74 | + { | ||
75 | + $samba_ver = $1; | ||
76 | + } | ||
77 | + | ||
78 | + # Version 3 broke it all. | ||
79 | + my $smbclient_part_cmd; | ||
80 | + if($samba_ver == 3) | ||
81 | + { | ||
82 | + $smbclient_part_cmd = "$smbclient \\\\\\\\$host\\\\$share"; | ||
83 | + } | ||
84 | + else | ||
85 | + { | ||
86 | + $smbclient_part_cmd = "$smbclient \/\/$host\/$share"; | ||
87 | + } | ||
88 | + | ||
89 | # Execute an "ls" on the share using smbclient program | ||
90 | # get the results into $res | ||
91 | if (defined($workgroup)) { | ||
92 | ! print $smbclient_part_cmd . " $pass -W $workgroup -U $user $smbclientoptions -c ls\n" if ($verbose); | ||
93 | ! $res = qx/$smbclient_part_cmd $pass -W $workgroup -U $user $smbclientoptions -c ls/; | ||
94 | } else { | ||
95 | ! print $smbclient_part_cmd . " $pass -U $user $smbclientoptions -c ls\n" if ($verbose); | ||
96 | ! $res = qx/$smbclient_part_cmd $pass -U $user $smbclientoptions -c ls/; | ||
97 | } | ||
98 | #Turn off alarm | ||
99 | alarm(0); | ||