2012-09-21 Miguel de Dios <miguel.dedios@artica.es>
* operation/agentes/estado_monitores.php: added the small form to filter the modules/monitors in the agent general view and of course pagination. * include/functions_html.php, operation/events/events.php, operation/events/export_csv.php, operation/events/sound_events.php, operation/events/events_list.php, operation/netflow/nf_live_view.php, operation/tree.php, operation/agentes/ver_agente.php, operation/agentes/stat_win.php: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6993 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
3320cbda4f
commit
829134da29
|
@ -1,3 +1,16 @@
|
|||
2012-09-21 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* operation/agentes/estado_monitores.php: added the small form to
|
||||
filter the modules/monitors in the agent general view and of course
|
||||
pagination.
|
||||
|
||||
* include/functions_html.php, operation/events/events.php,
|
||||
operation/events/export_csv.php, operation/events/sound_events.php,
|
||||
operation/events/events_list.php,
|
||||
operation/netflow/nf_live_view.php, operation/tree.php,
|
||||
operation/agentes/ver_agente.php, operation/agentes/stat_win.php:
|
||||
cleaned source code style.
|
||||
|
||||
2012-09-21 Junichi Satoh <junichi@rworks.jp>
|
||||
|
||||
* include/help/ja/help_macros.php: Added a new help file.
|
||||
|
|
|
@ -155,16 +155,77 @@ switch ($config["dbtype"]) {
|
|||
// TODO: Clean extra_sql
|
||||
$extra_sql = '';
|
||||
|
||||
$status_filter_monitor = (int)get_parameter('status_filter_monitor', -1);
|
||||
$status_text_monitor = get_parameter('status_text_monitor', '');
|
||||
$filter_monitors = (bool)get_parameter('filter_monitors', false);
|
||||
|
||||
$status_filter_sql = '1 = 1';
|
||||
if ($status_filter_monitor != -1) {
|
||||
$status_filter_sql = 'tagente_estado.estado = ' . $status_filter_monitor;
|
||||
}
|
||||
$status_text_monitor_sql = '%';
|
||||
if (!empty($status_text_monitor)) {
|
||||
$status_text_monitor_sql = $status_text_monitor . '%';
|
||||
}
|
||||
|
||||
|
||||
//Count monitors/modules
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$sql = sprintf("
|
||||
SELECT COUNT(*)
|
||||
FROM tagente_estado,
|
||||
(SELECT *
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente = %d AND nombre LIKE \"%s\" AND delete_pending = 0
|
||||
AND disabled = 0) tagente_modulo
|
||||
LEFT JOIN tmodule_group
|
||||
ON tagente_modulo.id_module_group = tmodule_group.id_mg
|
||||
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND %s AND %s tagente_estado.utimestamp != 0
|
||||
ORDER BY tagente_modulo.id_module_group , %s %s",
|
||||
$id_agente, $status_text_monitor_sql, $status_filter_sql, $extra_sql, $order['field'], $order['order']);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ("
|
||||
SELECT COUNT(*)" .
|
||||
" FROM tagente_estado, tagente_modulo
|
||||
LEFT JOIN tmodule_group
|
||||
ON tmodule_group.id_mg = tagente_modulo.id_module_group
|
||||
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.id_agente = %d
|
||||
AND tagente_modulo.nombre LIKE '%s'
|
||||
AND %s
|
||||
AND tagente_modulo.delete_pending = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_estado.utimestamp != 0
|
||||
ORDER BY tagente_modulo.id_module_group , %s %s
|
||||
", $id_agente, $status_text_monitor_sql, $status_filter_sql, $order['field'], $order['order']);
|
||||
break;
|
||||
}
|
||||
$count_modules = db_get_all_rows_sql ($sql);
|
||||
$count_modules = reset($count_modules[0]);
|
||||
|
||||
|
||||
//Get monitors/modules
|
||||
// Get all module from agent
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$sql = sprintf("
|
||||
SELECT * FROM tagente_estado, (SELECT * FROM tagente_modulo WHERE id_agente = %d AND delete_pending = 0 AND disabled = 0) tagente_modulo
|
||||
LEFT JOIN tmodule_group ON tagente_modulo.id_module_group = tmodule_group.id_mg
|
||||
SELECT *
|
||||
FROM tagente_estado,
|
||||
(SELECT *
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente = %d AND nombre LIKE \"%s\" AND delete_pending = 0
|
||||
AND disabled = 0) tagente_modulo
|
||||
LEFT JOIN tmodule_group
|
||||
ON tagente_modulo.id_module_group = tmodule_group.id_mg
|
||||
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND %s tagente_estado.utimestamp != 0
|
||||
ORDER BY tagente_modulo.id_module_group , %s %s", $id_agente, $extra_sql, $order['field'], $order['order']);
|
||||
AND %s AND %s tagente_estado.utimestamp != 0
|
||||
ORDER BY tagente_modulo.id_module_group , %s %s",
|
||||
$id_agente, $status_text_monitor_sql, $status_filter_sql, $extra_sql, $order['field'], $order['order']);
|
||||
break;
|
||||
// If Dbms is Oracle then field_list in sql statement has to be recoded. See oracle_list_all_field_table()
|
||||
case "oracle":
|
||||
|
@ -179,14 +240,19 @@ switch ($config["dbtype"]) {
|
|||
ON tmodule_group.id_mg = tagente_modulo.id_module_group
|
||||
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.id_agente = %d
|
||||
AND tagente_modulo.nombre LIKE '%s'
|
||||
AND %s
|
||||
AND tagente_modulo.delete_pending = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_estado.utimestamp != 0
|
||||
ORDER BY tagente_modulo.id_module_group , %s %s
|
||||
", $id_agente, $order['field'], $order['order']);
|
||||
", $id_agente, $status_text_monitor_sql, $status_filter_sql, $order['field'], $order['order']);
|
||||
break;
|
||||
}
|
||||
$modules = db_get_all_rows_sql ($sql);
|
||||
|
||||
$limit = " LIMIT " . $config['block_size'] . " OFFSET " . get_parameter ('offset',0);
|
||||
|
||||
$modules = db_get_all_rows_sql ($sql . $limit);
|
||||
if (empty ($modules)) {
|
||||
$modules = array ();
|
||||
}
|
||||
|
@ -331,14 +397,34 @@ foreach ($modules as $module) {
|
|||
|
||||
$data[5] = ui_print_status_image($status, $title, true);
|
||||
|
||||
if ($module["id_tipo_modulo"] == 24) { // log4x
|
||||
|
||||
if ($module["id_tipo_modulo"] == 24) {
|
||||
// log4x
|
||||
switch($module["datos"]) {
|
||||
case 10: $salida = "TRACE"; $style="font-weight:bold; color:darkgreen;"; break;
|
||||
case 20: $salida = "DEBUG"; $style="font-weight:bold; color:darkgreen;"; break;
|
||||
case 30: $salida = "INFO"; $style="font-weight:bold; color:darkgreen;"; break;
|
||||
case 40: $salida = "WARN"; $style="font-weight:bold; color:darkorange;"; break;
|
||||
case 50: $salida = "ERROR"; $style="font-weight:bold; color:red;"; break;
|
||||
case 60: $salida = "FATAL"; $style="font-weight:bold; color:red;"; break;
|
||||
case 10:
|
||||
$salida = "TRACE";
|
||||
$style="font-weight:bold; color:darkgreen;";
|
||||
break;
|
||||
case 20:
|
||||
$salida = "DEBUG";
|
||||
$style="font-weight:bold; color:darkgreen;";
|
||||
break;
|
||||
case 30:
|
||||
$salida = "INFO";
|
||||
$style="font-weight:bold; color:darkgreen;";
|
||||
break;
|
||||
case 40:
|
||||
$salida = "WARN";
|
||||
$style="font-weight:bold; color:darkorange;";
|
||||
break;
|
||||
case 50:
|
||||
$salida = "ERROR";
|
||||
$style="font-weight:bold; color:red;";
|
||||
break;
|
||||
case 60:
|
||||
$salida = "FATAL";
|
||||
$style="font-weight:bold; color:red;";
|
||||
break;
|
||||
}
|
||||
$salida = "<span style='$style'>$salida</span>";
|
||||
}
|
||||
|
@ -381,7 +467,6 @@ foreach ($modules as $module) {
|
|||
|
||||
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$module["id_agente_modulo"]."&label=".base64_encode($module["nombre"])."&refresh=600','day_".$win_handle."')";
|
||||
|
||||
// if ($nombre_tipo_modulo != "log4x")
|
||||
$data[8] .= '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a> ';
|
||||
$data[8] .= "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=86400&id=".$module["id_agente_modulo"]."'>" . html_print_image('images/binary.png', true, array("border" => '0', "alt" => "")) . "</a>";
|
||||
}
|
||||
|
@ -411,12 +496,21 @@ function toggle_full_value(id) {
|
|||
</script>
|
||||
<?php
|
||||
|
||||
echo "<h4 style='padding-top:0px !important;'>".__('Full list of monitors')."</h4>";
|
||||
|
||||
print_form_filter_monitors($status_filter_monitor, $status_text_monitor);
|
||||
if (empty ($table->data)) {
|
||||
echo '<div class="nf">'.__('This agent doesn\'t have any active monitors').'</div>';
|
||||
if ($filter_monitors) {
|
||||
echo '<div class="nf">' . __('Any monitors aren\'t with this filter.') . '</div>';
|
||||
}
|
||||
else {
|
||||
echo '<div class="nf">' . __('This agent doesn\'t have any active monitors.') . '</div>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<h4 style='padding-top:0px !important;'>".__('Full list of monitors')."</h4>";
|
||||
ui_pagination ($count_modules);
|
||||
html_print_table ($table);
|
||||
ui_pagination ($count_modules);
|
||||
}
|
||||
|
||||
unset ($table);
|
||||
|
@ -432,9 +526,42 @@ ui_require_jquery_file ('cluetip');
|
|||
arrows: true,
|
||||
attribute: 'href',
|
||||
cluetipClass: 'default'
|
||||
}).click (function () {
|
||||
})
|
||||
.click (function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
/* ]]> */
|
||||
</script>
|
||||
<?php
|
||||
function print_form_filter_monitors($status_filter_monitor = -1,
|
||||
$status_text_monitor = '') {
|
||||
|
||||
$form_text = '<form action="" method="post">';
|
||||
|
||||
$table->data[0][0] = html_print_input_hidden('filter_monitors', 1, true);
|
||||
$table->data[0][0] .= __('Status:');
|
||||
$status_list = array(
|
||||
-1 => __('All'),
|
||||
AGENT_MODULE_STATUS_CRITICAL_BAD => __('Critical'),
|
||||
AGENT_MODULE_STATUS_CRITICAL_ALERT => __('Alert'),
|
||||
AGENT_MODULE_STATUS_NORMAL => __('Normal'),
|
||||
AGENT_MODULE_STATUS_WARNING => __('Warning'),
|
||||
AGENT_MODULE_STATUS_UNKNOW => __('Unknow'));
|
||||
$table->data[0][1] = html_print_select ($status_list,
|
||||
'status_filter_monitor', $status_filter_monitor, '', '', 0,
|
||||
true);
|
||||
$table->data[0][2] = __('Free text for search (*):');
|
||||
$table->data[0][3] = html_print_input_text('status_text_monitor', $status_text_monitor, '', 30, 100, true);
|
||||
$table->data[0][4] = html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search"', true);
|
||||
$table->data[0][4] .= '</form>';
|
||||
$table->data[0][5] = '<form action="" method="post">';
|
||||
$table->data[0][5] .= html_print_submit_button(__('Reset'), 'reset', false, 'class="sub upd"', true);
|
||||
$table->data[0][5] .= '</form>';
|
||||
html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search"', true);
|
||||
$form_text .= html_print_table($table, true);
|
||||
|
||||
$form_text .= '';
|
||||
|
||||
ui_toggle($form_text, __('Form filter'), __('Form filter'));
|
||||
}
|
||||
?>
|
|
@ -367,7 +367,8 @@ if (is_ajax ()) {
|
|||
echo '<strong>'.__('Last contact').':</strong> '.human_time_comparation($agent['ultimo_contacto']).'<br />';
|
||||
echo '<strong>'.__('Last remote contact').':</strong> '.human_time_comparation($agent['ultimo_contacto_remoto']).'<br />';
|
||||
|
||||
$sql = sprintf ('SELECT tagente_modulo.descripcion, tagente_modulo.nombre
|
||||
$sql = sprintf ('SELECT tagente_modulo.descripcion,
|
||||
tagente_modulo.nombre
|
||||
FROM tagente_estado, tagente_modulo
|
||||
WHERE tagente_modulo.id_agente = %d
|
||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
|
@ -445,7 +446,7 @@ if (is_ajax ()) {
|
|||
echo html_print_image("images/" . modules_get_type_icon ($agentmoduletype), true) . '<br />';
|
||||
echo '<strong>'.__('Module group').':</strong> ';
|
||||
$modulegroup = modules_get_modulegroup_name (modules_get_agentmodule_modulegroup ($module['id_agente_modulo']));
|
||||
if($modulegroup === false){
|
||||
if ($modulegroup === false) {
|
||||
echo __('None').'<br />';
|
||||
}
|
||||
else{
|
||||
|
@ -454,7 +455,7 @@ if (is_ajax ()) {
|
|||
echo '<strong>'.__('Agent').':</strong> ';
|
||||
echo ui_print_truncate_text(modules_get_agentmodule_agent_name($module['id_agente_modulo']), 'agent_small', false, true, false).'<br />';
|
||||
|
||||
if($module['id_tipo_modulo'] == 18) {
|
||||
if ($module['id_tipo_modulo'] == 18) {
|
||||
echo '<strong>'.__('Address').':</strong> ';
|
||||
|
||||
// Get the IP/IPs from the module description
|
||||
|
@ -484,14 +485,14 @@ if (is_ajax ()) {
|
|||
echo ui_print_truncate_text($group['nombre'], GENERIC_SIZE_TEXT, false, true, false) . '</h3>';
|
||||
echo '<strong>'.__('Parent').':</strong> ';
|
||||
if ($group['parent'] == 0) {
|
||||
echo __('None').'<br />';
|
||||
echo __('None') . '<br />';
|
||||
}
|
||||
else {
|
||||
$group_parent = db_get_row ('tgrupo', 'id_grupo', $group['parent']);
|
||||
echo html_print_image("images/groups_small/" . groups_get_icon ($group['parent']) . ".png", true);
|
||||
echo $group_parent['nombre'].'<br />';
|
||||
echo $group_parent['nombre'] . '<br />';
|
||||
}
|
||||
echo '<strong>'.__('Sons').':</strong> ';
|
||||
echo '<strong>' . __('Sons') . ':</strong> ';
|
||||
$groups_sons = db_get_all_fields_in_table ('tgrupo', 'parent', $group['id_grupo']);
|
||||
if ($groups_sons === false) {
|
||||
echo __('None').'<br />';
|
||||
|
|
|
@ -82,7 +82,7 @@ if (is_ajax()) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($update_event_filter){
|
||||
if ($update_event_filter) {
|
||||
$values = array();
|
||||
$id = get_parameter('id');
|
||||
$values['id_name'] = get_parameter('id_name');
|
||||
|
@ -100,9 +100,10 @@ if (is_ajax()) {
|
|||
$values['filter_only_alert'] = get_parameter('filter_only_alert');
|
||||
$values['id_group_filter'] = get_parameter('id_group_filter');
|
||||
|
||||
$result = db_process_sql_update('tevent_filter', $values, array('id_filter' => $id));
|
||||
$result = db_process_sql_update('tevent_filter',
|
||||
$values, array('id_filter' => $id));
|
||||
|
||||
if ($result === false){
|
||||
if ($result === false) {
|
||||
echo 'error';
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue