From cadaca669fa039fc94b393f0695551b37beac226 Mon Sep 17 00:00:00 2001 From: Junichi Satoh Date: Tue, 10 Aug 2021 12:08:28 +0900 Subject: [PATCH] Fixed SNMP interfaces wizard against 32bit counter devices. --- .../include/class/AgentWizard.class.php | 24 ++----------------- pandora_console/include/functions.php | 8 ++++++- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/pandora_console/include/class/AgentWizard.class.php b/pandora_console/include/class/AgentWizard.class.php index 7643abc4fd..2944879bcf 100644 --- a/pandora_console/include/class/AgentWizard.class.php +++ b/pandora_console/include/class/AgentWizard.class.php @@ -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') { diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 45fbcf1077..eaa240eae9 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -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) {