summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xplugins-scripts/check_disk_smb.pl11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl
index 9a66ed5..bdfcf26 100755
--- a/plugins-scripts/check_disk_smb.pl
+++ b/plugins-scripts/check_disk_smb.pl
@@ -1,4 +1,4 @@
1#! /usr/bin/perl -wT 1#! /usr/bin/perl -w
2# 2#
3# 3#
4# check_disk.pl <host> <share> <user> <pass> [warn] [critical] [port] 4# check_disk.pl <host> <share> <user> <pass> [warn] [critical] [port]
@@ -25,13 +25,14 @@ use strict;
25use Getopt::Long; 25use Getopt::Long;
26use vars qw($opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $verbose); 26use vars qw($opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $verbose);
27use vars qw($PROGNAME); 27use vars qw($PROGNAME);
28use FindBin; 28use lib utils.pm ;
29use lib "$FindBin::Bin";
30use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); 29use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
31 30
32sub print_help (); 31sub print_help ();
33sub print_usage (); 32sub print_usage ();
34 33
34$PROGNAME = "check_disk_smb";
35
35$ENV{'PATH'}=''; 36$ENV{'PATH'}='';
36$ENV{'BASH_ENV'}=''; 37$ENV{'BASH_ENV'}='';
37$ENV{'ENV'}=''; 38$ENV{'ENV'}='';
@@ -56,9 +57,10 @@ if ($opt_V) {
56 57
57if ($opt_h) {print_help(); exit $ERRORS{'OK'};} 58if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
58 59
59my $smbclient="/usr/bin/smbclient"; 60my $smbclient= "$utils::PATH_TO_SMBCLIENT " ;
60my $smbclientoptions=""; 61my $smbclientoptions="";
61 62
63
62($opt_H) || ($opt_H = shift) || usage("Host name not specified\n"); 64($opt_H) || ($opt_H = shift) || usage("Host name not specified\n");
63my $host = $1 if ($opt_H =~ /([-_.A-Za-z0-9]+)/); 65my $host = $1 if ($opt_H =~ /([-_.A-Za-z0-9]+)/);
64($host) || usage("Invalid host: $opt_H\n"); 66($host) || usage("Invalid host: $opt_H\n");
@@ -101,6 +103,7 @@ alarm($TIMEOUT);
101if (defined($workgroup)) { 103if (defined($workgroup)) {
102 $res = qx/$smbclient \/\/$host\/$share $pass -W $workgroup -U $user $smbclientoptions -c ls/; 104 $res = qx/$smbclient \/\/$host\/$share $pass -W $workgroup -U $user $smbclientoptions -c ls/;
103} else { 105} else {
106 print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -c ls\n" if ($verbose);
104 $res = qx/$smbclient \/\/$host\/$share $pass -U $user $smbclientoptions -c ls/; 107 $res = qx/$smbclient \/\/$host\/$share $pass -U $user $smbclientoptions -c ls/;
105} 108}
106#Turn off alarm 109#Turn off alarm