Merge branch 'ent-6336-ifHCXXXX-nuevo-wizard-snmp-interfaces-fix' into 'develop'

Fixed oid for getting x64 interfaces module. Fixed visual (module order) bug

See merge request artica/pandorafms!3556
This commit is contained in:
Daniel Rodriguez 2020-10-30 14:41:33 +01:00
commit 0fad0d7f01

View File

@ -1,4 +1,5 @@
<?php
/**
* Agent Wizard for SNMP and WMI
*
@ -865,7 +866,6 @@ class AgentWizard extends HTML
],
true
);
}
@ -992,10 +992,51 @@ class AgentWizard extends HTML
}
if ($this->wizardSection === 'snmp_interfaces_explorer') {
// First, try x64 interfaces.
// Check if thereis x64 counters.
$snmp_tmp = '.1.3.6.1.2.1.31.1.1.1.6';
$check_x64 = get_snmpwalk(
$this->targetIp,
$this->version,
$this->community,
$this->authUserV3,
$this->securityLevelV3,
$this->authMethodV3,
$this->authPassV3,
$this->privacyMethodV3,
$this->privacyPassV3,
0,
$snmp_tmp,
$this->targetPort,
$this->server,
$this->extraArguments
);
if ($check_x64) {
$this->interfacesx64 = true;
$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';
}
// Explore interface names.
$oidExplore = '.1.3.6.1.2.1.31.1.1.1.1';
$receivedOid = get_snmpwalk(
$this->targetIp,
$this->version,
$this->community,
$this->authUserV3,
$this->securityLevelV3,
$this->authMethodV3,
$this->authPassV3,
$this->privacyMethodV3,
$this->privacyPassV3,
0,
$oidExplore,
$this->targetPort,
$this->server,
$this->extraArguments
);
} else {
// Get the device PEN.
$oidExplore = '.1.3.6.1.2.1.1.2.0';
@ -3100,7 +3141,6 @@ class AgentWizard extends HTML
// Add Create Modules form.
$this->createModulesForm();
}
}
@ -3209,7 +3249,6 @@ class AgentWizard extends HTML
}
return false;
}
@ -4207,6 +4246,34 @@ class AgentWizard extends HTML
],
];
// Get x86 or x64 modules.
if ($this->interfacesx64 === true) {
$definition_temp = $this->getInterfacesModulesx64($data);
} else {
$definition_temp = $this->getInterfacesModulesx86($data);
}
// General monitoring names.
$general_module_names = [
'ifInOctets / ifHCInOctets',
'ifOutOctets / ifHCOutOctets',
'ifInUcastPkts / ifHCInUcastPkts',
'ifOutUcastPkts / ifHCOutUcastPkts',
'ifInNUcastPkts / ifHCInNUcastPkts',
'ifOutNUcastPkts / ifHCOutNUcastPkts',
];
if ($name == '') {
foreach ($definition_temp as $module => $module_def) {
$definition_temp[$module]['module_name'] = array_shift($general_module_names);
}
}
if (empty($definition_temp) === false) {
$definition = array_merge($definition, $definition_temp);
}
// Continue with common x86 and x84 modules.
// IfAdminStatus.
$moduleName = $name.'ifAdminStatus';
$definition['ifAdminStatus'] = [
@ -4333,19 +4400,6 @@ class AgentWizard extends HTML
],
];
// Get x86 or x64 modules.
if ($this->interfacesx64 === true) {
$definitionx64 = $this->getInterfacesModulesx64($data);
if (empty($definitionx64) === false) {
$definition = array_merge($definition, $definitionx64);
}
} else {
$definitionx86 = $this->getInterfacesModulesx86($data);
if (empty($definitionx86) === false) {
$definition = array_merge($definition, $definitionx86);
}
}
return $definition;
}
@ -5015,16 +5069,13 @@ class AgentWizard extends HTML
collision: "fit"
},
title: title,
buttons: [
{
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
buttons: [{
class: "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
text: "OK",
click: function(e) {
$("#msg").close();
}
}
]
}]
});
}