summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSubhendu Ghosh <sghosh@users.sourceforge.net>2002-05-27 01:55:41 +0000
committerSubhendu Ghosh <sghosh@users.sourceforge.net>2002-05-27 01:55:41 +0000
commit12503c81fafff406a4f5874255b0d5e79af8951f (patch)
tree11c6384581ca5b6b7bd2e1827e915d24b3e181e8
parentd2660204b92714140df60768cd2f32aac94edf31 (diff)
downloadmonitoring-plugins-12503c81fafff406a4f5874255b0d5e79af8951f.tar.gz
ePN fix and support for utils.pm
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@34 f882894a-f735-0410-b71e-b25c423dba1c
-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 9a66ed5d..bdfcf267 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