fix problem with SNMP session: now max_msg_size is on the global variable and sized to 50000
git-svn-id: http://svn.centreon.com/trunk/plugins-2.x@14093 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
parent
46409017de
commit
7a0078ff7f
|
@ -128,6 +128,7 @@ $name =~ s/\.pl.*//g;
|
||||||
my ($session, $error);
|
my ($session, $error);
|
||||||
if ($snmp eq "1" || $snmp eq "2") {
|
if ($snmp eq "1" || $snmp eq "2") {
|
||||||
($session, $error) = Net::SNMP->session(-hostname => $opt_H, -community => $opt_C, -version => $snmp);
|
($session, $error) = Net::SNMP->session(-hostname => $opt_H, -community => $opt_C, -version => $snmp);
|
||||||
|
$session->max_msg_size(50000);
|
||||||
if (!defined($session)) {
|
if (!defined($session)) {
|
||||||
print("UNKNOWN: SNMP 1 or 2 Session : $error\n");
|
print("UNKNOWN: SNMP 1 or 2 Session : $error\n");
|
||||||
exit $ERRORS{'UNKNOWN'};
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
@ -149,7 +150,6 @@ if ($snmp eq "1" || $snmp eq "2") {
|
||||||
sub get_netsnmp_version ($){
|
sub get_netsnmp_version ($){
|
||||||
my $sess = $_[0];
|
my $sess = $_[0];
|
||||||
my $OID_VERSION = "1.3.6.1.2.1.25.6.3.1.2";
|
my $OID_VERSION = "1.3.6.1.2.1.25.6.3.1.2";
|
||||||
$sess->max_msg_size(5000);
|
|
||||||
my $result = $sess->get_table(Baseoid => $OID_VERSION);
|
my $result = $sess->get_table(Baseoid => $OID_VERSION);
|
||||||
if (!defined($result)) {
|
if (!defined($result)) {
|
||||||
printf("ERROR when getting SNMP version : %s.\n", $session->error);
|
printf("ERROR when getting SNMP version : %s.\n", $session->error);
|
||||||
|
|
Loading…
Reference in New Issue