diff options
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2002-05-27 01:55:41 (GMT) |
---|---|---|
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2002-05-27 01:55:41 (GMT) |
commit | 12503c81fafff406a4f5874255b0d5e79af8951f (patch) | |
tree | 11c6384581ca5b6b7bd2e1827e915d24b3e181e8 /plugins-scripts | |
parent | d2660204b92714140df60768cd2f32aac94edf31 (diff) | |
download | monitoring-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
Diffstat (limited to 'plugins-scripts')
-rwxr-xr-x | plugins-scripts/check_disk_smb.pl | 11 |
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; | |||
25 | use Getopt::Long; | 25 | use Getopt::Long; |
26 | use vars qw($opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $verbose); | 26 | use vars qw($opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $verbose); |
27 | use vars qw($PROGNAME); | 27 | use vars qw($PROGNAME); |
28 | use FindBin; | 28 | use lib utils.pm ; |
29 | use lib "$FindBin::Bin"; | ||
30 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); | 29 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); |
31 | 30 | ||
32 | sub print_help (); | 31 | sub print_help (); |
33 | sub print_usage (); | 32 | sub 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 | ||
57 | if ($opt_h) {print_help(); exit $ERRORS{'OK'};} | 58 | if ($opt_h) {print_help(); exit $ERRORS{'OK'};} |
58 | 59 | ||
59 | my $smbclient="/usr/bin/smbclient"; | 60 | my $smbclient= "$utils::PATH_TO_SMBCLIENT " ; |
60 | my $smbclientoptions=""; | 61 | my $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"); |
63 | my $host = $1 if ($opt_H =~ /([-_.A-Za-z0-9]+)/); | 65 | my $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); | |||
101 | if (defined($workgroup)) { | 103 | if (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 |