From b4dff4975cf3281b39b3039607c54a460a03dff0 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Fri, 12 Feb 2010 11:13:24 +0000 Subject: [PATCH] 2010-02-12 Miguel de Dios * pandoradb.sql: add new fields to tnetwork_component for support the snmp ver 3. * godmode/modules/manage_network_components_form.php, godmode/modules/manage_network_components_form_network.php godmode/modules/manage_network_components.php: add support to snmp ver 3, add the fields for this use, and now can create and edit network component with snmp ver 3. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2356 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 ++ .../modules/manage_network_components.php | 46 +++++++- .../manage_network_components_form.php | 109 +++++++++++++++++- ...manage_network_components_form_network.php | 44 ++++++- pandora_console/pandoradb.sql | 5 + 5 files changed, 204 insertions(+), 11 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 51c510cdd7..3828cafadd 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2010-02-12 Miguel de Dios + + * pandoradb.sql: add new fields to tnetwork_component for support the + snmp ver 3. + + * godmode/modules/manage_network_components_form.php, + godmode/modules/manage_network_components_form_network.php + godmode/modules/manage_network_components.php: add support to snmp ver 3, + add the fields for this use, and now can create and edit network + component with snmp ver 3. + 2010-02-12 Miguel de Dios * godmode/modules/manage_network_components_form.php: clean source code and diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index 71695d14b7..9e4ef71dbd 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -54,6 +54,14 @@ $ff_event = (int) get_parameter ('ff_event'); $history_data = (bool) get_parameter ('history_data'); $id = (int) get_parameter ('id'); +$snmp_version = (string) get_parameter('snmp_version'); +$snmp3_auth_user = (string) get_parameter('snmp3_auth_user'); +$snmp3_auth_pass = (string) get_parameter('snmp3_auth_pass'); +$snmp3_auth_method = (string) get_parameter('snmp3_auth_method'); +$snmp3_privacy_method = (string) get_parameter('snmp3_privacy_method'); +$snmp3_privacy_pass = (string) get_parameter('snmp3_privacy_pass'); +$snmp3_security_level = (string) get_parameter('snmp3_security_level'); + $create_component = (bool) get_parameter ('create_component'); $update_component = (bool) get_parameter ('update_component'); $delete_component = (bool) get_parameter ('delete_component'); @@ -78,6 +86,20 @@ if ($duplicate_network_component) { } if ($create_component) { + $custom_string_1 = ''; + $custom_string_2 = ''; + $custom_string_3 = ''; + if ($type >= 15 && $type <= 18) { + // New support for snmp v3 + $tcp_send = $snmp_version; + $plugin_user = $snmp3_auth_user; + $plugin_pass = $snmp3_auth_pass; + $plugin_parameter = $snmp3_auth_method; + $custom_string_1 = $snmp3_privacy_method; + $custom_string_2 = $snmp3_privacy_pass; + $custom_string_3 = $snmp3_security_level; + } + $id = create_network_component ($name, $type, $id_group, array ('description' => $description, 'module_interval' => $module_interval, @@ -100,7 +122,10 @@ if ($create_component) { 'max_warning' => $max_warning, 'min_critical' => $min_critical, 'max_critical' => $max_critical, - 'min_ff_event' => $ff_event)); + 'min_ff_event' => $ff_event, + 'custom_string_1' => $custom_string_1, + 'custom_string_2' => $custom_string_2, + 'custom_string_3' => $custom_string_3)); if ($id === false) { print_error_message (__('Could not be created')); include_once ('godmode/modules/manage_network_components_form.php'); @@ -113,6 +138,20 @@ if ($create_component) { if ($update_component) { $id = (int) get_parameter ('id'); + $custom_string_1 = ''; + $custom_string_2 = ''; + $custom_string_3 = ''; + if ($type >= 15 && $type <= 18) { + // New support for snmp v3 + $tcp_send = $snmp_version; + $plugin_user = $snmp3_auth_user; + $plugin_pass = $snmp3_auth_pass; + $plugin_parameter = $snmp3_auth_method; + $custom_string_1 = $snmp3_privacy_method; + $custom_string_2 = $snmp3_privacy_pass; + $custom_string_3 = $snmp3_security_level; + } + $result = update_network_component ($id, array ('type' => $type, 'name' => $name, @@ -138,7 +177,10 @@ if ($update_component) { 'max_warning' => $max_warning, 'min_critical' => $min_critical, 'max_critical' => $max_critical, - 'min_ff_event' => $ff_event)); + 'min_ff_event' => $ff_event, + 'custom_string_1' => $custom_string_1, + 'custom_string_2' => $custom_string_2, + 'custom_string_3' => $custom_string_3)); if ($result === false) { print_error_message (__('Could not be updated')); include_once ('godmode/modules/manage_network_components_form.php'); diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index 3ec7741238..ad37deed44 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -54,7 +54,20 @@ if (isset ($id)) { $min_critical = $component["min_critical"]; $ff_event = $component["min_ff_event"]; $history_data = $component["history_data"]; - } elseif (isset ($new_component) && $new_component) { + + + if ($type >= 15 && $type <= 18) { + // New support for snmp v3 + $snmp_version = $component["tcp_send"]; + $snmp3_auth_user = $component["plugin_user"]; + $snmp3_auth_pass = $component["plugin_pass"]; + $snmp3_auth_method = $component["plugin_parameter"]; + $snmp3_privacy_method = $component["custom_string_1"]; + $snmp3_privacy_pass = $component["custom_string_2"]; + $snmp3_security_level = $component["custom_string_3"]; + } + } + elseif (isset ($new_component) && $new_component) { $name = ""; $snmp_oid = ""; $description = ""; @@ -77,6 +90,15 @@ if (isset ($id)) { $min_critical = 0; $ff_event = 0; $history_data = true; + + $snmp_version = 1; + $snmp3_auth_user = ''; + $snmp3_auth_pass = ''; + $snmp3_privacy_method = ''; + $snmp3_privacy_pass = ''; + $snmp3_auth_method = ''; + $snmp3_security_level = ''; + } } @@ -137,7 +159,7 @@ echo '';