Merge branch 'ent-6531-Bug-en-item-Simple-graph-de-informes-metaconsola' into 'develop'
fixed error report selector modules in metaconsole See merge request artica/pandorafms!3544
This commit is contained in:
commit
8a47210dd5
|
@ -223,8 +223,9 @@ switch ($action) {
|
||||||
$server_name = $item['server_name'];
|
$server_name = $item['server_name'];
|
||||||
|
|
||||||
// Metaconsole db connection.
|
// Metaconsole db connection.
|
||||||
if ($meta && !empty($server_name)) {
|
if ($meta && empty($server_name) === false) {
|
||||||
$connection = metaconsole_get_connection($server_name);
|
$connection = metaconsole_get_connection($server_name);
|
||||||
|
$server_id = $connection['id'];
|
||||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
if (metaconsole_load_external_db($connection) != NOERR) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1383,8 +1384,7 @@ $class = 'databox filters';
|
||||||
|
|
||||||
html_print_input_hidden('id_agent', $idAgent);
|
html_print_input_hidden('id_agent', $idAgent);
|
||||||
html_print_input_hidden('server_name', $server_name);
|
html_print_input_hidden('server_name', $server_name);
|
||||||
html_print_input_hidden('server_id', $server_name);
|
html_print_input_hidden('server_id', $server_id);
|
||||||
html_print_input_hidden('id_server', '');
|
|
||||||
|
|
||||||
$params = [];
|
$params = [];
|
||||||
$params['show_helptip'] = false;
|
$params['show_helptip'] = false;
|
||||||
|
|
|
@ -1380,11 +1380,12 @@ switch ($action) {
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'update':
|
case 'update':
|
||||||
$values = [];
|
$values = [];
|
||||||
$server_name = get_parameter('server_id');
|
$server_id = get_parameter('server_id', 0);
|
||||||
if (is_metaconsole() && $server_name != '') {
|
if (is_metaconsole() === true
|
||||||
$id_meta = metaconsole_get_id_server($server_name);
|
&& empty($server_id) === false
|
||||||
|
) {
|
||||||
$connection = metaconsole_get_connection_by_id(
|
$connection = metaconsole_get_connection_by_id(
|
||||||
$id_meta
|
$server_id
|
||||||
);
|
);
|
||||||
metaconsole_connect($connection);
|
metaconsole_connect($connection);
|
||||||
$values['server_name'] = $connection['server_name'];
|
$values['server_name'] = $connection['server_name'];
|
||||||
|
@ -1811,7 +1812,6 @@ switch ($action) {
|
||||||
'combo_modulegroup'
|
'combo_modulegroup'
|
||||||
);
|
);
|
||||||
$values['id_group'] = get_parameter('combo_group');
|
$values['id_group'] = get_parameter('combo_group');
|
||||||
$values['server_name'] = get_parameter('server_name');
|
|
||||||
|
|
||||||
if ($values['server_name'] == '') {
|
if ($values['server_name'] == '') {
|
||||||
$values['server_name'] = get_parameter(
|
$values['server_name'] = get_parameter(
|
||||||
|
@ -1867,9 +1867,7 @@ switch ($action) {
|
||||||
);
|
);
|
||||||
|
|
||||||
// If metaconsole is activated.
|
// If metaconsole is activated.
|
||||||
if ($config['metaconsole'] == 1
|
if (is_metaconsole() === true) {
|
||||||
&& defined('METACONSOLE')
|
|
||||||
) {
|
|
||||||
if (($values['type'] == 'custom_graph')
|
if (($values['type'] == 'custom_graph')
|
||||||
|| ($values['type'] == 'automatic_custom_graph')
|
|| ($values['type'] == 'automatic_custom_graph')
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -216,7 +216,7 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
|
||||||
} else if ($search_agents && is_metaconsole()) {
|
} else if ($search_agents && is_metaconsole()) {
|
||||||
$id_agent = (int) get_parameter('id_agent');
|
$id_agent = (int) get_parameter('id_agent');
|
||||||
$string = (string) get_parameter('q');
|
$string = (string) get_parameter('q');
|
||||||
// q is what autocomplete plugin gives
|
// Q is what autocomplete plugin gives.
|
||||||
$id_group = (int) get_parameter('id_group', -1);
|
$id_group = (int) get_parameter('id_group', -1);
|
||||||
$addedItems = html_entity_decode((string) get_parameter('add'));
|
$addedItems = html_entity_decode((string) get_parameter('add'));
|
||||||
$addedItems = json_decode($addedItems);
|
$addedItems = json_decode($addedItems);
|
||||||
|
@ -236,6 +236,7 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
|
||||||
'alias',
|
'alias',
|
||||||
'direccion',
|
'direccion',
|
||||||
'id_tmetaconsole_setup AS id_server',
|
'id_tmetaconsole_setup AS id_server',
|
||||||
|
'server_name',
|
||||||
];
|
];
|
||||||
|
|
||||||
$filter = [];
|
$filter = [];
|
||||||
|
@ -254,36 +255,33 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
|
||||||
case 'enabled':
|
case 'enabled':
|
||||||
$filter['disabled'] = 0;
|
$filter['disabled'] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Not possible.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($id_agent)) {
|
if (empty($id_agent) === false) {
|
||||||
$filter['id_agente'] = $id_agent;
|
$filter['id_agente'] = $id_agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($string)) {
|
if (empty($string) === false) {
|
||||||
// Get agents for only the alias.
|
// Get agents for only the alias.
|
||||||
$filter_alias = $filter;
|
$filter_alias = $filter;
|
||||||
switch ($config['dbtype']) {
|
$filter_alias[] = '(alias COLLATE utf8_general_ci LIKE "%'.$string.'%")';
|
||||||
case 'mysql':
|
|
||||||
$filter_alias[] = '(alias COLLATE utf8_general_ci LIKE "%'.$string.'%")';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'postgresql':
|
$agents = db_get_all_rows_filter(
|
||||||
$filter_alias[] = '(alias LIKE \'%'.$string.'%\')';
|
'tmetaconsole_agent',
|
||||||
break;
|
$filter_alias,
|
||||||
|
$fields
|
||||||
|
);
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$filter_alias[] = '(UPPER(alias) LIKE UPPER(\'%'.$string.'%\'))';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_alias, $fields);
|
|
||||||
if ($agents !== false) {
|
if ($agents !== false) {
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'id' => $agent['id_agente'],
|
'id' => $agent['id_agente'],
|
||||||
'name' => io_safe_output($agent['nombre']),
|
'name' => io_safe_output($agent['nombre']),
|
||||||
'alias' => io_safe_output($agent['alias']),
|
'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')',
|
||||||
'ip' => io_safe_output($agent['direccion']),
|
'ip' => io_safe_output($agent['direccion']),
|
||||||
'id_server' => $agent['id_server'],
|
'id_server' => $agent['id_server'],
|
||||||
'filter' => 'alias',
|
'filter' => 'alias',
|
||||||
|
@ -293,27 +291,20 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
|
||||||
|
|
||||||
// Get agents for only the name.
|
// Get agents for only the name.
|
||||||
$filter_agents = $filter;
|
$filter_agents = $filter;
|
||||||
switch ($config['dbtype']) {
|
$filter_agents[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci LIKE "%'.$string.'%")';
|
||||||
case 'mysql':
|
|
||||||
$filter_agents[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci LIKE "%'.$string.'%")';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'postgresql':
|
$agents = db_get_all_rows_filter(
|
||||||
$filter_agents[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre LIKE \'%'.$string.'%\')';
|
'tmetaconsole_agent',
|
||||||
break;
|
$filter_agents,
|
||||||
|
$fields
|
||||||
|
);
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$filter_agents[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) LIKE UPPER(\'%'.$string.'%\'))';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_agents, $fields);
|
|
||||||
if ($agents !== false) {
|
if ($agents !== false) {
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'id' => $agent['id_agente'],
|
'id' => $agent['id_agente'],
|
||||||
'name' => io_safe_output($agent['nombre']),
|
'name' => io_safe_output($agent['nombre']),
|
||||||
'alias' => io_safe_output($agent['alias']),
|
'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')',
|
||||||
'ip' => io_safe_output($agent['direccion']),
|
'ip' => io_safe_output($agent['direccion']),
|
||||||
'id_server' => $agent['id_server'],
|
'id_server' => $agent['id_server'],
|
||||||
'filter' => 'agent',
|
'filter' => 'agent',
|
||||||
|
@ -321,29 +312,22 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get agents for only the address
|
// Get agents for only the address.
|
||||||
$filter_address = $filter;
|
$filter_address = $filter;
|
||||||
switch ($config['dbtype']) {
|
$filter_address[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion LIKE "%'.$string.'%")';
|
||||||
case 'mysql':
|
|
||||||
$filter_address[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion LIKE "%'.$string.'%")';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'postgresql':
|
$agents = db_get_all_rows_filter(
|
||||||
$filter_address[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre NOT LIKE \'%'.$string.'%\' AND direccion LIKE \'%'.$string.'%\')';
|
'tmetaconsole_agent',
|
||||||
break;
|
$filter_address,
|
||||||
|
$fields
|
||||||
|
);
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$filter_address[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) LIKE UPPER(\'%'.$string.'%\'))';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_address, $fields);
|
|
||||||
if ($agents !== false) {
|
if ($agents !== false) {
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'id' => $agent['id_agente'],
|
'id' => $agent['id_agente'],
|
||||||
'name' => io_safe_output($agent['nombre']),
|
'name' => io_safe_output($agent['nombre']),
|
||||||
'alias' => io_safe_output($agent['alias']),
|
'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')',
|
||||||
'ip' => io_safe_output($agent['direccion']),
|
'ip' => io_safe_output($agent['direccion']),
|
||||||
'id_server' => $agent['id_server'],
|
'id_server' => $agent['id_server'],
|
||||||
'filter' => 'address',
|
'filter' => 'address',
|
||||||
|
@ -351,29 +335,22 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get agents for only the description
|
// Get agents for only the description.
|
||||||
$filter_description = $filter;
|
$filter_description = $filter;
|
||||||
switch ($config['dbtype']) {
|
$filter_description[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion NOT LIKE "%'.$string.'%" AND comentarios LIKE "%'.$string.'%")';
|
||||||
case 'mysql':
|
|
||||||
$filter_description[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion NOT LIKE "%'.$string.'%" AND comentarios LIKE "%'.$string.'%")';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'postgresql':
|
$agents = db_get_all_rows_filter(
|
||||||
$filter_description[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre NOT LIKE \'%'.$string.'%\' AND direccion NOT LIKE \'%'.$string.'%\' AND comentarios LIKE \'%'.$string.'%\')';
|
'tmetaconsole_agent',
|
||||||
break;
|
$filter_description,
|
||||||
|
$fields
|
||||||
|
);
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$filter_description[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_description, $fields);
|
|
||||||
if ($agents !== false) {
|
if ($agents !== false) {
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'id' => $agent['id_agente'],
|
'id' => $agent['id_agente'],
|
||||||
'name' => io_safe_output($agent['nombre']),
|
'name' => io_safe_output($agent['nombre']),
|
||||||
'alias' => io_safe_output($agent['alias']),
|
'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')',
|
||||||
'ip' => io_safe_output($agent['direccion']),
|
'ip' => io_safe_output($agent['direccion']),
|
||||||
'id_server' => $agent['id_server'],
|
'id_server' => $agent['id_server'],
|
||||||
'filter' => 'description',
|
'filter' => 'description',
|
||||||
|
|
Loading…
Reference in New Issue