Fixed SNMP interfaces wizard against 32bit counter devices.

This commit is contained in:
Junichi Satoh 2021-08-10 12:08:28 +09:00
parent 2951bf2871
commit cadaca669f
2 changed files with 9 additions and 23 deletions

View File

@ -1042,40 +1042,20 @@ class AgentWizard extends HTML
$oidExplore = '.1.3.6.1.2.1.31.1.1.1.1';
} else {
$this->interfacesx64 = false;
$oidExplore = '1.3.6.1.2.1.2.2.1.2';
$oidExplore = '.1.3.6.1.2.1.2.2.1.2';
}
// Explore interface names.
$oidExplore = '.1.3.6.1.2.1.31.1.1.1.1';
$receivedOid = $this->snmpWalkValues(
$oidExplore,
false,
true
);
} else {
// Get the device PEN.
$oidExplore = '.1.3.6.1.2.1.1.2.0';
}
// Doc Interfaces de red.
// Explore general or interfaces
$receivedOid = $this->snmpWalkValues(
$oidExplore,
false,
false
);
if (empty($receivedOid) || preg_grep('/no.*object/i', $receivedOid)) {
$this->interfacesx64 = false;
$oidExplore = '1.3.6.1.2.1.2.2.1.2';
// Doc Interfaces de red.
$receivedOid = $this->snmpWalkValues(
$oidExplore,
false,
true
);
}
// The snmpwalk return information.
if (empty($receivedOid) === false) {
if ($this->wizardSection === 'snmp_interfaces_explorer') {

View File

@ -2110,8 +2110,14 @@ function get_snmpwalk(
exec($command_str, $output, $rc);
}
// Parse the output of snmpwalk.
$snmpwalk = [];
// Check if OID is available.
if (count($output) == 1 && strpos($output[0], "No Such Object available on this agent at this OID") !== false) {
return $snmpwalk;
}
// Parse the output of snmpwalk.
foreach ($output as $line) {
// Separate the OID from the value.
if (strpos($format, 'q') === false) {