Code

Fix Debian bug #478906: Failure when run via ePN
[nagiosplug.git] / plugins-scripts / check_disk_smb.pl
index 022fa505ceabe4913e102e6cd1b6696dbdd322a5..ca593d468480bb9384324914d530cef495339992 100755 (executable)
@@ -64,27 +64,27 @@ my $smbclientoptions= $opt_P ? "-p $opt_P " : "";
 
 # Options checking
 
-($opt_H) || ($opt_H = shift) || usage("Host name not specified\n");
+($opt_H) || ($opt_H = shift @ARGV) || usage("Host name not specified\n");
 my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9 ]+\$?)$/);
 ($host) || usage("Invalid host: $opt_H\n");
 
-($opt_s) || ($opt_s = shift) || usage("Share volume not specified\n");
+($opt_s) || ($opt_s = shift @ARGV) || usage("Share volume not specified\n");
 my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9]+\$?)$/);
 ($share) || usage("Invalid share: $opt_s\n");
 
-($opt_u) || ($opt_u = shift) || ($opt_u = "guest");
+($opt_u) || ($opt_u = shift @ARGV) || ($opt_u = "guest");
 my $user = $1 if ($opt_u =~ /^([-_.A-Za-z0-9\\]+)$/);
 ($user) || usage("Invalid user: $opt_u\n");
 
-($opt_p) || ($opt_p = shift) || ($opt_p = "");
+($opt_p) || ($opt_p = shift @ARGV) || ($opt_p = "");
 my $pass = $1 if ($opt_p =~ /(.*)/);
 $pass = "-N" if ($opt_p eq "");
 
-($opt_w) || ($opt_w = shift) || ($opt_w = 85);
+($opt_w) || ($opt_w = shift @ARGV) || ($opt_w = 85);
 my $warn = $1 if ($opt_w =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
 ($warn) || usage("Invalid warning threshold: $opt_w\n");
 
-($opt_c) || ($opt_c = shift) || ($opt_c = 95);
+($opt_c) || ($opt_c = shift @ARGV) || ($opt_c = 95);
 my $crit = $1 if ($opt_c =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
 ($crit) || usage("Invalid critical threshold: $opt_c\n");