2013-08-20 Miguel de Dios <miguel.dedios@artica.es>

* godmode/servers/servers.build_table.php, include/functions_db.php,
	include/functions_servers.php, index.php: improved the source code
	style.
	
	* include/functions_api.php: added the call to update the agent.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8682 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-08-21 12:37:37 +00:00
parent 00c554f0b4
commit 04afb4615d
6 changed files with 115 additions and 55 deletions

View File

@ -1,3 +1,11 @@
2013-08-20 Miguel de Dios <miguel.dedios@artica.es>
* godmode/servers/servers.build_table.php, include/functions_db.php,
include/functions_servers.php, index.php: improved the source code
style.
* include/functions_api.php: added the call to update the agent.
2013-08-20 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php: added calls to set gis data for agent

View File

@ -101,7 +101,8 @@ foreach ($servers as $server) {
default:
$data[3] = progress_bar($server["load"], 60, 20, $server["lag_txt"], 0);
$data[4] = $server["modules"] . " ".__('of')." ". $server["modules_total"];
$data[5] = '<span style="white-space:nowrap;">'.$server["lag_txt"].'</span>';
$data[5] = '<span style="white-space:nowrap;">' .
$server["lag_txt"] . '</span>';
break;
}
@ -116,7 +117,8 @@ foreach ($servers as $server) {
$data[8] .= html_print_image ('images/target.png', true,
array('title' => __('Reset module status and fired alert counts')));
$data[8] .= '</a>&nbsp;&nbsp;';
} else if ($server['type'] == 'enterprise snmp') {
}
else if ($server['type'] == 'enterprise snmp') {
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server["id_server"].'">';
$data[8] .= html_print_image ('images/target.png', true,
array('title' => __('Claim back SNMP modules')));

View File

@ -722,6 +722,41 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
returnData($returnType, $data, $separator);
}
function api_set_update_agent($id_agent, $thrash2, $other, $thrash3) {
global $config;
//html_debug_print($other);
$name = $other['data'][0];
$ip = $other['data'][1];
$idParent = $other['data'][2];
$idGroup = $other['data'][3];
$cascadeProtection = $other['data'][4];
$intervalSeconds = $other['data'][5];
$idOS = $other['data'][6];
$idServer = $other['data'][7];
$customId = $other['data'][8];
$learningMode = $other['data'][9];
$disabled = $other['data'][10];
$description = $other['data'][11];
$return = db_process_sql_update('tagente',
array('nombre' => $name,
'direccion' => $ip,
'id_grupo' => $idGroup,
'intervalo' => $intervalSeconds,
'comentarios' => $description,
'modo' => $learningMode,
'id_os' => $idOS,
'disabled' => $disabled,
'cascade_protection' => $cascadeProtection,
'server_name' => $nameServer,
'id_parent' => $idParent,
'custom_id' => $customId),
array('id_agente' => $id_agent));
returnData('string',
array('type' => 'string', 'data' => (int)((bool)$return)));
}
/**
* Create a new agent, and print the id for new agent.
*
@ -754,11 +789,13 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3) {
switch ($config["dbtype"]) {
case "mysql":
$sql1 = 'SELECT name FROM tserver WHERE id_server ='. $idServer;
$sql1 = 'SELECT name
FROM tserver WHERE id_server =' . $idServer;
break;
case "postgresql":
case "oracle":
$sql1 = 'SELECT name FROM tserver WHERE id_server ='. $idServer;
$sql1 = 'SELECT name
FROM tserver WHERE id_server =' . $idServer;
break;
}
@ -768,13 +805,22 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3) {
returnError('agent_name_exist', 'The name of agent yet exist in DB.');
}
else if (($idParent != 0) &&
(db_get_value_sql('SELECT id_agente FROM tagente WHERE id_agente = ' . $idParent) === false)) {
(db_get_value_sql('SELECT id_agente
FROM tagente
WHERE id_agente = ' . $idParent) === false)) {
returnError('parent_agent_not_exist', 'The agent parent don`t exist.');
}
else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = ' . $idGroup) === false) {
else if (db_get_value_sql('SELECT id_grupo
FROM tgrupo
WHERE id_grupo = ' . $idGroup) === false) {
returnError('id_grupo_not_exist', 'The group don`t exist.');
}
else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = ' . $idOS) === false) {
else if (db_get_value_sql('SELECT id_os
FROM tconfig_os
WHERE id_os = ' . $idOS) === false) {
returnError('id_os_not_exist', 'The OS don`t exist.');
}
else if (db_get_value_sql($sql1) === false) {
@ -840,6 +886,7 @@ function api_set_create_custom_field($t1, $t2, $other, $returnType) {
$data['type'] = "string";
$data["data"] = $result;
returnData("string", $data);
}
}

View File

@ -600,7 +600,11 @@ function servers_get_info ($id_server = -1) {
} // Take data for realtime mode
if (isset($server["module_lag"]))
$server["lag_txt"] = ($server["lag"] == 0 ? '-' : human_time_description_raw ($server["lag"])) . " / ". $server["module_lag"];
$server["lag_txt"] =
($server["lag"] == 0 ?
'-'
:
human_time_description_raw($server["lag"])) . " / " . $server["module_lag"];
else
$server["lag_txt"] = "";

View File

@ -570,7 +570,6 @@ require('include/php_to_js_values.php');
?>
<script type="text/javascript" language="javascript">
//Initial load of page
$(document).ready(adjustFooter);