fixed missing name and current value in snmp interface wizard when using satellite
This commit is contained in:
parent
9c290d917e
commit
6b724b7747
|
@ -441,7 +441,10 @@ class AgentWizard extends HTML
|
||||||
$this->resultsInterfaceWizard();
|
$this->resultsInterfaceWizard();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
hd('obtiene module blocks1', true);
|
||||||
$this->moduleBlocks = $this->getModuleBlocks();
|
$this->moduleBlocks = $this->getModuleBlocks();
|
||||||
|
hd($this->moduleBlocks, true);
|
||||||
|
// TRAZA0: hd($this->moduleBlocks, true); /// PARA VER CUÁL ES EL ID QUE TENEMOS QUE BUSCAR EN tnetwork_component.
|
||||||
if ($this->moduleBlocks === false) {
|
if ($this->moduleBlocks === false) {
|
||||||
$this->message['type'][] = 'info';
|
$this->message['type'][] = 'info';
|
||||||
$this->message['message'][] = __(
|
$this->message['message'][] = __(
|
||||||
|
@ -946,10 +949,12 @@ class AgentWizard extends HTML
|
||||||
// Set the name of interface.
|
// Set the name of interface.
|
||||||
$interfaces[$indexKey]['name'] = $name;
|
$interfaces[$indexKey]['name'] = $name;
|
||||||
// Get the description.
|
// Get the description.
|
||||||
|
hd('AQUI0', true);
|
||||||
$interfaces[$indexKey]['descr'] = $this->snmpGetValue(
|
$interfaces[$indexKey]['descr'] = $this->snmpGetValue(
|
||||||
'.1.3.6.1.2.1.2.2.1.2.'.$indexKey
|
'.1.3.6.1.2.1.2.2.1.2.'.$indexKey
|
||||||
);
|
);
|
||||||
// Get the MAC address.
|
// Get the MAC address.
|
||||||
|
hd('AQUI1', true);
|
||||||
$interfaces[$indexKey]['mac'] = $this->snmpGetValue(
|
$interfaces[$indexKey]['mac'] = $this->snmpGetValue(
|
||||||
'.1.3.6.1.2.1.2.2.1.6.'.$indexKey
|
'.1.3.6.1.2.1.2.2.1.6.'.$indexKey
|
||||||
);
|
);
|
||||||
|
@ -960,11 +965,13 @@ class AgentWizard extends HTML
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get interface alias.
|
// Get interface alias.
|
||||||
|
hd('AQUI2', true);
|
||||||
$interfaces[$indexKey]['alias'] = $this->snmpGetValue(
|
$interfaces[$indexKey]['alias'] = $this->snmpGetValue(
|
||||||
'.1.3.6.1.2.1.31.1.1.1.18.'.$indexKey
|
'.1.3.6.1.2.1.31.1.1.1.18.'.$indexKey
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get interface speed.
|
// Get interface speed.
|
||||||
|
hd('AQUI3', true);
|
||||||
$interfaces[$indexKey]['speed'] = $this->snmpGetValue(
|
$interfaces[$indexKey]['speed'] = $this->snmpGetValue(
|
||||||
'.1.3.6.1.2.1.2.2.1.5.'.$indexKey
|
'.1.3.6.1.2.1.2.2.1.5.'.$indexKey
|
||||||
);
|
);
|
||||||
|
@ -1116,6 +1123,7 @@ class AgentWizard extends HTML
|
||||||
// [1] => [wmi/wmic.c:196:main()] ERROR: Login to remote object.
|
// [1] => [wmi/wmic.c:196:main()] ERROR: Login to remote object.
|
||||||
// If execution gone fine.
|
// If execution gone fine.
|
||||||
if ($execCorrect === true) {
|
if ($execCorrect === true) {
|
||||||
|
hd('obtiene module blocks2', true);
|
||||||
$this->moduleBlocks = $this->getModuleBlocks();
|
$this->moduleBlocks = $this->getModuleBlocks();
|
||||||
} else {
|
} else {
|
||||||
$this->message['type'][] = 'error';
|
$this->message['type'][] = 'error';
|
||||||
|
@ -2405,6 +2413,8 @@ class AgentWizard extends HTML
|
||||||
private function resultsInterfaceWizard()
|
private function resultsInterfaceWizard()
|
||||||
{
|
{
|
||||||
$generalInterfaceModules = $this->getInterfacesModules();
|
$generalInterfaceModules = $this->getInterfacesModules();
|
||||||
|
// hd($generalInterfaceModules, true);
|
||||||
|
// TRAZA6 (ver si aqui llega todo bien seteado o si por el contrario se jode a partir de este punto)
|
||||||
$generalInterfaceTables = [];
|
$generalInterfaceTables = [];
|
||||||
$generalInterfaceModulesUpdated = [];
|
$generalInterfaceModulesUpdated = [];
|
||||||
$component_id_number = 0;
|
$component_id_number = 0;
|
||||||
|
@ -2423,7 +2433,8 @@ class AgentWizard extends HTML
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current value.
|
// Get current value.
|
||||||
if (in_array(
|
if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE
|
||||||
|
|| in_array(
|
||||||
$moduleData['module_type'],
|
$moduleData['module_type'],
|
||||||
[
|
[
|
||||||
MODULE_TYPE_REMOTE_SNMP,
|
MODULE_TYPE_REMOTE_SNMP,
|
||||||
|
@ -2433,8 +2444,10 @@ class AgentWizard extends HTML
|
||||||
]
|
]
|
||||||
) === true
|
) === true
|
||||||
) {
|
) {
|
||||||
|
if (isset($moduleData['value']) === true) {
|
||||||
$currentValue = $this->snmpGetValue($moduleData['value']);
|
$currentValue = $this->snmpGetValue($moduleData['value']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// It unit of measure have data, attach to current value.
|
// It unit of measure have data, attach to current value.
|
||||||
if (empty($moduleData['module_unit']) === false) {
|
if (empty($moduleData['module_unit']) === false) {
|
||||||
|
@ -2464,7 +2477,8 @@ class AgentWizard extends HTML
|
||||||
}
|
}
|
||||||
|
|
||||||
$generalInterfaceTables[0]['data'] = $generalInterfaceModulesUpdated;
|
$generalInterfaceTables[0]['data'] = $generalInterfaceModulesUpdated;
|
||||||
|
// hd("GENERAL1", true);
|
||||||
|
// hd($generalInterfaceTables, true);
|
||||||
// General Default monitoring.
|
// General Default monitoring.
|
||||||
html_print_div(
|
html_print_div(
|
||||||
[
|
[
|
||||||
|
@ -2576,6 +2590,7 @@ class AgentWizard extends HTML
|
||||||
|
|
||||||
$interfaceModulesUpdated = [];
|
$interfaceModulesUpdated = [];
|
||||||
$component_id_number = 0;
|
$component_id_number = 0;
|
||||||
|
|
||||||
foreach ($thisInterfaceModules as $moduleIndex => $moduleData) {
|
foreach ($thisInterfaceModules as $moduleIndex => $moduleData) {
|
||||||
if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) {
|
if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) {
|
||||||
if ($moduleData['module_type'] == MODULE_TYPE_REMOTE_SNMP) {
|
if ($moduleData['module_type'] == MODULE_TYPE_REMOTE_SNMP) {
|
||||||
|
@ -2593,7 +2608,8 @@ class AgentWizard extends HTML
|
||||||
// Get current value.
|
// Get current value.
|
||||||
$currentValue = '';
|
$currentValue = '';
|
||||||
|
|
||||||
if (in_array(
|
if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE
|
||||||
|
|| in_array(
|
||||||
$moduleData['module_type'],
|
$moduleData['module_type'],
|
||||||
[
|
[
|
||||||
MODULE_TYPE_REMOTE_SNMP,
|
MODULE_TYPE_REMOTE_SNMP,
|
||||||
|
@ -2603,8 +2619,10 @@ class AgentWizard extends HTML
|
||||||
]
|
]
|
||||||
) === true
|
) === true
|
||||||
) {
|
) {
|
||||||
|
if (isset($moduleData['value']) === true) {
|
||||||
$currentValue = $this->snmpGetValue($moduleData['value']);
|
$currentValue = $this->snmpGetValue($moduleData['value']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Format current value with thousands and decimals.
|
// Format current value with thousands and decimals.
|
||||||
if (is_numeric($currentValue) === true) {
|
if (is_numeric($currentValue) === true) {
|
||||||
|
@ -2621,7 +2639,7 @@ class AgentWizard extends HTML
|
||||||
$interfaceModulesUpdated[] = [
|
$interfaceModulesUpdated[] = [
|
||||||
'component_id' => $component_id_number++,
|
'component_id' => $component_id_number++,
|
||||||
'execution_type' => $moduleData['execution_type'],
|
'execution_type' => $moduleData['execution_type'],
|
||||||
'name' => $moduleData['module_name'],
|
'name' => io_safe_input($moduleData['module_name']),
|
||||||
'type' => $moduleData['module_type'],
|
'type' => $moduleData['module_type'],
|
||||||
'description' => $moduleData['module_description'],
|
'description' => $moduleData['module_description'],
|
||||||
'min_warning' => $moduleData['module_thresholds']['min_warning'],
|
'min_warning' => $moduleData['module_thresholds']['min_warning'],
|
||||||
|
@ -2644,6 +2662,8 @@ class AgentWizard extends HTML
|
||||||
$interfaceTables[$interface['name']]['data'] = $interfaceModulesUpdated;
|
$interfaceTables[$interface['name']]['data'] = $interfaceModulesUpdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hd('GENERAL22222', true);
|
||||||
|
hd($interfaceTables, true);
|
||||||
html_print_div(
|
html_print_div(
|
||||||
[
|
[
|
||||||
'class' => 'wizard wizard-result',
|
'class' => 'wizard wizard-result',
|
||||||
|
@ -2956,6 +2976,7 @@ class AgentWizard extends HTML
|
||||||
{
|
{
|
||||||
$moduleBlocks = $this->moduleBlocks;
|
$moduleBlocks = $this->moduleBlocks;
|
||||||
|
|
||||||
|
// TRAZA1: hd($moduleBlocks, true); /// COMPROBAR QUE moduleBlocks NO ESTÁ VACÍO.
|
||||||
$blockTables = [];
|
$blockTables = [];
|
||||||
// Lets work with the modules.
|
// Lets work with the modules.
|
||||||
foreach ($moduleBlocks as $k => $module) {
|
foreach ($moduleBlocks as $k => $module) {
|
||||||
|
@ -2980,6 +3001,7 @@ class AgentWizard extends HTML
|
||||||
// Common for FIXED Scan types.
|
// Common for FIXED Scan types.
|
||||||
// If _nameOID_ macro exists, stablish the name getted.
|
// If _nameOID_ macro exists, stablish the name getted.
|
||||||
if (empty($module['name_oid']) === false) {
|
if (empty($module['name_oid']) === false) {
|
||||||
|
hd('AQUI7', true);
|
||||||
$nameValue = $this->snmpGetValue($module['name_oid']);
|
$nameValue = $this->snmpGetValue($module['name_oid']);
|
||||||
$moduleBlocks[$k]['name'] = str_replace(
|
$moduleBlocks[$k]['name'] = str_replace(
|
||||||
'_nameOID_',
|
'_nameOID_',
|
||||||
|
@ -2994,7 +3016,10 @@ class AgentWizard extends HTML
|
||||||
$module['value'] = 0;
|
$module['value'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hd('AQUI8', true);
|
||||||
|
// TRAZA3: hd($module['value'], true); /// COMPROBAR SI $module['value'] ESTÁ VACÍO.
|
||||||
$value = $this->snmpGetValue($module['value']);
|
$value = $this->snmpGetValue($module['value']);
|
||||||
|
|
||||||
// If the value is missing, we must not show this module.
|
// If the value is missing, we must not show this module.
|
||||||
if (empty($value) === true) {
|
if (empty($value) === true) {
|
||||||
unset($moduleBlocks[$k]);
|
unset($moduleBlocks[$k]);
|
||||||
|
@ -3006,6 +3031,9 @@ class AgentWizard extends HTML
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hd('TRAZA2', true);
|
||||||
|
// TRAZA2: hd($moduleBlocks[$k], true); /// COMPROBAR QUE current_value ESTÁ VACÍO.
|
||||||
|
// $moduleBlocks[$k]['current_value'] = 'blablabla';
|
||||||
$moduleBlocks[$k]['macros'] = '';
|
$moduleBlocks[$k]['macros'] = '';
|
||||||
} else {
|
} else {
|
||||||
// Three steps for FIXED PLUGIN wizard modules.
|
// Three steps for FIXED PLUGIN wizard modules.
|
||||||
|
@ -3016,6 +3044,7 @@ class AgentWizard extends HTML
|
||||||
// OIDs and get his values.
|
// OIDs and get his values.
|
||||||
foreach ($macros as $key => $oid) {
|
foreach ($macros as $key => $oid) {
|
||||||
if (preg_match('/extra_field_/', $key) !== 0) {
|
if (preg_match('/extra_field_/', $key) !== 0) {
|
||||||
|
hd('AQUI9', true);
|
||||||
$value = (float) $this->snmpGetValue($oid);
|
$value = (float) $this->snmpGetValue($oid);
|
||||||
|
|
||||||
// If the value not exists,
|
// If the value not exists,
|
||||||
|
@ -3135,6 +3164,7 @@ class AgentWizard extends HTML
|
||||||
foreach ($oids as $oidName => $oid) {
|
foreach ($oids as $oidName => $oid) {
|
||||||
$currentOid = $oid.'.'.$tmpSecond[0];
|
$currentOid = $oid.'.'.$tmpSecond[0];
|
||||||
$macros['macros'][$oidName] = $currentOid;
|
$macros['macros'][$oidName] = $currentOid;
|
||||||
|
hd('AQUI10', true);
|
||||||
$currentOidValue = $this->snmpGetValue($currentOid);
|
$currentOidValue = $this->snmpGetValue($currentOid);
|
||||||
// If for any reason the value comes empty, add 1.
|
// If for any reason the value comes empty, add 1.
|
||||||
if ($currentOidValue == '') {
|
if ($currentOidValue == '') {
|
||||||
|
@ -3288,7 +3318,7 @@ class AgentWizard extends HTML
|
||||||
$fields,
|
$fields,
|
||||||
$whereString
|
$whereString
|
||||||
);
|
);
|
||||||
|
// hd(db_get_all_rows_sql($sql), true);
|
||||||
return db_get_all_rows_sql($sql);
|
return db_get_all_rows_sql($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4506,6 +4536,7 @@ class AgentWizard extends HTML
|
||||||
$inv_critical = false;
|
$inv_critical = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TRAZA5 hd($name); (ver si llega aquí Y valor de $name)
|
||||||
$moduleName = $name.'ifOperStatus';
|
$moduleName = $name.'ifOperStatus';
|
||||||
$definition['ifOperStatus'] = [
|
$definition['ifOperStatus'] = [
|
||||||
'module_name' => $moduleName,
|
'module_name' => $moduleName,
|
||||||
|
|
Loading…
Reference in New Issue