|
|
|
@ -1038,27 +1038,25 @@ sub check_snmp_and_model {
|
|
|
|
|
scalar localtime (time - $sysUptime),
|
|
|
|
|
$self->human_timeticks($sysUptime));
|
|
|
|
|
}
|
|
|
|
|
my $best_uptime = undef;
|
|
|
|
|
if ($hrSystemUptime) {
|
|
|
|
|
# Bei Linux-basierten Geraeten wird snmpEngineTime viel zu haeufig
|
|
|
|
|
# durchgestartet, also lieber das hier.
|
|
|
|
|
$best_uptime = $hrSystemUptime;
|
|
|
|
|
# Es sei denn, snmpEngineTime ist tatsaechlich groesser, dann gilt
|
|
|
|
|
# wiederum dieses. Mag sein, dass der zahlenwert hier manchmal huepft
|
|
|
|
|
# und ein Performancegraph Zacken bekommt, aber das ist mir egal.
|
|
|
|
|
# es geht nicht um Graphen in Form einer ansteigenden Geraden, sondern
|
|
|
|
|
# um das Erkennen von spontanen Reboots und das Vermeiden von
|
|
|
|
|
# falschen Alarmen.
|
|
|
|
|
if ($snmpEngineTime && $snmpEngineTime > $hrSystemUptime) {
|
|
|
|
|
$best_uptime = $snmpEngineTime;
|
|
|
|
|
if (defined $sysUptime && defined $sysDescr) {
|
|
|
|
|
if ($hrSystemUptime) {
|
|
|
|
|
# Bei Linux-basierten Geraeten wird snmpEngineTime viel zu haeufig
|
|
|
|
|
# durchgestartet, also lieber das hier.
|
|
|
|
|
$self->{uptime} = $hrSystemUptime;
|
|
|
|
|
# Es sei denn, snmpEngineTime ist tatsaechlich groesser, dann gilt
|
|
|
|
|
# wiederum dieses. Mag sein, dass der zahlenwert hier manchmal huepft
|
|
|
|
|
# und ein Performancegraph Zacken bekommt, aber das ist mir egal.
|
|
|
|
|
# es geht nicht um Graphen in Form einer ansteigenden Geraden, sondern
|
|
|
|
|
# um das Erkennen von spontanen Reboots und das Vermeiden von
|
|
|
|
|
# falschen Alarmen.
|
|
|
|
|
if ($snmpEngineTime && $snmpEngineTime > $hrSystemUptime) {
|
|
|
|
|
$self->{uptime} = $snmpEngineTime;
|
|
|
|
|
}
|
|
|
|
|
} elsif ($snmpEngineTime) {
|
|
|
|
|
$self->{uptime} = $snmpEngineTime;
|
|
|
|
|
} else {
|
|
|
|
|
$self->{uptime} = $sysUptime;
|
|
|
|
|
}
|
|
|
|
|
} elsif ($snmpEngineTime) {
|
|
|
|
|
$best_uptime = $snmpEngineTime;
|
|
|
|
|
} else {
|
|
|
|
|
$best_uptime = $sysUptime;
|
|
|
|
|
}
|
|
|
|
|
if (defined $best_uptime && defined $sysDescr) {
|
|
|
|
|
$self->{uptime} = $best_uptime;
|
|
|
|
|
$self->{productname} = $sysDescr;
|
|
|
|
|
$self->{sysobjectid} = $self->get_snmp_object('MIB-2-MIB', 'sysObjectID', 0);
|
|
|
|
|
$self->debug(sprintf 'uptime: %s', $self->{uptime});
|
|
|
|
@ -1092,11 +1090,11 @@ sub check_snmp_and_model {
|
|
|
|
|
}
|
|
|
|
|
if (! $mein_lieber_freund_und_kupferstecher) {
|
|
|
|
|
$self->add_message(UNKNOWN,
|
|
|
|
|
'got neither sysUptime and sysDescr nor any other useful information, is this snmp agent working correctly?');
|
|
|
|
|
'got neither sysUptime nor sysDescr nor any other useful information, is this snmp agent working correctly?');
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$self->add_message(UNKNOWN,
|
|
|
|
|
'Did not receive both sysUptime and sysDescr, is this snmp agent working correctly?');
|
|
|
|
|
'got neither sysUptime nor sysDescr, is this snmp agent working correctly?');
|
|
|
|
|
}
|
|
|
|
|
$Monitoring::GLPlugin::SNMP::session->close if $Monitoring::GLPlugin::SNMP::session;
|
|
|
|
|
}
|
|
|
|
@ -2474,7 +2472,6 @@ sub get_table {
|
|
|
|
|
if (! defined $result || (defined $result && ! %{$result})) {
|
|
|
|
|
$self->debug(sprintf "get_table error: %s",
|
|
|
|
|
$Monitoring::GLPlugin::SNMP::session->error());
|
|
|
|
|
my $fallback = 0;
|
|
|
|
|
if ($Monitoring::GLPlugin::SNMP::session->error() =~ /message size exceeded.*buffer maxMsgSize/i) {
|
|
|
|
|
# bei irrsinnigen maxrepetitions
|
|
|
|
|
$self->debug(sprintf "buffer exceeded");
|
|
|
|
@ -2486,24 +2483,12 @@ sub get_table {
|
|
|
|
|
} else {
|
|
|
|
|
$self->mult_snmp_max_msg_size(2);
|
|
|
|
|
}
|
|
|
|
|
$fallback = 1;
|
|
|
|
|
} elsif ($Monitoring::GLPlugin::SNMP::session->error() =~ /No response from remote host/i) {
|
|
|
|
|
# some agents can not handle big loads
|
|
|
|
|
if ($params{'-maxrepetitions'}) {
|
|
|
|
|
$params{'-maxrepetitions'} = int($params{'-maxrepetitions'} / 2);
|
|
|
|
|
$self->debug(sprintf "reduce maxrepetitions to %d",
|
|
|
|
|
$params{'-maxrepetitions'});
|
|
|
|
|
$fallback = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($fallback) {
|
|
|
|
|
$self->debug("get_table error: try fallback");
|
|
|
|
|
$self->debug(sprintf "get_table %s", Data::Dumper::Dumper(\%params));
|
|
|
|
|
$tic = time;
|
|
|
|
|
$result = $Monitoring::GLPlugin::SNMP::session->get_table(%params);
|
|
|
|
|
$tac = time;
|
|
|
|
|
$self->debug(sprintf "get_table returned %d oids in %ds", scalar(keys %{$result}), $tac - $tic);
|
|
|
|
|
}
|
|
|
|
|
$self->debug("get_table error: try fallback");
|
|
|
|
|
$self->debug(sprintf "get_table %s", Data::Dumper::Dumper(\%params));
|
|
|
|
|
$result = $Monitoring::GLPlugin::SNMP::session->get_table(%params);
|
|
|
|
|
$tac = time;
|
|
|
|
|
$self->debug(sprintf "get_table returned %d oids in %ds", scalar(keys %{$result}), $tac - $tic);
|
|
|
|
|
if (! defined $result || ! %{$result}) {
|
|
|
|
|
$self->debug(sprintf "get_table error: %s",
|
|
|
|
|
$Monitoring::GLPlugin::SNMP::session->error());
|
|
|
|
@ -2511,7 +2496,6 @@ sub get_table {
|
|
|
|
|
$params{'-maxrepetitions'} = 1;
|
|
|
|
|
$self->debug("get_table error: try getnext fallback");
|
|
|
|
|
$self->debug(sprintf "get_table %s", Data::Dumper::Dumper(\%params));
|
|
|
|
|
$tic = time;
|
|
|
|
|
$result = $Monitoring::GLPlugin::SNMP::session->get_table(%params);
|
|
|
|
|
$tac = time;
|
|
|
|
|
$self->debug(sprintf "get_table returned %d oids in %ds", scalar(keys %{$result}), $tac - $tic);
|