Merge branch 'ent-fix-snmp-interfaces-wizard' into 'develop'

Fixed SNMP interfaces wizard against 32bit counter devices.

See merge request artica/pandorafms!4348
This commit is contained in:
Daniel Rodriguez 2021-10-18 08:33:17 +00:00
commit aa2eb08edb
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

@ -2089,8 +2089,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) {