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. --- .../144080-check_disk_smb.smbclient-args-patch | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 web/attachments/144080-check_disk_smb.smbclient-args-patch (limited to 'web/attachments/144080-check_disk_smb.smbclient-args-patch') 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 @@ +*** check_disk_smb 2005-06-08 11:09:01.720711352 -0500 +--- check_disk_smb.ultra 2005-06-08 11:05:52.927412296 -0500 +*************** +*** 15,22 **** + # allow setting of limits in MBytes or GBytes. Percentage settings for large + # drives is a pain in the butt + # 2-May-2002 - SGhosh fix for embedded perl + # +! # $Id: check_disk_smb.pl,v 1.8.2.1 2003/07/02 15:52:23 tonvoon Exp $ + # + + require 5.004; +--- 15,24 ---- + # allow setting of limits in MBytes or GBytes. Percentage settings for large + # drives is a pain in the butt + # 2-May-2002 - SGhosh fix for embedded perl ++ # 8-Jun-2005 - Andrey Warkentin ++ # Fixed the way smbclient gets called. The share path was malformed. + # +! # $Id: check_disk_smb.pl,v 1.8.2.1 2005/06/08 10:44:21 root Exp $ + # + + require 5.004; +*************** +*** 60,67 **** + my $smbclient= "$utils::PATH_TO_SMBCLIENT " ; + my $smbclientoptions=""; + +! # Options checking +! + ($opt_H) || ($opt_H = shift) || usage("Host name not specified\n"); + my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9]+\$?)$/); + ($host) || usage("Invalid host: $opt_H\n"); +--- 62,68 ---- + my $smbclient= "$utils::PATH_TO_SMBCLIENT " ; + my $smbclientoptions=""; + +! # Options checking. + ($opt_H) || ($opt_H = shift) || usage("Host name not specified\n"); + my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9]+\$?)$/); + ($host) || usage("Invalid host: $opt_H\n"); +*************** +*** 105,111 **** + + # end of options checking + +- + my $state = "OK"; + my $answer = undef; + my $res = undef; +--- 106,111 ---- +*************** +*** 118,130 **** + }; + alarm($TIMEOUT); + + # Execute an "ls" on the share using smbclient program + # get the results into $res + if (defined($workgroup)) { +! $res = qx/$smbclient \/\/$host\/$share $pass -W $workgroup -U $user $smbclientoptions -c ls/; + } else { +! print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -c ls\n" if ($verbose); +! $res = qx/$smbclient \/\/$host\/$share $pass -U $user $smbclientoptions -c ls/; + } + #Turn off alarm + alarm(0); +--- 118,149 ---- + }; + alarm($TIMEOUT); + ++ # Check Samba version. Version 3 changed the way we pass the server path. ++ my $samba_ver = qx/$smbclient --version 2>&1/; ++ if($samba_ver =~ /Version (\d)/) ++ { ++ $samba_ver = $1; ++ } ++ ++ # Version 3 broke it all. ++ my $smbclient_part_cmd; ++ if($samba_ver == 3) ++ { ++ $smbclient_part_cmd = "$smbclient \\\\\\\\$host\\\\$share"; ++ } ++ else ++ { ++ $smbclient_part_cmd = "$smbclient \/\/$host\/$share"; ++ } ++ + # Execute an "ls" on the share using smbclient program + # get the results into $res + if (defined($workgroup)) { +! print $smbclient_part_cmd . " $pass -W $workgroup -U $user $smbclientoptions -c ls\n" if ($verbose); +! $res = qx/$smbclient_part_cmd $pass -W $workgroup -U $user $smbclientoptions -c ls/; + } else { +! print $smbclient_part_cmd . " $pass -U $user $smbclientoptions -c ls\n" if ($verbose); +! $res = qx/$smbclient_part_cmd $pass -U $user $smbclientoptions -c ls/; + } + #Turn off alarm + alarm(0); -- cgit v1.2.3-74-g34f1