2011-12-21 Vanessa Gil <vanessa.gil@artica.es>
* godmode/netflow/nf_manage.php godmode/netflow/nf_edit.php include/functions_netflow.php: changed netflow setup. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5302 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
05358082d8
commit
b755a39527
|
@ -90,7 +90,7 @@ $filter['limit'] = (int) $config['block_size'];
|
||||||
$filters = db_get_all_rows_filter ('tnetflow_filter', $filter);
|
$filters = db_get_all_rows_filter ('tnetflow_filter', $filter);
|
||||||
|
|
||||||
if ($filters === false)
|
if ($filters === false)
|
||||||
$filter = array ();
|
$filters = array ();
|
||||||
|
|
||||||
$table->width = '70%';
|
$table->width = '70%';
|
||||||
$table->head = array ();
|
$table->head = array ();
|
||||||
|
|
|
@ -17,163 +17,66 @@
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
//include_once("include/functions_graph.php");
|
||||||
include_once("include/functions_ui.php");
|
include_once("include/functions_ui.php");
|
||||||
include_once("include/functions_db.php");
|
//ui_require_javascript_file ('calendar');
|
||||||
include_once("include/functions_netflow.php");
|
|
||||||
include_once("include/functions_html.php");
|
|
||||||
|
|
||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
if (! check_acl ($config["id_user"], 0, "IW")) {
|
if (! check_acl ($config["id_user"], 0, "IR")) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access event viewer");
|
"Trying to access event viewer");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
$buttons ['view']= '<a href="index.php?sec=netf&sec2=operation/netflow/nf&id_name='.$name.'">'
|
|
||||||
. html_print_image ("images/lupa.png", true, array ("title" => __('View')))
|
|
||||||
. '</a>';
|
|
||||||
|
|
||||||
$buttons['edit'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_edit">'
|
|
||||||
. html_print_image ("images/edit.png", true, array ("title" => __('Filter list')))
|
|
||||||
. '</a>';
|
|
||||||
|
|
||||||
$buttons['add'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_edit_form">'
|
|
||||||
. html_print_image ("images/add.png", true, array ("title" => __('Add filter')))
|
|
||||||
. '</a>';
|
|
||||||
|
|
||||||
*/
|
|
||||||
//Header
|
//Header
|
||||||
ui_print_page_header (__('Netflow Manager'), "images/networkmap/so_cisco_new.png", false, "", true, $buttons);
|
ui_print_page_header (__('Netflow Manager'), "images/networkmap/so_cisco_new.png", false, "", true);
|
||||||
|
|
||||||
$delete = (bool) get_parameter ('delete');
|
$update = (bool) get_parameter ("update");
|
||||||
$multiple_delete = (bool)get_parameter('multiple_delete', 0);
|
|
||||||
$id = (int) get_parameter ('id');
|
|
||||||
|
|
||||||
if ($delete) {
|
if ($update) {
|
||||||
$result = db_process_sql_delete ('tnetflow_options',
|
|
||||||
array ('id_option' => $id));
|
$config['netflow_path'] = (string)get_parameter('netflow_path');
|
||||||
|
|
||||||
if ($result !== false) $result = true;
|
if (db_get_value('token', 'tconfig', 'token', 'netflow_path') === false) {
|
||||||
else $result = false;
|
config_create_value('netflow_path', $config['netflow_path']);
|
||||||
|
} else {
|
||||||
ui_print_result_message ($result,
|
db_process_sql_update ('tconfig',
|
||||||
__('Successfully deleted'),
|
array ('value' => $config['netflow_path']),
|
||||||
__('Not deleted. Error deleting data'));
|
array ('token' => 'netflow_path'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$table->width = '70%';
|
||||||
|
$table->border = 0;
|
||||||
|
$table->cellspacing = 3;
|
||||||
|
$table->cellpadding = 5;
|
||||||
|
$table->class = "databox_color";
|
||||||
|
$table->style[0] = 'vertical-align: top;';
|
||||||
|
|
||||||
if ($multiple_delete) {
|
|
||||||
$ids = (array)get_parameter('delete_multiple', array());
|
|
||||||
|
|
||||||
db_process_sql_begin();
|
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
|
||||||
$result = db_process_sql_delete ('tnetflow_options',
|
|
||||||
array ('id_option' => $id));
|
|
||||||
|
|
||||||
if ($result === false) {
|
|
||||||
db_process_sql_rollback();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result !== false) {
|
|
||||||
db_process_sql_commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result !== false) $result = true;
|
|
||||||
else $result = false;
|
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
|
||||||
__('Successfully deleted'),
|
|
||||||
__('Not deleted. Error deleting data'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$filter = array ();
|
|
||||||
|
|
||||||
$filter['offset'] = (int) get_parameter ('offset');
|
|
||||||
$filter['limit'] = (int) $config['block_size'];
|
|
||||||
|
|
||||||
$options = db_get_all_rows_filter ('tnetflow_options', $filter);
|
|
||||||
|
|
||||||
if ($options === false)
|
|
||||||
$filter = array ();
|
|
||||||
|
|
||||||
$table->width = '80%';
|
|
||||||
$table->head = array ();
|
|
||||||
$table->head[0] = __('Options name');
|
|
||||||
$table->head[1] = __('Description');
|
|
||||||
$table->head[2] = __('Action') .
|
|
||||||
html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();');
|
|
||||||
|
|
||||||
$table->style = array ();
|
|
||||||
$table->style[0] = 'font-weight: bold';
|
|
||||||
$table->align = array ();
|
|
||||||
$table->align[2] = 'center';
|
|
||||||
$table->size = array ();
|
|
||||||
$table->size[0] = '50%';
|
|
||||||
$table->size[1] = '40%';
|
|
||||||
$table->size[2] = '50px';
|
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
|
|
||||||
$total_options = db_get_all_rows_filter ('tnetflow_options', false, 'COUNT(*) AS total');
|
|
||||||
$total_options = $total_options[0]['total'];
|
|
||||||
|
|
||||||
ui_pagination ($total_options, $url);
|
|
||||||
|
|
||||||
foreach ($options as $option) {
|
|
||||||
|
|
||||||
$data = array ();
|
|
||||||
|
|
||||||
|
$table->data[0][0] = '<b>'.__('Path').'</b>'. ui_print_help_tip (__("Read input from a sequence of files in the same directory."), true);
|
||||||
$data[0] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_option_form&id='.$option['id_option'].'">'.$option['id_name'].'</a>';
|
$table->data[0][1] = html_print_input_text ('netflow_path', $config['netflow_path'], false, 50, 200, true);
|
||||||
|
|
||||||
$data[1] = $option['description'];
|
echo '<form id="netflow_setup" method="post">';
|
||||||
|
|
||||||
|
html_print_table ($table);
|
||||||
|
|
||||||
|
// Update button
|
||||||
|
echo '<div class="action-buttons" style="width:70%;">';
|
||||||
|
html_print_input_hidden ('update', 1);
|
||||||
|
html_print_submit_button (__('Update'), 'upd_button', false, 'class="sub upd"');
|
||||||
|
echo '</div></form>';
|
||||||
|
|
||||||
$data[2] = "<a onclick='if(confirm(\"" . __('Are you sure?') . "\")) return true; else return false;'
|
|
||||||
href='index.php?sec=netf&sec2=godmode/netflow/nf_manage&delete=1&id=".$option['id_option']."&offset=0'>" .
|
|
||||||
html_print_image('images/cross.png', true, array('title' => __('Delete'))) . "</a>" .
|
|
||||||
html_print_checkbox_extended ('delete_multiple[]', $option['id_option'], false, false, '', 'class="check_delete"', true);
|
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($data)) {
|
|
||||||
echo "<form method='post' action='index.php?sec=netf&sec2=godmode/netflow/nf_manage'>";
|
|
||||||
html_print_input_hidden('multiple_delete', 1);
|
|
||||||
html_print_table ($table);
|
|
||||||
echo "<div style='padding-bottom: 20px; text-align: right; width:" . $table->width . "'>";
|
|
||||||
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
|
||||||
echo "</div>";
|
|
||||||
echo "</form>";
|
|
||||||
}else {
|
|
||||||
echo "<div class='nf'>".__('There are no defined filters')."</div>";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<form method="post" action="index.php?sec=netf&sec2=godmode/netflow/nf_option_form">';
|
|
||||||
echo "<div style='padding-bottom: 20px; text-align: right; width:" . $table->width . "'>";
|
|
||||||
html_print_submit_button (__('Create option'), 'crt', false, 'class="sub wand"');
|
|
||||||
echo "</div>";
|
|
||||||
echo "</form>";
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
$("textarea").TextAreaResizer ();
|
$("textarea").TextAreaResizer ();
|
||||||
});
|
});
|
||||||
|
|
||||||
function check_all_checkboxes() {
|
|
||||||
if ($("input[name=all_delete]").attr('checked')) {
|
|
||||||
$(".check_delete").attr('checked', true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(".check_delete").attr('checked', false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -19,8 +19,8 @@ global $config;
|
||||||
|
|
||||||
include_once("include/functions_ui.php");
|
include_once("include/functions_ui.php");
|
||||||
include_once("include/functions_netflow.php");
|
include_once("include/functions_netflow.php");
|
||||||
include_once ("/include/functions_users.php");
|
include_once ("include/functions_users.php");
|
||||||
include_once ("/include/functions_groups.php");
|
include_once ("include/functions_groups.php");
|
||||||
|
|
||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
|
|
|
@ -2029,7 +2029,12 @@ echo"<h4>Gráfica de área</h4>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$color = array();
|
$color = array();
|
||||||
$flash_chart = '';
|
|
||||||
|
$flash_chart = $config['flash_charts'];
|
||||||
|
if ($only_image) {
|
||||||
|
$flash_chart = false;
|
||||||
|
}
|
||||||
|
|
||||||
return area_graph($flash_chart, $chart, $width, $height, $color, $aggs,
|
return area_graph($flash_chart, $chart, $width, $height, $color, $aggs,
|
||||||
$long_index, "images/image_problem.opaque.png", "", "", $homeurl,
|
$long_index, "images/image_problem.opaque.png", "", "", $homeurl,
|
||||||
$config['homedir'] . "/images/logo_vertical_water.png",
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
|
@ -2193,35 +2198,6 @@ function grafico_netflow_aggregate_pie ($data) {
|
||||||
$config['fontpath'], $config['font_size']);
|
$config['fontpath'], $config['font_size']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Print a pie graph with netflow total
|
|
||||||
*/
|
|
||||||
|
|
||||||
function grafico_netflow_total_pie ($data) {
|
|
||||||
global $config;
|
|
||||||
global $graphic_type;
|
|
||||||
echo"<h4>Gráfica totalizada</h4>";
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
$agg = '';
|
|
||||||
$values = array();
|
|
||||||
while (isset ($data[$i])) {
|
|
||||||
$agg = $data[$i]['agg'];
|
|
||||||
if ($data[$i]['unit'] == 'G') {
|
|
||||||
$data[$i]['data'] = $data[$i]['data'] * 1024;
|
|
||||||
}
|
|
||||||
if (isset($values[$agg])){
|
|
||||||
$values[$agg] = $data[$i]['data'];
|
|
||||||
} else {
|
|
||||||
$values[$agg] += $data[$i]['data'];
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
return pie3d_graph($config['flash_charts'], $values, 320, 200,
|
|
||||||
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
|
|
||||||
$config['fontpath'], $config['font_size']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw a graph of Module string data of agent
|
* Draw a graph of Module string data of agent
|
||||||
|
|
|
@ -249,7 +249,29 @@ function netflow_show_table_values($data, $date_limit, $date_time){
|
||||||
|
|
||||||
$coordx = array();
|
$coordx = array();
|
||||||
$coordy = array();
|
$coordy = array();
|
||||||
|
//añadido
|
||||||
|
/*
|
||||||
|
$max_values = 10;
|
||||||
|
|
||||||
|
if(count($data) > $max_values) {
|
||||||
|
$chart_data_trunc = array();
|
||||||
|
$n = 1;
|
||||||
|
foreach($chart_data as $key => $value) {
|
||||||
|
if($n < $max_values) {
|
||||||
|
$chart_data_trunc[$key] = $value;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!isset($chart_data_trunc[$others_str])) {
|
||||||
|
$chart_data_trunc[$others_str] = 0;
|
||||||
|
}
|
||||||
|
$chart_data_trunc[$others_str] += $value;
|
||||||
|
}
|
||||||
|
$n++;
|
||||||
|
}
|
||||||
|
$chart_data = $chart_data_trunc;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//fin añadido
|
||||||
while (isset ($data[$j])) {
|
while (isset ($data[$j])) {
|
||||||
$date = $data[$j]['date'];
|
$date = $data[$j]['date'];
|
||||||
$time = $data[$j]['time'];
|
$time = $data[$j]['time'];
|
||||||
|
|
|
@ -21,7 +21,7 @@ if (function_exists ('mb_internal_encoding')) {
|
||||||
|
|
||||||
// Set to 1 to do not check for installer or config file (for development!).
|
// Set to 1 to do not check for installer or config file (for development!).
|
||||||
// Activate gives more error information, not useful for production sites
|
// Activate gives more error information, not useful for production sites
|
||||||
$develop_bypass = 0;
|
$develop_bypass = 1;
|
||||||
|
|
||||||
if ($develop_bypass != 1) {
|
if ($develop_bypass != 1) {
|
||||||
// If no config file, automatically try to install
|
// If no config file, automatically try to install
|
||||||
|
|
Loading…
Reference in New Issue