* Change snmp version option , the value can be 2 or 2c

git-svn-id: http://svn.centreon.com/trunk/plugins-2.x@12719 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
Maximilien Bersoult 2011-11-17 10:39:40 +00:00
parent 1240d3a5e7
commit e480a30f13
7 changed files with 16 additions and 18 deletions

View File

@ -95,8 +95,8 @@ if (!$opt_H) {
print_usage(); print_usage();
exit $ERRORS{'OK'}; exit $ERRORS{'OK'};
} }
my $snmp = "1"; ($opt_v) || ($opt_v = shift) || ($opt_v = "2");
$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/); my $snmp = $1 if ($opt_v =~ /(\d)/);
if ($snmp eq "3") { if ($snmp eq "3") {
if (!$opt_u) { if (!$opt_u) {

View File

@ -98,8 +98,8 @@ if (!$opt_H) {
$opt_l = 0 if (!defined($opt_l)); $opt_l = 0 if (!defined($opt_l));
my $snmp = "1"; ($opt_v) || ($opt_v = shift) || ($opt_v = "2");
$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/); my $snmp = $1 if ($opt_v =~ /(\d)/);
$opt_c = 95 if (!defined($opt_c) || !$opt_c); $opt_c = 95 if (!defined($opt_c) || !$opt_c);
$opt_w = 90 if (!defined($opt_w) || !$opt_w); $opt_w = 90 if (!defined($opt_w) || !$opt_w);

View File

@ -100,8 +100,8 @@ if (!$opt_H) {
exit $ERRORS{'OK'}; exit $ERRORS{'OK'};
} }
my $snmp = "1"; ($opt_v) || ($opt_v = shift) || ($opt_v = "2");
$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/); my $snmp = $1 if ($opt_v =~ /(\d)/);
if ($opt_c && $opt_c =~ /^([0-9\.]+),([0-9\.]+),([0-9\.]+)$/) { if ($opt_c && $opt_c =~ /^([0-9\.]+),([0-9\.]+),([0-9\.]+)$/) {
@critical = ($1,$2,$3); @critical = ($1,$2,$3);

View File

@ -96,8 +96,8 @@ if (!$opt_H) {
print_usage(); print_usage();
exit $ERRORS{'OK'}; exit $ERRORS{'OK'};
} }
my $snmp = "1"; ($opt_v) || ($opt_v = shift) || ($opt_v = "2");
$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/); my $snmp = $1 if ($opt_v =~ /(\d)/);
if ($snmp eq "3") { if ($snmp eq "3") {
if (!$opt_u) { if (!$opt_u) {

View File

@ -103,8 +103,8 @@ if ($opt_n && (!$opt_c || !$opt_w)) {
exit $ERRORS{'OK'}; exit $ERRORS{'OK'};
} }
my $snmp = "1"; ($opt_v) || ($opt_v = shift) || ($opt_v = "2");
$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/); my $snmp = $1 if ($opt_v =~ /(\d)/);
if ($snmp eq "3") { if ($snmp eq "3") {
if (!$opt_u) { if (!$opt_u) {

View File

@ -110,8 +110,8 @@ if ($opt_n && !$opt_d) {
print "Option -n (--name) need option -d (--disk)\n"; print "Option -n (--name) need option -d (--disk)\n";
exit $ERRORS{'UNKNOWN'}; exit $ERRORS{'UNKNOWN'};
} }
my $snmp = "1"; ($opt_v) || ($opt_v = shift) || ($opt_v = "2");
$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/); my $snmp = $1 if ($opt_v =~ /(\d)/);
if ($snmp eq "3") { if ($snmp eq "3") {
if (!$opt_u) { if (!$opt_u) {

View File

@ -106,10 +106,8 @@ if (!$opt_H) {
print_usage(); print_usage();
exit $ERRORS{'OK'}; exit $ERRORS{'OK'};
} }
my $snmp = "1"; ($opt_v) || ($opt_v = shift) || ($opt_v = "2");
if ($opt_v && $opt_v =~ /^[0-9]$/) { my $snmp = $1 if ($opt_v =~ /(\d)/);
$snmp = $opt_v;
}
if ($snmp eq "3") { if ($snmp eq "3") {
if (!$opt_u) { if (!$opt_u) {