From 812bed96743b342d649321679b86d5d1a98722db Mon Sep 17 00:00:00 2001 From: Maximilien Bersoult Date: Thu, 17 Nov 2011 10:39:40 +0000 Subject: [PATCH] * 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 --- src/check_centreon_MS_multiple_services | 4 ++-- src/check_centreon_snmp_cpu | 4 ++-- src/check_centreon_snmp_loadaverage | 6 +++--- src/check_centreon_snmp_multiple_process | 4 ++-- src/check_centreon_snmp_process | 6 +++--- src/check_centreon_snmp_remote_storage | 4 ++-- src/check_centreon_snmp_traffic | 6 ++---- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/check_centreon_MS_multiple_services b/src/check_centreon_MS_multiple_services index 7ded2641f..095ae59c9 100644 --- a/src/check_centreon_MS_multiple_services +++ b/src/check_centreon_MS_multiple_services @@ -95,8 +95,8 @@ if (!$opt_H) { print_usage(); exit $ERRORS{'OK'}; } -my $snmp = "1"; -$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/); +($opt_v) || ($opt_v = shift) || ($opt_v = "2"); +my $snmp = $1 if ($opt_v =~ /(\d)/); if ($snmp eq "3") { if (!$opt_u) { diff --git a/src/check_centreon_snmp_cpu b/src/check_centreon_snmp_cpu index ddd48e93f..40d07ff65 100644 --- a/src/check_centreon_snmp_cpu +++ b/src/check_centreon_snmp_cpu @@ -98,8 +98,8 @@ if (!$opt_H) { $opt_l = 0 if (!defined($opt_l)); -my $snmp = "1"; -$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/); +($opt_v) || ($opt_v = shift) || ($opt_v = "2"); +my $snmp = $1 if ($opt_v =~ /(\d)/); $opt_c = 95 if (!defined($opt_c) || !$opt_c); $opt_w = 90 if (!defined($opt_w) || !$opt_w); diff --git a/src/check_centreon_snmp_loadaverage b/src/check_centreon_snmp_loadaverage index 394eb75a3..9b1417935 100644 --- a/src/check_centreon_snmp_loadaverage +++ b/src/check_centreon_snmp_loadaverage @@ -100,8 +100,8 @@ if (!$opt_H) { exit $ERRORS{'OK'}; } -my $snmp = "1"; -$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/); +($opt_v) || ($opt_v = shift) || ($opt_v = "2"); +my $snmp = $1 if ($opt_v =~ /(\d)/); if ($opt_c && $opt_c =~ /^([0-9\.]+),([0-9\.]+),([0-9\.]+)$/) { @critical = ($1,$2,$3); @@ -221,4 +221,4 @@ sub print_help () { print "##############################################\n"; print_usage(); print "\n"; -} \ No newline at end of file +} diff --git a/src/check_centreon_snmp_multiple_process b/src/check_centreon_snmp_multiple_process index a3eaca050..9cba0711d 100644 --- a/src/check_centreon_snmp_multiple_process +++ b/src/check_centreon_snmp_multiple_process @@ -96,8 +96,8 @@ if (!$opt_H) { print_usage(); exit $ERRORS{'OK'}; } -my $snmp = "1"; -$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/); +($opt_v) || ($opt_v = shift) || ($opt_v = "2"); +my $snmp = $1 if ($opt_v =~ /(\d)/); if ($snmp eq "3") { if (!$opt_u) { diff --git a/src/check_centreon_snmp_process b/src/check_centreon_snmp_process index 1442be22d..d91f39f36 100644 --- a/src/check_centreon_snmp_process +++ b/src/check_centreon_snmp_process @@ -103,8 +103,8 @@ if ($opt_n && (!$opt_c || !$opt_w)) { exit $ERRORS{'OK'}; } -my $snmp = "1"; -$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/); +($opt_v) || ($opt_v = shift) || ($opt_v = "2"); +my $snmp = $1 if ($opt_v =~ /(\d)/); if ($snmp eq "3") { if (!$opt_u) { @@ -238,4 +238,4 @@ sub print_help () { print "##############################################\n"; print_usage(); print "\n"; -} \ No newline at end of file +} diff --git a/src/check_centreon_snmp_remote_storage b/src/check_centreon_snmp_remote_storage index b88331854..8c941da4d 100644 --- a/src/check_centreon_snmp_remote_storage +++ b/src/check_centreon_snmp_remote_storage @@ -110,8 +110,8 @@ if ($opt_n && !$opt_d) { print "Option -n (--name) need option -d (--disk)\n"; exit $ERRORS{'UNKNOWN'}; } -my $snmp = "1"; -$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/); +($opt_v) || ($opt_v = shift) || ($opt_v = "2"); +my $snmp = $1 if ($opt_v =~ /(\d)/); if ($snmp eq "3") { if (!$opt_u) { diff --git a/src/check_centreon_snmp_traffic b/src/check_centreon_snmp_traffic index 900ba300b..516ecd7c7 100644 --- a/src/check_centreon_snmp_traffic +++ b/src/check_centreon_snmp_traffic @@ -106,10 +106,8 @@ if (!$opt_H) { print_usage(); exit $ERRORS{'OK'}; } -my $snmp = "1"; -if ($opt_v && $opt_v =~ /^[0-9]$/) { - $snmp = $opt_v; -} +($opt_v) || ($opt_v = shift) || ($opt_v = "2"); +my $snmp = $1 if ($opt_v =~ /(\d)/); if ($snmp eq "3") { if (!$opt_u) {