From 79806e27cbd1ce701fb088a00283171a63033115 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Thu, 14 Feb 2013 16:44:45 +0000 Subject: [PATCH] 2013-02-14 Ramon Novoa * godmode/setup/setup_netflow.php, include/functions_config.php: Added the deletion of old netflow and log data. * include/functions_snmp_browser.php: Added to repository. SNMP browser specific functions. * operation/menu.php, operation/snmpconsole/snmp_browser.php: Added search capabilities to the SNMP browser and other small improvements. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7656 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 13 + .../godmode/setup/setup_netflow.php | 17 +- pandora_console/include/functions_config.php | 23 +- .../include/functions_snmp_browser.php | 327 ++++++++++++++++++ pandora_console/operation/menu.php | 2 +- .../operation/snmpconsole/snmp_browser.php | 258 +++++++++++++- 6 files changed, 610 insertions(+), 30 deletions(-) create mode 100644 pandora_console/include/functions_snmp_browser.php diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c39728a35b..cd272ea3f0 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,16 @@ +2013-02-14 Ramon Novoa + + * godmode/setup/setup_netflow.php, + include/functions_config.php: Added the deletion of old netflow and + log data. + + * include/functions_snmp_browser.php: Added to repository. SNMP browser + specific functions. + + * operation/menu.php, + operation/snmpconsole/snmp_browser.php: Added search capabilities to + the SNMP browser and other small improvements. + 2013-02-14 Miguel de Dios * include/styles/pandora_legacy.css: cleaned source code. diff --git a/pandora_console/godmode/setup/setup_netflow.php b/pandora_console/godmode/setup/setup_netflow.php index e5b1f2fe75..7398b7254e 100644 --- a/pandora_console/godmode/setup/setup_netflow.php +++ b/pandora_console/godmode/setup/setup_netflow.php @@ -37,7 +37,6 @@ $table->border = 0; $table->cellspacing = 3; $table->cellpadding = 5; $table->class = "databox_color"; -$table->style[0] = 'vertical-align: top;'; $table->data = array (); @@ -49,12 +48,16 @@ $table->data[2][0] = ''.__('Daemon binary path').''; $table->data[2][1] = html_print_input_text ('netflow_daemon', $config['netflow_daemon'], false, 50, 200, true); $table->data[3][0] = ''.__('Nfdump binary path').''; $table->data[3][1] = html_print_input_text ('netflow_nfdump', $config['netflow_nfdump'], false, 50, 200, true); -$table->data[4][0] = ''.__('Maximum chart resolution').'' . ui_print_help_tip (__("Maximum number of points that a netflow area chart will display. The higher the resolution the performance. Values between 50 and 100 are recommended."), true); -$table->data[4][1] = html_print_input_text ('netflow_max_resolution', $config['netflow_max_resolution'], false, 50, 200, true); -$table->data[5][0] = ''.__('Disable custom live view filters').'' . ui_print_help_tip (__("Disable the definition of custom filters in the live view. Only existing filters can be used."), true); -$table->data[5][1] = __('Yes').'   '.html_print_radio_button ('netflow_disable_custom_lvfilters', 1, '', $config["netflow_disable_custom_lvfilters"], true).'  '; -$table->data[5][1] .= __('No').'   '.html_print_radio_button ('netflow_disable_custom_lvfilters', 0, '', $config["netflow_disable_custom_lvfilters"], true).'  '; - +$table->data[4][0] = ''.__('Nfexpire binary path').''; +$table->data[4][1] = html_print_input_text ('netflow_nfexpire', $config['netflow_nfexpire'], false, 50, 200, true); +$table->data[5][0] = ''.__('Maximum chart resolution').'' . ui_print_help_tip (__("Maximum number of points that a netflow area chart will display. The higher the resolution the performance. Values between 50 and 100 are recommended."), true); +$table->data[5][1] = html_print_input_text ('netflow_max_resolution', $config['netflow_max_resolution'], false, 50, 200, true); +$table->data[6][0] = ''.__('Disable custom live view filters').'' . ui_print_help_tip (__("Disable the definition of custom filters in the live view. Only existing filters can be used."), true); +$table->data[6][1] = __('Yes').'   '.html_print_radio_button ('netflow_disable_custom_lvfilters', 1, '', $config["netflow_disable_custom_lvfilters"], true).'  '; +$table->data[6][1] .= __('No').'   '.html_print_radio_button ('netflow_disable_custom_lvfilters', 0, '', $config["netflow_disable_custom_lvfilters"], true).'  '; +$table->data[7][0] = ''.__('Netflow max lifetime').''.ui_print_help_tip (__("Sets the maximum lifetime for netflow data in days."), true); +$table->data[7][1] = html_print_input_text ('netflow_max_lifetime', $config['netflow_max_lifetime'], false, 50, 200, true); + echo '
'; html_print_table ($table); diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 2b2bd15c8e..e102b234a7 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -302,14 +302,17 @@ function config_update_config () { break; case 'net': config_update_value ('netflow_path', get_parameter ('netflow_path')); - config_update_value ('netflow_interval', get_parameter ('netflow_interval')); + config_update_value ('netflow_interval', (int)get_parameter ('netflow_interval')); config_update_value ('netflow_daemon', get_parameter ('netflow_daemon')); config_update_value ('netflow_nfdump', get_parameter ('netflow_nfdump')); - config_update_value ('netflow_max_resolution', get_parameter ('netflow_max_resolution')); + config_update_value ('netflow_nfexpire', get_parameter ('netflow_nfexpire')); + config_update_value ('netflow_max_resolution', (int)get_parameter ('netflow_max_resolution')); config_update_value ('netflow_disable_custom_lvfilters', get_parameter ('netflow_disable_custom_lvfilters')); + config_update_value ('netflow_max_lifetime', (int) get_parameter ('netflow_max_lifetime')); break; case 'log': - config_update_value ('log_dir', (string)get_parameter('log_dir')); + config_update_value ('log_dir', get_parameter('log_dir')); + config_update_value ('log_max_lifetime', (int)get_parameter('log_max_lifetime')); break; } @@ -499,6 +502,10 @@ function config_process_config () { config_update_value ('log_dir', '/var/spool/pandora/data_in/log'); } + if (!isset ($config["log_max_lifetime"])) { + config_update_value ('log_max_lifetime', 15); + } + if (!isset ($config["font_size"])) { config_update_value ('font_size', 6); } @@ -609,7 +616,11 @@ function config_process_config () { if (!isset ($config['netflow_nfdump'])) { config_update_value ( 'netflow_nfdump', '/usr/bin/nfdump'); } - + + if (!isset ($config['netflow_nfexpire'])) { + config_update_value ( 'netflow_nfexpire', '/usr/bin/nfexpire'); + } + if (!isset ($config['netflow_max_resolution'])) { config_update_value ( 'netflow_max_resolution', '50'); } @@ -622,6 +633,10 @@ function config_process_config () { config_update_value ( 'netflow_disable_custom_lvfilters', 0); } + if (!isset ($config['netflow_max_lifetime'])) { + config_update_value ( 'netflow_max_lifetime', '5'); + } + if (!isset ($config['auth'])) { config_update_value ( 'auth', 'mysql'); } diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php new file mode 100644 index 0000000000..a6dd8baf7e --- /dev/null +++ b/pandora_console/include/functions_snmp_browser.php @@ -0,0 +1,327 @@ + id_name)) or filters filtered + * + * @param tree string SNMP tree returned by snmp_broser_get_tree. + * @param id string Level ID. Do not set, used for recursion. + * @param depth string Branch depth. Do not set, used for recursion. + * + */ +function snmp_browser_print_tree ($tree, $id = 0, $depth = 0, $last = 0, $last_array = array()) { + + // Leaf + if (empty ($tree['__LEAVES__'])) { + return; + } + + $count = 0; + $total = sizeof (array_keys ($tree['__LEAVES__'])) - 1; + $last_array[$depth] = $last; + + if ($depth > 0) { + echo "