diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index f23af11d47..9ecbffbf6a 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2011-08-16 Miguel de Dios + + * operation/snmpconsole/snmp_view.php, godmode/menu.php, + godmode/snmpconsole/snmp_trap_generator.php: moved the form to generate + traps into godmode in the submenu "Manage SNMP console". + + Fixes: #3390513 + 2011-08-16 Dario Rodriguez * pandoradb_data.sql: Changed days_compact field of tconfig to 90. diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index e7d61de7e0..c64f1286ec 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -119,6 +119,8 @@ if (check_acl($config['id_user'], 0, "LW")) { $menu["gsnmpconsole"]["id"] = "god-snmpc"; $sub = array (); + + $sub['godmode/snmpconsole/snmp_trap_generator']['text'] = __('SNMP trap generator'); //$sub["godmode/snmpconsole/snmp_alert"]["text"] = __('Component groups'); $sub['godmode/snmpconsole/snmp_filters']['text'] = __('SNMP filters'); enterprise_hook ('snmpconsole_submenu'); diff --git a/pandora_console/godmode/snmpconsole/snmp_trap_generator.php b/pandora_console/godmode/snmpconsole/snmp_trap_generator.php new file mode 100644 index 0000000000..3c824dbb9c --- /dev/null +++ b/pandora_console/godmode/snmpconsole/snmp_trap_generator.php @@ -0,0 +1,87 @@ +'; +$table->width = '90%'; +$table->size = array (); +$table->data = array (); + +$table->data[0][0] = __('Host address'); +$table->data[0][1] = html_print_input_text('snmp_host_address', $snmp_host_address, '', 50, 255, true); + +$table->data[1][0] = __('Community'); +$table->data[1][1] = html_print_input_text('snmp_community', $snmp_community, '', 50, 255, true); + +$table->data[2][0] = __('OID'); +$table->data[2][1] = html_print_input_text('snmp_oid', $snmp_oid, '', 50, 255, true); + +$table->data[3][0] = __('SNMP Agent'); +$table->data[3][1] = html_print_input_text('snmp_agent', $snmp_agent, '', 50, 255, true); + +$table->data[4][0] = __('SNMP Type').' '.ui_print_help_icon ("snmp_trap_types", true); +$table->data[4][1] = html_print_input_text('snmp_type', $snmp_type, '', 50, 255, true); + +$types = array(0 => 'Cold start (0)', 1 => 'Warm start (1)', 2 => 'Link down (2)', 3 => 'Link up (3)', 4 => 'Authentication failure (4)', 5 => 'EGP neighbor loss (5)', 6 => 'Enterprise (6)'); +$table->data[4][1] = html_print_select($types, 'snmp_type', $snmp_type, '', __('Select'), -1, true, false, false); + +$table->data[5][0] = __('Value'); +$table->data[5][1] = html_print_input_text('snmp_value', $snmp_value, '', 50, 255, true); + + +$traps_generator .= html_print_table($table, true); +$traps_generator .= '
'.html_print_submit_button(__('Generate trap'), 'btn_generate_trap', false, 'class="sub cog"', true).'
'; +$traps_generator .= html_print_input_hidden('generate_trap', 1, true); + +unset($table); +$traps_generator .= ''; + +echo $traps_generator; +?> \ No newline at end of file diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php index 525f81b5e7..4070e6b3ae 100644 --- a/pandora_console/operation/snmpconsole/snmp_view.php +++ b/pandora_console/operation/snmpconsole/snmp_view.php @@ -39,13 +39,6 @@ $filter_status = (int) get_parameter ("filter_status", 0); $search_string = (string) get_parameter ("search_string", ''); $pagination = (int) get_parameter ("pagination", $config["block_size"]); $offset = (int) get_parameter ('offset',0); -$snmp_host_address = (string) get_parameter ("snmp_host_address", 'localhost'); -$snmp_community = (string) get_parameter ("snmp_community", 'public'); -$snmp_oid = (string) get_parameter ("snmp_oid", ''); -$snmp_agent = (string) get_parameter ("snmp_agent", ''); -$snmp_value = (string) get_parameter ("snmp_value", ''); -$snmp_type = (int) get_parameter ("snmp_type", 0); -$generate_trap = (bool) get_parameter ("generate_trap", 0); $url = "index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_agent=".$filter_agent."&filter_oid=".$filter_oid."&filter_severity=".$filter_severity."&filter_fired=".$filter_fired."&search_string=".$search_string."&pagination=".$pagination."&offset=".$offset; @@ -127,20 +120,6 @@ if (isset ($_POST["updatebt"])) { } } -if($generate_trap) { - $result = true; - if($snmp_host_address != '' && $snmp_community != '' && $snmp_oid != '' && $snmp_agent != '' && $snmp_value != '' && $snmp_type != -1) { - snmp_generate_trap($snmp_host_address, $snmp_community, $snmp_oid, $snmp_agent, $snmp_value, $snmp_type); - } - else { - $result = false; - } - - ui_print_result_message ($result, - __('Successfully generated'), - __('Could not be generated')); -} - switch ($config["dbtype"]) { case "mysql": $sql = sprintf ("SELECT * FROM ttrap ORDER BY timestamp DESC LIMIT %d,%d",$offset,$pagination); @@ -164,42 +143,6 @@ if (($config['dbtype'] == 'oracle') && ($traps !== false)) { } } -$traps_generator = '
'; -$table->width = '90%'; -$table->size = array (); -$table->data = array (); - -$table->data[0][0] = __('Host address'); -$table->data[0][1] = html_print_input_text('snmp_host_address', $snmp_host_address, '', 50, 255, true); - -$table->data[1][0] = __('Community'); -$table->data[1][1] = html_print_input_text('snmp_community', $snmp_community, '', 50, 255, true); - -$table->data[2][0] = __('OID'); -$table->data[2][1] = html_print_input_text('snmp_oid', $snmp_oid, '', 50, 255, true); - -$table->data[3][0] = __('SNMP Agent'); -$table->data[3][1] = html_print_input_text('snmp_agent', $snmp_agent, '', 50, 255, true); - -$table->data[4][0] = __('SNMP Type').' '.ui_print_help_icon ("snmp_trap_types", true); -$table->data[4][1] = html_print_input_text('snmp_type', $snmp_type, '', 50, 255, true); - -$types = array(0 => 'Cold start (0)', 1 => 'Warm start (1)', 2 => 'Link down (2)', 3 => 'Link up (3)', 4 => 'Authentication failure (4)', 5 => 'EGP neighbor loss (5)', 6 => 'Enterprise (6)'); -$table->data[4][1] = html_print_select($types, 'snmp_type', $snmp_type, '', __('Select'), -1, true, false, false); - -$table->data[5][0] = __('Value'); -$table->data[5][1] = html_print_input_text('snmp_value', $snmp_value, '', 50, 255, true); - - -$traps_generator .= html_print_table($table, true); -$traps_generator .= '
'.html_print_submit_button(__('Generate trap'), 'btn_generate_trap', false, 'class="sub cog"', true).'
'; -$traps_generator .= html_print_input_hidden('generate_trap', 1, true); - -unset($table); -$traps_generator .= '
'; - -ui_toggle($traps_generator, __('Trap generator')); - // No traps if (empty ($traps)) { echo '
'.__('There are no SNMP traps in database').'
';