aboutsummaryrefslogtreecommitdiffstats
path: root/include/nms.pm
diff options
context:
space:
mode:
authorroot <root@riffraff.tg14.gathering.org>2014-04-20 02:58:05 +0200
committerroot <root@riffraff.tg14.gathering.org>2014-04-20 02:58:05 +0200
commit8f4ae8e5833f0d26be5fad5160ae6ee0479b0712 (patch)
treeda5089e91fbe52fd7da57a1c431c9af64f6ac8af /include/nms.pm
parent37a3b5d6ed97367989aecc875f1db1e9eb0458df (diff)
parent19cd0064816a577b72577b9f21a5a946eb746f64 (diff)
Merge branch 'master' of https://github.com/tech-server/tgmanage
Diffstat (limited to 'include/nms.pm')
-rw-r--r--include/nms.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/nms.pm b/include/nms.pm
index af7702d..e93f7d0 100644
--- a/include/nms.pm
+++ b/include/nms.pm
@@ -111,7 +111,9 @@ sub switch_disconnect {
}
sub snmp_open_session {
- my ($ip, $community) = @_;
+ my ($ip, $community, $async) = @_;
+
+ $async //= 0;
my %options = (UseEnums => 1);
if ($ip =~ /:/) {
@@ -141,10 +143,10 @@ sub snmp_open_session {
}
my $session = SNMP::Session->new(%options);
- if (defined($session) && defined($session->getnext('sysDescr'))) {
+ if (defined($session) && ($async || defined($session->getnext('sysDescr')))) {
return $session;
} else {
- die 'Could not open SNMP session';
+ die 'Could not open SNMP session to ' . $ip;
}
}