From 89ddfbb1fab910aa7266598f70fedd798647c607 Mon Sep 17 00:00:00 2001 From: Quentin Garnier Date: Thu, 20 Feb 2014 17:20:46 +0100 Subject: [PATCH] Fix #5232 --- centreon/plugins/snmp.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/centreon/plugins/snmp.pm b/centreon/plugins/snmp.pm index a939df32c..b680c7e27 100644 --- a/centreon/plugins/snmp.pm +++ b/centreon/plugins/snmp.pm @@ -109,6 +109,10 @@ sub connect { } $self->{session} = new SNMP::Session(%{$self->{snmp_params}}); + if (!defined($self->{session})) { + $self->{output}->add_option_msg(short_msg => 'SNMP Session : unable to create'); + $self->{output}->option_exit(exit_litteral => $self->{snmp_errors_exit}); + } if ($self->{session}->{ErrorNum}) { $self->{output}->add_option_msg(short_msg => 'SNMP Session : ' . $self->{session}->{ErrorStr}); $self->{output}->option_exit(exit_litteral => $self->{snmp_errors_exit});