diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php
index 2c121c87fb..b7a9c6295f 100644
--- a/pandora_console/godmode/agentes/agent_manager.php
+++ b/pandora_console/godmode/agentes/agent_manager.php
@@ -372,13 +372,13 @@ $table_server = '
'.__('Server')
$table_server .= '
';
if ($new_agent) {
// Set first server by default.
- $servers_get_names = servers_get_names();
+ $servers_get_names = $servers;
$array_keys_servers_get_names = array_keys($servers_get_names);
$server_name = reset($array_keys_servers_get_names);
}
$table_server .= html_print_select(
- servers_get_names(),
+ $servers,
'server_name',
$server_name,
'',
diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php
index 2dca9353ac..45d899822a 100644
--- a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php
+++ b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php
@@ -1,16 +1,32 @@
] => [] array
+ // Build a [] => [] array.
if (!empty($snmp_int_ip)) {
foreach ($snmp_int_ip as $key => $value) {
- // The key is something like IP-MIB::ipAddressIfIndex.ipv4.""
- // or IP-MIB::ipAddressIfIndex.ipv6.""
- // The value is something like INTEGER:
+ // The key is something like IP-MIB::ipAddressIfIndex.ipv4."".
+ // or IP-MIB::ipAddressIfIndex.ipv6."".
+ // The value is something like INTEGER: .
$data = explode(': ', $value);
$interface_id = !empty($data) && isset($data[1]) ? $data[1] : false;
@@ -110,7 +126,7 @@ if ($snmpwalk) {
$interface_ip = $matches[1];
}
- // Get the first ip
+ // Get the first ip.
if ($interface_id !== false && !empty($interface_ip) && !isset($interfaces_ip[$interface_id])) {
$interfaces_ip[$interface_id] = $interface_ip;
}
@@ -119,17 +135,17 @@ if ($snmpwalk) {
unset($snmp_int_ip);
}
- $snmpis = array_merge(($snmpis === false ? [] : $snmpis), ($ifxitems === false ? [] : $ifxitems));
+ $snmpis = array_merge((($snmpis === false) ? [] : $snmpis), (($ifxitems === false) ? [] : $ifxitems));
$interfaces = [];
- // We get here only the interface part of the MIB, not full mib
+ // We get here only the interface part of the MIB, not full mib.
foreach ($snmpis as $key => $snmp) {
$data = explode(': ', $snmp, 2);
$keydata = explode('::', $key);
$keydata2 = explode('.', $keydata[1]);
- // Avoid results without index and interfaces without name
+ // Avoid results without index and interfaces without name.
if (!isset($keydata2[1]) || !isset($data[1])) {
continue;
}
@@ -239,24 +255,22 @@ if ($create_modules) {
$oid_array[(count($oid_array) - 1)] = $id;
$oid = implode('.', $oid_array);
- // Get the name
+ // Get the name.
$name_array = explode('::', $oid_array[0]);
$name = $ifname.'_'.$name_array[1];
- // Clean the name
+ // Clean the name.
$name = str_replace('"', '', $name);
- // Proc moduletypes
+ // Proc moduletypes.
if (preg_match('/Status/', $name_array[1])) {
$module_type = 18;
} else if (preg_match('/Present/', $name_array[1])) {
$module_type = 18;
} else if (preg_match('/PromiscuousMode/', $name_array[1])) {
$module_type = 18;
- }
-
- // String moduletypes
- else if (preg_match('/Alias/', $name_array[1])) {
+ } else if (preg_match('/Alias/', $name_array[1])) {
+ // String moduletypes.
$module_type = 17;
} else if (preg_match('/Address/', $name_array[1])) {
$module_type = 17;
@@ -266,15 +280,11 @@ if ($create_modules) {
$module_type = 17;
} else if (preg_match('/Descr/', $name_array[1])) {
$module_type = 17;
- }
-
- // Specific counters (ends in s)
- else if (preg_match('/s$/', $name_array[1])) {
+ } else if (preg_match('/s$/', $name_array[1])) {
+ // Specific counters (ends in s).
$module_type = 16;
- }
-
- // Otherwise, numeric
- else {
+ } else {
+ // Otherwise, numeric.
$module_type = 15;
}
@@ -330,7 +340,7 @@ if ($create_modules) {
$output_oid = '';
- exec('ssh pandora_exec_proxy@'.$row['ip_address'].' snmptranslate -On '.$oid, $output_oid, $rc);
+ exec('snmptranslate -On '.$oid, $output_oid, $rc);
$conf_oid = $output_oid[0];
$oid = $conf_oid;
@@ -397,7 +407,9 @@ if ($create_modules) {
}
if ($done > 0) {
- ui_print_success_message(__('Successfully modules created')." ($done)");
+ ui_print_success_message(
+ __('Successfully modules created').' ('.$done.')'
+ );
}
if (!empty($errors)) {
@@ -407,17 +419,17 @@ if ($create_modules) {
foreach ($errors as $code => $number) {
switch ($code) {
case ERR_EXIST:
- $msg .= '
'.__('Another module already exists with the same name')." ($number)";
+ $msg .= '
'.__('Another module already exists with the same name').' ('.$number.')';
break;
case ERR_INCOMPLETE:
- $msg .= '
'.__('Some required fields are missed').': ('.__('name').') '." ($number)";
+ $msg .= '
'.__('Some required fields are missed').': ('.__('name').') ('.$number.')';
break;
case ERR_DB:
case ERR_GENERIC:
default:
- $msg .= '
'.__('Processing error')." ($number)";
+ $msg .= '
'.__('Processing error').' ('.$number.')';
break;
}
}
@@ -426,10 +438,10 @@ if ($create_modules) {
}
}
-// Create the interface list for the interface
+// Create the interface list for the interface.
$interfaces_list = [];
foreach ($interfaces as $interface) {
- // Get the interface name, removing " " characters and avoid "blank" interfaces
+ // Get the interface name, removing " " characters and avoid "blank" interfaces.
if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != '') {
$ifname = $interface['ifDescr']['value'];
} else if (isset($interface['ifName']) && $interface['ifName']['value'] != '') {
@@ -442,7 +454,7 @@ foreach ($interfaces as $interface) {
}
echo ''.__('None').'';
-echo "';
if (!empty($interfaces_list)) {
echo ''.__('None').'';
- echo "