Changed agent name
This commit is contained in:
parent
370f7ff373
commit
cf3d44872f
|
@ -37,10 +37,11 @@ function createXMLData($agent, $agentModule, $time, $data) {
|
|||
$xml = sprintf($xmlTemplate, io_safe_output(get_os_name($agent['id_os'])),
|
||||
io_safe_output($agent['os_version']), $agent['intervalo'],
|
||||
io_safe_output($agent['agent_version']), $time,
|
||||
io_safe_output($agent['nombre']), $agent['timezone_offset'],
|
||||
io_safe_output($agent['alias']), $agent['timezone_offset'],
|
||||
io_safe_output($agentModule['nombre']), io_safe_output($agentModule['descripcion']), modules_get_type_name($agentModule['id_tipo_modulo']), $data);
|
||||
|
||||
if (false === @file_put_contents($config['remote_config'] . '/' . io_safe_output($agent['nombre']) . '.' . strtotime($time) . '.data', $xml)) {
|
||||
|
||||
|
||||
if (false === @file_put_contents($config['remote_config'] . '/' . io_safe_output($agent['alias']) . '.' . strtotime($time) . '.data', $xml)) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
@ -83,7 +84,7 @@ function mainInsertData() {
|
|||
ui_print_error_message(__('You haven\'t privileges for insert data in the agent.'));
|
||||
}
|
||||
else {
|
||||
$agent = db_get_row_filter('tagente', array('nombre' => $id_agent));
|
||||
$agent = db_get_row_filter('tagente', array('alias' => $id_agent));
|
||||
$agentModule = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module));
|
||||
|
||||
$done = 0;
|
||||
|
|
|
@ -30,10 +30,10 @@ if (is_ajax ()) {
|
|||
switch ($config['dbtype']) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%' . $string . '%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
|
||||
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%' . $string . '%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%" OR alias LIKE "%'.$string.'%")';
|
||||
break;
|
||||
case "oracle":
|
||||
$filter[] = '(upper(nombre) LIKE upper(\'%'.$string.'%\') OR upper(direccion) LIKE upper(\'%'.$string.'%\') OR upper(comentarios) LIKE upper(\'%'.$string.'%\'))';
|
||||
$filter[] = '(upper(nombre) LIKE upper(\'%'.$string.'%\') OR upper(direccion) LIKE upper(\'%'.$string.'%\') OR upper(comentarios) LIKE upper(\'%'.$string.'%\') OR upper(alias) LIKE upper(\'%'.$string.'%\'))';
|
||||
break;
|
||||
}
|
||||
$filter[] = 'id_agente != ' . $id_agent;
|
||||
|
@ -150,7 +150,7 @@ $table->style[0] = 'font-weight: bold; width: 150px;';
|
|||
$table->data = array ();
|
||||
|
||||
$table->align[2] = 'center';
|
||||
html_debug($alias);
|
||||
|
||||
if(!$new_agent && $alias != ''){
|
||||
$table->data[0][0] = __('Agent name') .
|
||||
ui_print_help_tip (__("The agent's name must be the same as the one defined at the console"), true);
|
||||
|
|
|
@ -189,12 +189,12 @@ if ($searchFlag) {
|
|||
case "postgresql":
|
||||
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
|
||||
FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente
|
||||
WHERE t1.nombre LIKE '" . trim($agentName) . "')";
|
||||
WHERE t1.alias LIKE '" . trim($agentName) . "')";
|
||||
break;
|
||||
case "oracle":
|
||||
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
|
||||
FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente
|
||||
WHERE t1.nombre LIKE '" . trim($agentName) . "')";
|
||||
WHERE t1.alias LIKE '" . trim($agentName) . "')";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -456,8 +456,8 @@ foreach ($simple_alerts as $alert) {
|
|||
|
||||
if ($alert['disabled'])
|
||||
$data[0] .= '<span style="font-style: italic; color: #aaaaaa;">';
|
||||
$agent_name = agents_get_name ($id_agent);
|
||||
$data[0] .= ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[…]', 'display:block;font-size: 7.2pt');
|
||||
$alias = db_get_value ("alias","tagente","id_agente",$id_agent);
|
||||
$data[0] .= $alias;
|
||||
if ($alert['disabled'])
|
||||
$data[0] .= '</span>';
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ if ($id) {
|
|||
}
|
||||
}
|
||||
if ($id_agent != 0) {
|
||||
$text_agent = db_get_value('nombre', 'tagente', 'id_agente', $id_agent);
|
||||
$text_agent = db_get_value('alias', 'tagente', 'id_agente', $id_agent);
|
||||
if ($text_agent == false) {
|
||||
$text_agent = '';
|
||||
}
|
||||
|
|
|
@ -370,7 +370,10 @@ foreach ($layoutDatas as $layoutData) {
|
|||
"none", $layoutData['id_metaconsole'], true);
|
||||
}
|
||||
else {
|
||||
$params['value'] = agents_get_name($layoutData['id_agent']);
|
||||
$params['print_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_name'] = 'id_agent_' . $idLayoutData;
|
||||
$params['hidden_input_idagent_value'] = $layoutData['id_agent'];
|
||||
$params['value'] = db_get_value ("alias","tagente","id_agente",$layoutData['id_agent']);
|
||||
}
|
||||
|
||||
if ($layoutData['id_agent'] == 0 and $layoutData['id_custom_graph'] != 0) {
|
||||
|
|
|
@ -350,7 +350,8 @@ switch ($activeTab) {
|
|||
$values['id_agent'] = (int) get_parameter('id_agent_' . $id, 0);
|
||||
}
|
||||
else {
|
||||
$values['id_agent'] = agents_get_agent_id($agentName);
|
||||
$agent_id = (int) get_parameter('id_agent_' . $id, 0);
|
||||
$values['id_agent'] = $agent_id;
|
||||
}
|
||||
$values['id_agente_modulo'] = get_parameter('module_' . $id, 0);
|
||||
$values['id_custom_graph'] = get_parameter('custom_graph_' . $id, 0);
|
||||
|
|
|
@ -882,6 +882,21 @@ function agents_get_group_agents ($id_group = 0, $search = false,
|
|||
unset ($search["name"]);
|
||||
}
|
||||
|
||||
if (isset ($search["alias"])) {
|
||||
$name = io_safe_input ($search["alias"]);
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$filter[] = "alias COLLATE utf8_general_ci LIKE '$name'";
|
||||
break;
|
||||
case "oracle":
|
||||
$filter[] = "UPPER(alias) LIKE UPPER('$name')";
|
||||
break;
|
||||
}
|
||||
|
||||
unset ($search["alias"]);
|
||||
}
|
||||
|
||||
if (isset($search['status'])) {
|
||||
switch ($search['status']) {
|
||||
case AGENT_STATUS_NORMAL:
|
||||
|
|
|
@ -3205,7 +3205,7 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
|
||||
|
||||
select: function( event, ui ) {
|
||||
var agent_name = ui.item.name;
|
||||
var agent_name = ui.item.alias;
|
||||
var agent_id = ui.item.id;
|
||||
var server_name = "";
|
||||
var server_id = "";
|
||||
|
|
|
@ -461,7 +461,7 @@ if (is_ajax ()) {
|
|||
|
||||
if ($agentName != null) {
|
||||
$search = array();
|
||||
$search['name'] = io_safe_output($agentName);
|
||||
$search['alias'] = io_safe_output($agentName);
|
||||
}
|
||||
else
|
||||
$search = false;
|
||||
|
|
|
@ -94,7 +94,7 @@ $result = db_get_all_rows_sql ($sql);
|
|||
foreach ($result as $row) {
|
||||
$agente = "";
|
||||
if ($row["id_agente"] != 0) {
|
||||
$agente = db_get_sql ("SELECT nombre
|
||||
$agente = db_get_sql ("SELECT alias
|
||||
FROM tagente
|
||||
WHERE id_agente = ". $row["id_agente"]);
|
||||
$agente = $agente . " : ";
|
||||
|
|
|
@ -351,7 +351,7 @@ echo '<td class="datos">';
|
|||
$params = array();
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'agent';
|
||||
$params['value'] = agents_get_name ($id_agent);
|
||||
$params['value'] = db_get_value("alias","tagente","id_agente",$id_agent);
|
||||
$params['print_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_value'] = $id_agent;
|
||||
$params['hidden_input_idagent_name'] = 'id_agent';
|
||||
|
|
Loading…
Reference in New Issue