2013-04-12 Sergio Martin <sergio.martin@artica.es>

* include/functions_graph.php: Optimize the event graphs
	queries that appear in tactican and agent view

	* extensions/net_tools.php
	extensions/ssh_gateway.php
	extensions/vnc_view.php: Fixing the network extensions in
	extensions manager



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7969 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2013-04-12 09:27:55 +00:00
parent c6a03b571a
commit 55867796e4
5 changed files with 34 additions and 28 deletions

View File

@ -1,3 +1,13 @@
2013-04-12 Sergio Martin <sergio.martin@artica.es>
* include/functions_graph.php: Optimize the event graphs
queries that appear in tactican and agent view
* extensions/net_tools.php
extensions/ssh_gateway.php
extensions/vnc_view.php: Fixing the network extensions in
extensions manager
2013-04-11 Miguel de Dios <miguel.dedios@artica.es>
* include/graphs/functions_flot.php,

View File

@ -19,7 +19,7 @@ $id_agente = get_parameter ("id_agente");
// This extension is usefull only if the agent has associated IP
$address = agents_get_address($id_agente);
if(!empty($address)) {
if(!empty($address) || empty($id_agente)) {
extensions_add_opemode_tab_agent ('network_tools','Network Tools','extensions/net_tools/nettool.png',"main_net_tools", "v1r1");
}

View File

@ -19,7 +19,7 @@ $id_agente = get_parameter ("id_agente");
// This extension is usefull only if the agent has associated IP
$address = agents_get_address($id_agente);
if(!empty($address)) {
if(!empty($address) || empty($id_agente)) {
extensions_add_opemode_tab_agent ('ssh_gateway','SSH Gateway','extensions/ssh_gateway/secure_console.png',"ssh_gateway", "v1r1");
}

View File

@ -27,7 +27,7 @@ $id_agente = get_parameter ("id_agente");
// This extension is usefull only if the agent has associated IP
$address = agents_get_address($id_agente);
if(!empty($address)) {
if(!empty($address) || empty($id_agente)) {
extensions_add_opemode_tab_agent('vnc_view', __('VNC view'), 'images/vnc.png', 'vnc_view', "v1r1");
}
?>

View File

@ -1439,19 +1439,17 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
case "mysql":
case "postgresql":
$sql = sprintf ('SELECT COUNT(id_evento) AS count_number,
nombre
FROM tevento, tagente_modulo
WHERE id_agentmodule = id_agente_modulo
AND disabled = 0 AND tevento.id_agente = %d
GROUP BY id_agentmodule, nombre ORDER BY count_number DESC LIMIT %d', $id_agent, $max_items);
id_agentmodule
FROM tevento
WHERE tevento.id_agente = %d
GROUP BY id_agentmodule ORDER BY count_number DESC LIMIT %d', $id_agent, $max_items);
break;
case "oracle":
$sql = sprintf ('SELECT COUNT(id_evento) AS count_number,
dbms_lob.substr(nombre,4000,1) AS nombre
FROM tevento, tagente_modulo
WHERE (id_agentmodule = id_agente_modulo
AND disabled = 0 AND tevento.id_agente = %d) AND rownum <= %d
GROUP BY id_agentmodule, dbms_lob.substr(nombre,4000,1) ORDER BY count_number DESC', $id_agent, $max_items);
id_agentmodule
FROM tevento
WHERE tevento.id_agente = %d AND rownum <= %d
GROUP BY id_agentmodule ORDER BY count_number DESC', $id_agent, $max_items);
break;
}
@ -1465,18 +1463,15 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
}
foreach ($events as $event) {
$key = io_safe_output($event['nombre']) .
if($event['id_agentmodule'] == 0) {
$key = __('System') . ' ('.$event['count_number'].')';
}
else {
$key = modules_get_agentmodule_name ($event['id_agentmodule']) .
' ('.$event['count_number'].')';
$data[$key] = $event["count_number"];
}
/* System events */
$sql = "SELECT COUNT(*)
FROM tevento
WHERE id_agentmodule = 0 AND id_agente = $id_agent";
$value = db_get_sql ($sql);
if ($value > 0) {
$data[__('System').' ('.$value.')'] = $value;
$data[$key] = $event["count_number"];
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
@ -2051,11 +2046,11 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente,
id_grupo, COUNT(id_agente) AS count'.$field_extra.'
COUNT(id_agente) AS count'.$field_extra.'
FROM '.$event_table.'
WHERE 1=1 %s %s
GROUP BY id_agente'.$groupby_extra.'
ORDER BY count DESC', $url, $tags_condition);
ORDER BY count DESC LIMIT 8', $url, $tags_condition);
break;
case "postgresql":
case "oracle":
@ -2064,7 +2059,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
FROM '.$event_table.'
WHERE 1=1 %s %s
GROUP BY id_agente, id_grupo'.$groupby_extra.'
ORDER BY count DESC', $url, $tags_condition);
ORDER BY count DESC LIMIT 8', $url, $tags_condition);
break;
}
@ -2077,6 +2072,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
$other_events = 0;
foreach ($result as $row) {
$row["id_grupo"] = agents_get_agent_group ($row["id_agente"]);
if (!check_acl ($config["id_user"], $row["id_grupo"], "ER") == 1)
continue;