2013-03-26 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_tags.php, include/functions_reporting.php,
	include/constants.php, include/functions_ui.php,
	operation/agentes/estado_agente.php,
	operation/agentes/status_monitor.php, mobile/include/style/main.css:
	some cleans and remove unuseless code.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7890 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-03-26 17:15:49 +00:00
parent 5782bce170
commit 1729eee3d7
8 changed files with 135 additions and 89 deletions

View File

@ -1,3 +1,11 @@
2013-03-26 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_tags.php, include/functions_reporting.php,
include/constants.php, include/functions_ui.php,
operation/agentes/estado_agente.php,
operation/agentes/status_monitor.php, mobile/include/style/main.css:
some cleans and remove unuseless code.
2013-03-25 Hirofumi Kosaka <kosaka@rworks.jp> 2013-03-25 Hirofumi Kosaka <kosaka@rworks.jp>
* pandora_console_install: Fixed false recognition of RHEL6.4 * pandora_console_install: Fixed false recognition of RHEL6.4

View File

@ -139,6 +139,7 @@ define('AGENT_MODULE_STATUS_CRITICAL_BAD', 1);
define('AGENT_MODULE_STATUS_CRITICAL_ALERT', 100); define('AGENT_MODULE_STATUS_CRITICAL_ALERT', 100);
define('AGENT_MODULE_STATUS_NO_DATA', 4); define('AGENT_MODULE_STATUS_NO_DATA', 4);
define('AGENT_MODULE_STATUS_NORMAL', 0); define('AGENT_MODULE_STATUS_NORMAL', 0);
define('AGENT_MODULE_STATUS_NOT_NORMAL', 6);
define('AGENT_MODULE_STATUS_WARNING', 2); define('AGENT_MODULE_STATUS_WARNING', 2);
define('AGENT_MODULE_STATUS_UNKNOW', 3); define('AGENT_MODULE_STATUS_UNKNOW', 3);
define('AGENT_MODULE_STATUS_NOT_INIT', 5); define('AGENT_MODULE_STATUS_NOT_INIT', 5);

View File

@ -867,20 +867,20 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
function reporting_get_stats_servers($tiny = true) { function reporting_get_stats_servers($tiny = true) {
$server_performance = servers_get_performance(); $server_performance = servers_get_performance();
// Alerts table // Alerts table
$table_srv = html_get_predefined_table(); $table_srv = html_get_predefined_table();
$table_srv->style[0] = $table_srv->style[2] = 'text-align: right; padding: 5px;'; $table_srv->style[0] = $table_srv->style[2] = 'text-align: right; padding: 5px;';
$table_srv->style[1] = $table_srv->style[3] = 'text-align: left; padding: 5px;'; $table_srv->style[1] = $table_srv->style[3] = 'text-align: left; padding: 5px;';
$tdata = array(); $tdata = array();
$tdata[0] = html_print_image('images/brick.png', true, array('title' => __('Total running modules'), 'width' => '20px')); $tdata[0] = html_print_image('images/brick.png', true, array('title' => __('Total running modules'), 'width' => '20px'));
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_modules"]) . '</span>'; $tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["total_modules_rate"], 2) . '</span>'; $tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["total_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>'; $tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
$table_srv->rowclass[] = ''; $table_srv->rowclass[] = '';
$table_srv->data[] = $tdata; $table_srv->data[] = $tdata;
@ -893,81 +893,81 @@ function reporting_get_stats_servers($tiny = true) {
$tdata = array(); $tdata = array();
$tdata[0] = html_print_image('images/data.png', true, array('title' => __('Local modules'), 'width' => '20px')); $tdata[0] = html_print_image('images/data.png', true, array('title' => __('Local modules'), 'width' => '20px'));
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_local_modules"]) . '</span>'; $tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_local_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["local_modules_rate"], 2) . '</span>'; $tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["local_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>'; $tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
$table_srv->rowclass[] = ''; $table_srv->rowclass[] = '';
$table_srv->data[] = $tdata; $table_srv->data[] = $tdata;
if($tiny) { if ($tiny) {
$tdata = array(); $tdata = array();
$tdata[0] = html_print_image('images/network.png', true, array('title' => __('Remote modules'), 'width' => '20px')); $tdata[0] = html_print_image('images/network.png', true, array('title' => __('Remote modules'), 'width' => '20px'));
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_remote_modules"]) . '</span>'; $tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_remote_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["remote_modules_rate"], 2) . '</span>'; $tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["remote_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>'; $tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
$table_srv->rowclass[] = ''; $table_srv->rowclass[] = '';
$table_srv->data[] = $tdata; $table_srv->data[] = $tdata;
} }
else { else {
if(isset($server_performance ["total_network_modules"])) { if (isset($server_performance ["total_network_modules"])) {
$tdata = array(); $tdata = array();
$tdata[0] = html_print_image('images/network.png', true, array('title' => __('Network modules'), 'width' => '20px')); $tdata[0] = html_print_image('images/network.png', true, array('title' => __('Network modules'), 'width' => '20px'));
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_network_modules"]) . '</span>'; $tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_network_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["network_modules_rate"], 2) . '</span>'; $tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["network_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>'; $tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
$table_srv->rowclass[] = ''; $table_srv->rowclass[] = '';
$table_srv->data[] = $tdata; $table_srv->data[] = $tdata;
} }
if(isset($server_performance ["total_plugin_modules"])) { if (isset($server_performance ["total_plugin_modules"])) {
$tdata = array(); $tdata = array();
$tdata[0] = html_print_image('images/plugin.png', true, array('title' => __('Plugin modules'), 'width' => '20px')); $tdata[0] = html_print_image('images/plugin.png', true, array('title' => __('Plugin modules'), 'width' => '20px'));
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_plugin_modules"]) . '</span>'; $tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_plugin_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["plugin_modules_rate"], 2) . '</span>'; $tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["plugin_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>'; $tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
$table_srv->rowclass[] = ''; $table_srv->rowclass[] = '';
$table_srv->data[] = $tdata; $table_srv->data[] = $tdata;
} }
if(isset($server_performance ["total_prediction_modules"])) { if (isset($server_performance ["total_prediction_modules"])) {
$tdata = array(); $tdata = array();
$tdata[0] = html_print_image('images/chart_bar.png', true, array('title' => __('Prediction modules'), 'width' => '20px')); $tdata[0] = html_print_image('images/chart_bar.png', true, array('title' => __('Prediction modules'), 'width' => '20px'));
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_prediction_modules"]) . '</span>'; $tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_prediction_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["prediction_modules_rate"], 2) . '</span>'; $tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["prediction_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>'; $tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
$table_srv->rowclass[] = ''; $table_srv->rowclass[] = '';
$table_srv->data[] = $tdata; $table_srv->data[] = $tdata;
} }
if(isset($server_performance ["total_wmi_modules"])) { if (isset($server_performance ["total_wmi_modules"])) {
$tdata = array(); $tdata = array();
$tdata[0] = html_print_image('images/wmi.png', true, array('title' => __('WMI modules'), 'width' => '20px')); $tdata[0] = html_print_image('images/wmi.png', true, array('title' => __('WMI modules'), 'width' => '20px'));
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_wmi_modules"]) . '</span>'; $tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_wmi_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["wmi_modules_rate"], 2) . '</span>'; $tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["wmi_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>'; $tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
$table_srv->rowclass[] = ''; $table_srv->rowclass[] = '';
$table_srv->data[] = $tdata; $table_srv->data[] = $tdata;
} }
if(isset($server_performance ["total_web_modules"])) { if (isset($server_performance ["total_web_modules"])) {
$tdata = array(); $tdata = array();
$tdata[0] = html_print_image('images/world.png', true, array('title' => __('Web modules'), 'width' => '20px')); $tdata[0] = html_print_image('images/world.png', true, array('title' => __('Web modules'), 'width' => '20px'));
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_web_modules"]) . '</span>'; $tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_web_modules"]) . '</span>';
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["web_modules_rate"], 2) . '</span>'; $tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["web_modules_rate"], 2) . '</span>';
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>'; $tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
$table_srv->rowclass[] = ''; $table_srv->rowclass[] = '';
$table_srv->data[] = $tdata; $table_srv->data[] = $tdata;
} }
@ -979,7 +979,7 @@ function reporting_get_stats_servers($tiny = true) {
__('Server performance') . __('Server performance') .
'</legend>' . '</legend>' .
html_print_table($table_srv, true) . '</fieldset>'; html_print_table($table_srv, true) . '</fieldset>';
return $output; return $output;
} }
@ -1046,7 +1046,7 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
__('Monitors by status') . __('Monitors by status') .
'</legend>' . '</legend>' .
html_print_table($table_mbs, true) . '</fieldset>'; html_print_table($table_mbs, true) . '</fieldset>';
return $output; return $output;
} }
@ -1092,7 +1092,7 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) {
__('Summary') . __('Summary') .
'</legend>' . '</legend>' .
html_print_table($table_sum, true) . '</fieldset>'; html_print_table($table_sum, true) . '</fieldset>';
return $output; return $output;
} }
@ -1106,12 +1106,12 @@ function reporting_get_stats_alerts($data) {
// Alerts table // Alerts table
$table_al = html_get_predefined_table(); $table_al = html_get_predefined_table();
$tdata = array(); $tdata = array();
$tdata[0] = html_print_image('images/bell.png', true, array('title' => __('Defined alerts'), 'width' => '20px')); $tdata[0] = html_print_image('images/bell.png', true, array('title' => __('Defined alerts'), 'width' => '20px'));
$tdata[1] = $data["monitor_alerts"] <= 0 ? '-' : $data["monitor_alerts"]; $tdata[1] = $data["monitor_alerts"] <= 0 ? '-' : $data["monitor_alerts"];
$tdata[1] = '<a style="color: ' . COL_NORMAL . ';" class="big_data" href="' . $urls["monitor_alerts"] . '">' . $tdata[1] . '</a>'; $tdata[1] = '<a style="color: ' . COL_NORMAL . ';" class="big_data" href="' . $urls["monitor_alerts"] . '">' . $tdata[1] . '</a>';
$tdata[2] = html_print_image('images/bell_error.png', true, array('title' => __('Fired alerts'), 'width' => '20px')); $tdata[2] = html_print_image('images/bell_error.png', true, array('title' => __('Fired alerts'), 'width' => '20px'));
$tdata[3] = $data["monitor_alerts_fired"] <= 0 ? '-' : $data["monitor_alerts_fired"]; $tdata[3] = $data["monitor_alerts_fired"] <= 0 ? '-' : $data["monitor_alerts_fired"];
$tdata[3] = '<a style="color: ' . COL_ALERTFIRED . ';" class="big_data" href="' . $urls["monitor_alerts_fired"] . '">' . $tdata[3] . '</a>'; $tdata[3] = '<a style="color: ' . COL_ALERTFIRED . ';" class="big_data" href="' . $urls["monitor_alerts_fired"] . '">' . $tdata[3] . '</a>';
@ -1123,7 +1123,7 @@ function reporting_get_stats_alerts($data) {
__('Defined and fired alerts') . __('Defined and fired alerts') .
'</legend>' . '</legend>' .
html_print_table($table_al, true) . '</fieldset>'; html_print_table($table_al, true) . '</fieldset>';
return $output; return $output;
} }
@ -1156,7 +1156,7 @@ function reporting_get_stats_users($data) {
__('Users') . __('Users') .
'</legend>' . '</legend>' .
html_print_table($table_us, true) . '</fieldset>'; html_print_table($table_us, true) . '</fieldset>';
return $output; return $output;
} }
@ -1187,7 +1187,7 @@ function reporting_get_stats_agents_monitors($data) {
__('Total agents and monitors') . __('Total agents and monitors') .
'</legend>' . '</legend>' .
html_print_table($table_am, true) . '</fieldset>'; html_print_table($table_am, true) . '</fieldset>';
return $output; return $output;
} }

View File

@ -648,7 +648,7 @@ function tags_get_tags_formatted ($tags_array, $get_url = true) {
function tags_get_acl_tags($id_user, $id_group, $access = 'AR', $return_mode = 'module_condition', $query_prefix = '', $query_table = '') { function tags_get_acl_tags($id_user, $id_group, $access = 'AR', $return_mode = 'module_condition', $query_prefix = '', $query_table = '') {
global $config; global $config;
if($id_user == false) { if ($id_user == false) {
$id_user = $config['id_user']; $id_user = $config['id_user'];
} }

View File

@ -627,7 +627,14 @@ function ui_print_agent_name ($id_agent, $return = false, $cutoff = 'agent_mediu
if ($cutname) { if ($cutname) {
$agent_name = ui_print_truncate_text($agent_name, $cutoff, true, true, true, '[&hellip;]', $style); $agent_name = ui_print_truncate_text($agent_name, $cutoff, true, true, true, '[&hellip;]', $style);
} }
$output = '<a style="' . $style . '" href="'.$server_url.'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.$extra_params.'" title="'.$agent_name_full.'"><b><span style="'.$style.'">'.$agent_name.'</span></b></a>';
$url = $server_url . 'index.php?sec=estado&amp;'.
'sec2=operation/agentes/ver_agente&amp;' .
'id_agente=' . $id_agent.$extra_params;
$output = '<a style="' . $style . '"' .
' href="' . $url . '"' .
' title="'.$agent_name_full.'"><b><span style="'.$style.'">'.$agent_name.'</span></b></a>';
//TODO: Add a pretty javascript (using jQuery) popup-box with agent details //TODO: Add a pretty javascript (using jQuery) popup-box with agent details

View File

@ -93,32 +93,49 @@ tr.group_view_data, .group_view_data {
/*INIT----------Events styles-----------------------------------------*/ /*INIT----------Events styles-----------------------------------------*/
.datos_green, .datos_greenf9, .datos_green a, .datos_greenf9 a { .datos_green, .datos_greenf9, .datos_green a, .datos_greenf9 a {
background-color: #52A000; background-color: #52A000;
color: #FFFFFF; color: #FFFFFF !important;
text-shadow: none !important;
} }
.datos_red, .datos_redf9, .datos_red a, .datos_redf9 a { .datos_red, .datos_redf9, .datos_red a, .datos_redf9 a {
background-color: #FF3E41; background-color: #FF3E41;
color: #FFFFFF !important; color: #FFFFFF !important;
text-shadow: none !important;
} }
.datos_yellow, .datos_yellowf9 {
.datos_yellow, .datos_yellowf9, .datos_yellow a, .datos_yellowf9 a {
background-color: #F5E535; background-color: #F5E535;
color: #000000; color: #000000 !important;
text-shadow: none !important;
} }
a.datos_blue, .datos_bluef9, .datos_blue { .datos_blue, .datos_bluef9, .datos_blue a, .datos_bluef9 a {
background-color: #77E2F2; background-color: #77E2F2;
color: #000000; color: #000000 !important;
text-shadow: none !important;
} }
.datos_grey, .datos_greyf9 { .datos_grey, .datos_greyf9, .datos_grey a, .datos_greyf9 a {
background-color: #E4E4E4; background-color: #E4E4E4;
color: #000000 !important;
text-shadow: none !important;
} }
.datos_pink, .datos_pinkf9 { .datos_pink, .datos_pinkf9, .datos_pink a, .datos_pinkf9 a {
background-color: #FF92E9; background-color: #FF92E9;
color: #000000 !important;
text-shadow: none !important;
} }
.datos_brown, .datos_brownf9 { .datos_brown, .datos_brownf9, .datos_brown a, .datos_brownf9 a {
background-color: #C97A4A; background-color: #C97A4A;
color: #000000 !important;
text-shadow: none !important;
} }
tr.events { tr.events {
border-bottom: 3px solid white !important; border-bottom: 3px solid white !important;
font-size: 12px !important;
}
table#list_events th {
font-size: 12px !important;
font-weight: bolder !important;
} }
/*END-----------Events styles-----------------------------------------*/ /*END-----------Events styles-----------------------------------------*/

View File

@ -109,11 +109,6 @@ if (is_ajax ()) {
} }
ob_end_clean(); ob_end_clean();
$first = true;
while ($row = db_get_all_row_by_steps_sql($first, $result, "SELECT * FROM tgrupo")) {
$first = false;
}
// Take some parameters (GET) // Take some parameters (GET)
$group_id = (int) get_parameter ("group_id", 0); $group_id = (int) get_parameter ("group_id", 0);
$search = trim(get_parameter ("search", "")); $search = trim(get_parameter ("search", ""));
@ -204,7 +199,7 @@ echo '</td>';
echo '</tr></table>'; echo '</tr></table>';
if ($search != ""){ if ($search != "") {
$filter = array ("string" => '%' . $search . '%'); $filter = array ("string" => '%' . $search . '%');
} }
else { else {
@ -232,11 +227,13 @@ switch ($sortField) {
switch ($sort) { switch ($sort) {
case 'up': case 'up':
$selectNameUp = $selected; $selectNameUp = $selected;
$order = array('field' => 'nombre COLLATE utf8_general_ci', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); $order = array('field' => 'nombre COLLATE utf8_general_ci',
'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break; break;
case 'down': case 'down':
$selectNameDown = $selected; $selectNameDown = $selected;
$order = array('field' => 'nombre COLLATE utf8_general_ci', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC'); $order = array('field' => 'nombre COLLATE utf8_general_ci',
'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
break; break;
} }
break; break;
@ -244,11 +241,13 @@ switch ($sortField) {
switch ($sort) { switch ($sort) {
case 'up': case 'up':
$selectOsUp = $selected; $selectOsUp = $selected;
$order = array('field' => 'id_os', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); $order = array('field' => 'id_os',
'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break; break;
case 'down': case 'down':
$selectOsDown = $selected; $selectOsDown = $selected;
$order = array('field' => 'id_os', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC'); $order = array('field' => 'id_os',
'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
break; break;
} }
break; break;
@ -256,11 +255,13 @@ switch ($sortField) {
switch ($sort) { switch ($sort) {
case 'up': case 'up':
$selectIntervalUp = $selected; $selectIntervalUp = $selected;
$order = array('field' => 'intervalo', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); $order = array('field' => 'intervalo',
'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break; break;
case 'down': case 'down':
$selectIntervalDown = $selected; $selectIntervalDown = $selected;
$order = array('field' => 'intervalo', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC'); $order = array('field' => 'intervalo',
'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
break; break;
} }
break; break;
@ -268,11 +269,13 @@ switch ($sortField) {
switch ($sort) { switch ($sort) {
case 'up': case 'up':
$selectGroupUp = $selected; $selectGroupUp = $selected;
$order = array('field' => 'id_grupo', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); $order = array('field' => 'id_grupo',
'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break; break;
case 'down': case 'down':
$selectGroupDown = $selected; $selectGroupDown = $selected;
$order = array('field' => 'id_grupo', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC'); $order = array('field' => 'id_grupo',
'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
break; break;
} }
break; break;
@ -280,11 +283,13 @@ switch ($sortField) {
switch ($sort) { switch ($sort) {
case 'up': case 'up':
$selectLastContactUp = $selected; $selectLastContactUp = $selected;
$order = array('field' => 'ultimo_contacto', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC'); $order = array('field' => 'ultimo_contacto',
'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'DESC');
break; break;
case 'down': case 'down':
$selectLastContactDown = $selected; $selectLastContactDown = $selected;
$order = array('field' => 'ultimo_contacto', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); $order = array('field' => 'ultimo_contacto',
'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC');
break; break;
} }
break; break;
@ -299,7 +304,9 @@ switch ($sortField) {
$selectGroupDown = ''; $selectGroupDown = '';
$selectLastContactUp = ''; $selectLastContactUp = '';
$selectLastContactDown = ''; $selectLastContactDown = '';
$order = array('field' => 'nombre COLLATE utf8_general_ci', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); $order = array('field' => 'nombre COLLATE utf8_general_ci',
'field2' => 'nombre COLLATE utf8_general_ci',
'order' => 'ASC');
break; break;
} }

View File

@ -80,7 +80,7 @@ if (!defined('METACONSOLE')) {
if ($ag_group > 0 && check_acl ($config["id_user"], $ag_group, "AR")) { if ($ag_group > 0 && check_acl ($config["id_user"], $ag_group, "AR")) {
$sql_conditions_group = sprintf (" AND tagente.id_grupo = %d", $ag_group); $sql_conditions_group = sprintf (" AND tagente.id_grupo = %d", $ag_group);
} }
elseif($user_groups != '') { elseif ($user_groups != '') {
// User has explicit permission on group 1 ? // User has explicit permission on group 1 ?
$sql_conditions_group = " AND tagente.id_grupo IN (".$user_groups.")"; $sql_conditions_group = " AND tagente.id_grupo IN (".$user_groups.")";
} }
@ -89,7 +89,7 @@ else {
if ($ag_group != "0" && check_acl ($config["id_user"], $ag_group, "AR")) { if ($ag_group != "0" && check_acl ($config["id_user"], $ag_group, "AR")) {
$sql_conditions_group = sprintf (" AND tagente.id_grupo IN ( SELECT id_grupo FROM tgrupo where nombre = '%s') ", $ag_group); $sql_conditions_group = sprintf (" AND tagente.id_grupo IN ( SELECT id_grupo FROM tgrupo where nombre = '%s') ", $ag_group);
} }
elseif($user_groups != '') { elseif ($user_groups != '') {
// User has explicit permission on group 1 ? // User has explicit permission on group 1 ?
$sql_conditions_group = " AND tagente.id_grupo IN (".$user_groups.")"; $sql_conditions_group = " AND tagente.id_grupo IN (".$user_groups.")";
} }
@ -121,23 +121,23 @@ if ($ag_freestring != "") {
} }
// Status selector // Status selector
if ($status == 0) { //Normal if ($status == AGENT_MODULE_STATUS_NORMAL) { //Normal
$sql_conditions .= " AND tagente_estado.estado = 0 $sql_conditions .= " AND tagente_estado.estado = 0
AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,100))) "; AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,100))) ";
} }
elseif ($status == 2) { //Critical elseif ($status == AGENT_MODULE_STATUS_CRITICAL_BAD) { //Critical
$sql_conditions .= " AND tagente_estado.estado = 1 AND utimestamp > 0"; $sql_conditions .= " AND tagente_estado.estado = 1 AND utimestamp > 0";
} }
elseif ($status == 1) { //Warning elseif ($status == AGENT_MODULE_STATUS_WARNING) { //Warning
$sql_conditions .= " AND tagente_estado.estado = 2 AND utimestamp > 0"; $sql_conditions .= " AND tagente_estado.estado = 2 AND utimestamp > 0";
} }
elseif ($status == 4) { //Not normal elseif ($status == AGENT_MODULE_STATUS_NOT_NORMAL) { //Not normal
$sql_conditions .= " AND tagente_estado.estado <> 0"; $sql_conditions .= " AND tagente_estado.estado <> 0";
} }
elseif ($status == 3) { //Unknown elseif ($status == AGENT_MODULE_STATUS_UNKNOW) { //Unknown
$sql_conditions .= " AND tagente_estado.estado = 3 AND tagente_estado.utimestamp <> 0"; $sql_conditions .= " AND tagente_estado.estado = 3 AND tagente_estado.utimestamp <> 0";
} }
elseif ($status == 5) { //Not init elseif ($status == AGENT_MODULE_STATUS_NOT_INIT) { //Not init
$sql_conditions .= " AND tagente_estado.utimestamp = 0 $sql_conditions .= " AND tagente_estado.utimestamp = 0
AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)"; AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)";
} }
@ -146,16 +146,16 @@ elseif ($status == 5) { //Not init
if ($tag_filter !== 0) { if ($tag_filter !== 0) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
$sql_conditions .= " AND tagente_modulo.id_agente_modulo IN ( $sql_conditions .= " AND tagente_modulo.id_agente_modulo IN (
SELECT ttag_module.id_agente_modulo SELECT ttag_module.id_agente_modulo
FROM ttag_module FROM ttag_module
WHERE ttag_module.id_tag IN (SELECT id_tag FROM ttag where name LIKE '%" . $tag_filter . "%') WHERE ttag_module.id_tag IN (SELECT id_tag FROM ttag where name LIKE '%" . $tag_filter . "%')
)"; )";
} }
else{ else{
$sql_conditions .= " AND tagente_modulo.id_agente_modulo IN ( $sql_conditions .= " AND tagente_modulo.id_agente_modulo IN (
SELECT ttag_module.id_agente_modulo SELECT ttag_module.id_agente_modulo
FROM ttag_module FROM ttag_module
WHERE ttag_module.id_tag = " . $tag_filter . " WHERE ttag_module.id_tag = " . $tag_filter . "
)"; )";
} }
@ -256,7 +256,7 @@ if (defined('METACONSOLE')) {
if ($servers === false) if ($servers === false)
$servers = array(); $servers = array();
$result = array(); $result = array();
foreach($servers as $server) { foreach($servers as $server) {
// If connection was good then retrieve all data server // If connection was good then retrieve all data server
@ -336,12 +336,12 @@ echo '<td>' . __('Monitor status') . "</td>";
echo "<td>"; echo "<td>";
$fields = array (); $fields = array ();
$fields[0] = __('Normal'); $fields[AGENT_MODULE_STATUS_NORMAL] = __('Normal');
$fields[1] = __('Warning'); $fields[AGENT_MODULE_STATUS_WARNING] = __('Warning');
$fields[2] = __('Critical'); $fields[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical');
$fields[3] = __('Unknown'); $fields[AGENT_MODULE_STATUS_UNKNOW] = __('Unknown');
$fields[4] = __('Not normal'); //default $fields[AGENT_MODULE_STATUS_NOT_NORMAL] = __('Not normal'); //default
$fields[5] = __('Not init'); $fields[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init');
html_print_select ($fields, "status", $status, '', __('All'), -1, html_print_select ($fields, "status", $status, '', __('All'), -1,
false, false, true, '', false, 'width: 125px;'); false, false, true, '', false, 'width: 125px;');
@ -554,7 +554,7 @@ switch ($sortField) {
'order' => 'ASC'); 'order' => 'ASC');
break; break;
} }
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$sql = "SELECT $sql = "SELECT
@ -590,8 +590,10 @@ switch ($config["dbtype"]) {
tagente_modulo.critical_instructions, tagente_modulo.critical_instructions,
tagente_modulo.warning_instructions, tagente_modulo.warning_instructions,
tagente_modulo.unknown_instructions, tagente_modulo.unknown_instructions,
tagente_estado.utimestamp AS utimestamp".$sql_from . $sql_conditions_all." ORDER BY " . $order['field'] . " " . $order['order'] tagente_estado.utimestamp AS utimestamp" .
. " LIMIT ".$offset.",".$limit_sql; $sql_from . $sql_conditions_all . "
ORDER BY " . $order['field'] . " " . $order['order'] . "
LIMIT ".$offset.",".$limit_sql;
break; break;
case "postgresql": case "postgresql":
$sql = "SELECT $sql = "SELECT
@ -684,7 +686,9 @@ if (! defined ('METACONSOLE')) {
} }
else { else {
// For each server defined and not disabled: // For each server defined and not disabled:
$servers = db_get_all_rows_sql ("SELECT * FROM tmetaconsole_setup WHERE disabled = 0"); $servers = db_get_all_rows_sql ("SELECT *
FROM tmetaconsole_setup
WHERE disabled = 0");
if ($servers === false) if ($servers === false)
$servers = array(); $servers = array();
@ -986,7 +990,7 @@ foreach ($result as $row) {
$data[7] .= "&nbsp;<a href='index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=".$row["id_agent"]."&amp;tab=data_view&period=86400&amp;id=".$row["id_agente_modulo"]."'>" . html_print_image('images/binary.png', true, array("style" => '0', "alt" => '')) . "</a>"; $data[7] .= "&nbsp;<a href='index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=".$row["id_agent"]."&amp;tab=data_view&period=86400&amp;id=".$row["id_agente_modulo"]."'>" . html_print_image('images/binary.png', true, array("style" => '0', "alt" => '')) . "</a>";
} }
$data[8] = ui_print_module_warn_value($row['max_warning'], $row['min_warning'], $row['str_warning'], $row['max_critical'], $row['min_critical'], $row['str_critical']); $data[8] = ui_print_module_warn_value($row['max_warning'], $row['min_warning'], $row['str_warning'], $row['max_critical'], $row['min_critical'], $row['str_critical']);
if (is_numeric($row["datos"])) { if (is_numeric($row["datos"])) {
@ -1095,12 +1099,13 @@ ui_require_javascript_file('pandora_modules');
if (period == -1) { if (period == -1) {
period = $('#period').val(); period = $('#period').val();
} }
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>", url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
data: "page=include/ajax/module&get_module_detail=1&server_name="+server_name+"&id_agent="+id_agent+"&id_module=" + module_id+"&offset="+offset+"&period="+period, data: "page=include/ajax/module&get_module_detail=1&server_name="+server_name+"&id_agent="+id_agent+"&id_module=" + module_id+"&offset="+offset+"&period="+period,
dataType: "html", dataType: "html",
success: function(data){ success: function(data) {
$("#monitor_details_window").hide () $("#monitor_details_window").hide ()
.empty () .empty ()
.append (data) .append (data)
@ -1116,14 +1121,14 @@ ui_require_javascript_file('pandora_modules');
height: 500 height: 500
}) })
.show (); .show ();
refresh_pagination_callback (module_id, id_agent, server_name);
refresh_pagination_callback (module_id, id_agent, server_name);
} }
}); });
} }
function refresh_pagination_callback (module_id, id_agent, server_name) { function refresh_pagination_callback (module_id, id_agent, server_name) {
$(".pagination").click( function() { $(".pagination").click( function() {
var classes = $(this).attr('class'); var classes = $(this).attr('class');
classes = classes.split(' '); classes = classes.split(' ');
var offset_class = classes[1]; var offset_class = classes[1];
@ -1133,6 +1138,7 @@ ui_require_javascript_file('pandora_modules');
var period = $('#period').val(); var period = $('#period').val();
show_module_detail_dialog(module_id, id_agent, server_name, offset, period); show_module_detail_dialog(module_id, id_agent, server_name, offset, period);
return false; return false;
}); });
} }