Merge branch 'ent-7468-campo-plugin-falla-bandwith-politicas' into 'develop'
Fixed issue with id_plugin with bandwidth modules Closes pandora_enterprise#7468 See merge request artica/pandorafms!4159
This commit is contained in:
commit
2eb85562c2
|
@ -312,7 +312,7 @@ class AgentWizard extends HTML
|
|||
$this->idPolicy = get_parameter('id', '');
|
||||
$this->targetIp = get_parameter('targetIp', '');
|
||||
|
||||
if (!empty($this->idAgent)) {
|
||||
if (empty($this->idAgent) === false) {
|
||||
$array_aux = db_get_all_rows_sql(
|
||||
sprintf(
|
||||
'SELECT ip FROM taddress ta
|
||||
|
@ -1691,28 +1691,43 @@ class AgentWizard extends HTML
|
|||
)
|
||||
);
|
||||
|
||||
if ($fieldsPlugin !== false) {
|
||||
$fieldsPlugin = json_decode($fieldsPlugin, true);
|
||||
$i = 1;
|
||||
foreach ($infoMacros as $key => $value) {
|
||||
if (empty(preg_match('/_snmp_field/', $key)) === false) {
|
||||
$new_macros = [];
|
||||
foreach ($fieldsPlugin as $k => $v) {
|
||||
if ($v['macro'] === preg_replace('/_snmp_field/', '', $key)) {
|
||||
$fieldsPlugin[$k]['value'] = $this->replacementMacrosPlugin(
|
||||
$value,
|
||||
$infoMacros['macros']
|
||||
);
|
||||
$i++;
|
||||
continue;
|
||||
if ($this->wizardSection === 'snmp_interfaces_explorer'
|
||||
&& empty($candidate['macros']) === false
|
||||
) {
|
||||
// Use definition provided.
|
||||
$values['id_plugin'] = $candidate['id_plugin'];
|
||||
$values['macros'] = base64_decode($candidate['macros']);
|
||||
} else {
|
||||
$fieldsPlugin = db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT macros FROM tplugin WHERE id=%d',
|
||||
(int) $infoMacros['server_plugin']
|
||||
)
|
||||
);
|
||||
|
||||
if ($fieldsPlugin !== false) {
|
||||
$fieldsPlugin = json_decode($fieldsPlugin, true);
|
||||
$i = 1;
|
||||
foreach ($infoMacros as $key => $value) {
|
||||
if (empty(preg_match('/_snmp_field/', $key)) === false) {
|
||||
$new_macros = [];
|
||||
foreach ($fieldsPlugin as $k => $v) {
|
||||
if ($v['macro'] === preg_replace('/_snmp_field/', '', $key)) {
|
||||
$fieldsPlugin[$k]['value'] = $this->replacementMacrosPlugin(
|
||||
$value,
|
||||
$infoMacros['macros']
|
||||
);
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$values['id_plugin'] = $infoMacros['server_plugin'];
|
||||
$values['macros'] = json_encode($fieldsPlugin);
|
||||
$values['id_plugin'] = $infoMacros['server_plugin'];
|
||||
$values['macros'] = json_encode($fieldsPlugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ($this->protocol === 'wmi') {
|
||||
|
|
Loading…
Reference in New Issue