Leser: 15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use strict;
use Net::SNMP;
open(IPs, "<ip.txt");
while(<IPs>)
{
my ($session, $error) = Net::SNMP->session(
-hostname => $_,
-port => 161,
-community => 'public',
-version => 'snmpv3',
-username => 'derBlob',
-authpassword => 'blob234blob234blob234',
-authprotocol => 'md5'
);
my $OID = '.1.3.6.1.2.1.1.5.0';
my $result = $session->get_request(
-varbindlist => [$OID]
);
printf "Mit der OID: $OID kommt man zu $result->{$OID}\n";
$session->close;
}
close(IPs);
Invalid argument '-community'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use strict;
use Net::SNMP;
open(IPs, "<ip.txt");
while(<IPs>)
{
my ($session, $error) = Net::SNMP->session(
-hostname => $_,
-port => 161,
#-community => 'public',
-version => 'snmpv3',
-username => 'derBlob',
-authpassword => 'blob234blob234blob234',
-authprotocol => 'md5'
);
if (!defined($session)) #Prüfung ob die Sitzung funktioniert
{
printf("ERROR: %s.\n", $error);
exit 1;
}
my $OID = '1.3.6.1.2.1.1.5.0';
my $result = $session->get_request(
-varbindlist => [$OID]
);
printf "Mit der OID: $OID kommt man zu $result->{$OID}\n";
$session->close;
}
close(IPs);
1
2
3
4
5
6
7
# If we received the usmStatsNotInTimeWindows report or no error, but
# we are still not synchronized, provide a generic error message.
if ((!$this->{_error}) || ($this->{_error} =~ /usmStatsNotInTimeWindows/)) {
$this->_error_clear;
$this->_error('Time synchronization failed during discovery');
}