From 66a69aa548e954e7532d5c0ef7c8cb5a3c9547b9 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Fri, 13 May 2022 09:51:43 +0200 Subject: [PATCH 01/45] #8889 Added external link for mobile --- pandora_console/mobile/index.php | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/pandora_console/mobile/index.php b/pandora_console/mobile/index.php index 1e65c30bdf..fc792e0a17 100644 --- a/pandora_console/mobile/index.php +++ b/pandora_console/mobile/index.php @@ -294,6 +294,42 @@ switch ($action) { $_GET['id'] = $id_map; break; + case 'External link': + $full_url = ui_get_full_url(); + $section_data = io_safe_output($section_data); + + $host_full = parse_url($full_url, PHP_URL_HOST); + $host_section = parse_url($section_data, PHP_URL_HOST); + + if ($host_full !== $host_section) { + $has_mobile = strpos($section_data, 'mobile'); + if ($has_mobile === false) { + $pos = strpos($section_data, '/index'); + if ($pos !== false) { + $section_data = substr_replace($section_data, '/mobile', $pos, 0); + } + } + + echo ''; + } else { + if (strpos($full_url, 'event') !== false) { + $page = 'events'; + } + + if (strpos($full_url, 'alert') !== false) { + $page = 'alerts'; + } + + if (strpos($full_url, 'tactical') !== false) { + $page = 'tactical'; + } + + if (strpos($full_url, 'visual_console') !== false) { + $page = 'visualmap'; + } + } + break; + case 'Group view': default: // No content. From 4ae2df8dedf4971f0d544894b085d467b5c998f3 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 17 May 2022 13:42:38 +0200 Subject: [PATCH 02/45] #8939 comment optimization --- pandora_console/include/functions_events.php | 15 +++++++++------ .../include/lib/Dashboard/Widgets/events_list.php | 5 ++++- pandora_console/operation/events/events.php | 8 +++++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 934d7c27bc..f37e30fc11 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1476,16 +1476,19 @@ function events_get_all( $group_selects = ''; if ($group_by != '') { if ($count === false) { - $group_selects = ',COUNT(id_evento) AS event_rep, - GROUP_CONCAT(DISTINCT user_comment SEPARATOR "
") AS comments, - MAX(utimestamp) as timestamp_last, - MIN(utimestamp) as timestamp_first, - MAX(id_evento) as max_id_evento'; - $idx = array_search('te.user_comment', $fields); if ($idx !== false) { unset($fields[$idx]); } + + $group_selects = sprintf( + ',COUNT(id_evento) AS event_rep, + %s + MAX(utimestamp) as timestamp_last, + MIN(utimestamp) as timestamp_first, + MAX(id_evento) as max_id_evento', + ($idx !== false) ? 'GROUP_CONCAT(DISTINCT user_comment SEPARATOR "
") AS comments,' : '' + ); } } else { $idx = array_search('te.user_comment', $fields); diff --git a/pandora_console/include/lib/Dashboard/Widgets/events_list.php b/pandora_console/include/lib/Dashboard/Widgets/events_list.php index e0c1bfe3cf..06416cecb4 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/events_list.php +++ b/pandora_console/include/lib/Dashboard/Widgets/events_list.php @@ -596,7 +596,6 @@ class EventsListWidget extends Widget 'te.event_type', 'te.id_alert_am', 'te.criticity', - 'te.user_comment', 'te.tags', 'te.source', 'te.id_extra', @@ -612,6 +611,10 @@ class EventsListWidget extends Widget 'tg.nombre as group_name', ]; + if (empty($filter['search']) === false || empty($filter['user_comment']) === false) { + $fields[] = 'te.user_comment'; + } + $home_url = $config['homeurl']; if ((bool) \is_metaconsole() === false diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 5f3a733318..113dfc9b53 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -286,7 +286,6 @@ if (is_ajax() === true) { 'te.event_type', 'te.id_alert_am', 'te.criticity', - 'te.user_comment', 'te.tags', 'te.source', 'te.id_extra', @@ -303,6 +302,13 @@ if (is_ajax() === true) { 'ta.direccion', ]; + if (strpos($config['event_fields'], 'user_comment') !== false + || empty($user_comment) === false + || empty($search) === false + ) { + $fields[] = 'te.user_comment'; + } + $order = get_datatable_order(true); if (is_array($order) === true && $order['field'] === 'mini_severity') { From 2c1ac769a48c0ca6d0140146d123331639f72303 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 18 May 2022 11:06:15 +0200 Subject: [PATCH 03/45] #8929 Added group recursion --- .../include/functions_reporting.php | 31 +++++++++++++++++-- .../lib/Dashboard/Widgets/groups_status.php | 26 +++++++++++++--- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 6bf29c1235..6dd7e7a46c 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -10987,7 +10987,7 @@ function reporting_get_group_stats($id_group=0, $access='AR', $recursion=true) * * @return array Group statistics */ -function reporting_get_group_stats_resume($id_group=0, $access='AR', $ignore_permissions=false) +function reporting_get_group_stats_resume($id_group=0, $access='AR', $ignore_permissions=false, $recursive=false) { global $config; @@ -11031,6 +11031,8 @@ function reporting_get_group_stats_resume($id_group=0, $access='AR', $ignore_per $id_group = array_keys( users_get_groups($config['id_user'], $access, false) ); + } else if ($recursive === true) { + $id_group = groups_get_children_ids($id_group); } // ----------------------------------------------------------------- @@ -11161,7 +11163,7 @@ function reporting_get_group_stats_resume($id_group=0, $access='AR', $ignore_per $group_stat = db_get_all_rows_sql($sql); $data = [ 'monitor_checks' => (int) $group_stat[0]['modules'], - 'monitor_alerts' => (int) groups_monitor_alerts($group_array), + 'monitor_alerts' => (int) groups_monitor_alerts($group_stat[0]['id_group']), 'monitor_alerts_fired' => (int) $group_stat[0]['alerts_fired'], 'monitor_alerts_fire_count' => (int) $group_stat[0]['alerts_fired'], 'monitor_ok' => (int) $group_stat[0]['normal'], @@ -11175,10 +11177,33 @@ function reporting_get_group_stats_resume($id_group=0, $access='AR', $ignore_per 'agent_warning' => (int) $group_stat[0]['agents_warnings'], 'agent_critical' => (int) $group_stat[0]['agents_critical'], 'total_checks' => (int) $group_stat[0]['modules'], - 'total_alerts' => (int) groups_monitor_alerts($group_array), + 'total_alerts' => (int) groups_monitor_alerts($group_stat[0]['id_group']), 'total_agents' => (int) $group_stat[0]['agents'], 'utimestamp' => (int) $group_stat[0]['utimestamp'], ]; + + if ($recursive === true) { + unset($group_stat[0]); + foreach ($group_stat as $value) { + $data['monitor_checks'] = ($data['monitor_checks'] + $value['modules']); + $data['monitor_alerts'] = ($data['monitor_alerts'] + groups_monitor_alerts($value['id_group'])); + $data['monitor_alerts_fired'] = ($data['monitor_alerts_fired'] + $value['alerts_fired']); + $data['monitor_alerts_fire_count'] = ($data['monitor_alerts_fire_count'] + $value['alerts_fired']); + $data['monitor_ok'] = ($data['monitor_ok'] + $value['normal']); + $data['monitor_warning'] = ($data['monitor_warning'] + $value['warning']); + $data['monitor_critical'] = ($data['monitor_critical'] + $value['critical']); + $data['monitor_unknown'] = ($data['monitor_unknown'] + $value['unknown']); + $data['monitor_not_init'] = ($data['monitor_not_init'] + $value['non-init']); + $data['agent_not_init'] = ($data['agent_not_init'] + $value['agents_not_init']); + $data['agent_unknown'] = ($data['agent_unknown'] + $value['agents_unknown']); + $data['agent_ok'] = ($data['agent_ok'] + $value['agents_normal']); + $data['agent_warning'] = ($data['agent_warning'] + $value['agents_warnings']); + $data['agent_critical'] = ($data['agent_critical'] + $value['agents_critical']); + $data['total_checks'] = ($data['total_checks'] + $value['modules']); + $data['total_alerts'] = ($data['total_alerts'] + groups_monitor_alerts($value['id_group'])); + $data['total_agents'] = ($data['total_agents'] + $value['agents']); + } + } } } diff --git a/pandora_console/include/lib/Dashboard/Widgets/groups_status.php b/pandora_console/include/lib/Dashboard/Widgets/groups_status.php index af25b2c056..cdde2c16eb 100755 --- a/pandora_console/include/lib/Dashboard/Widgets/groups_status.php +++ b/pandora_console/include/lib/Dashboard/Widgets/groups_status.php @@ -193,6 +193,10 @@ class GroupsStatusWidget extends Widget $values['groupId'] = $decoder['groupId']; } + if (isset($decoder['groupRecursion']) === true) { + $values['groupRecursion'] = $decoder['groupRecursion']; + } + return $values; } @@ -224,6 +228,16 @@ class GroupsStatusWidget extends Widget ], ]; + $inputs[] = [ + 'label' => __('Group recursion'), + 'arguments' => [ + 'name' => 'groupRecursion', + 'id' => 'groupRecursion', + 'type' => 'switch', + 'value' => $values['groupRecursion'], + ], + ]; + return $inputs; } @@ -239,6 +253,7 @@ class GroupsStatusWidget extends Widget $values = parent::getPost(); $values['groupId'] = \get_parameter('groupId', 0); + $values['groupRecursion'] = \get_parameter_switch('groupRecursion', 0); return $values; } @@ -260,9 +275,12 @@ class GroupsStatusWidget extends Widget $output = ''; - $user_groups = \users_get_groups(false, 'AR', false); - - $stats = \reporting_get_group_stats_resume($this->values['groupId'], 'AR', true); + $stats = \reporting_get_group_stats_resume( + $this->values['groupId'], + 'AR', + true, + (bool) $this->values['groupRecursion'] + ); $data = '
'; $data .= ui_print_group_icon( @@ -393,7 +411,7 @@ class GroupsStatusWidget extends Widget $table->data[0][0] .= ''; $table->data[0][1] = ''; $table->data[0][1] .= ''; - $table->data[0][1] .= $stats['monitor_total']; + $table->data[0][1] .= $stats['total_checks']; $table->data[0][1] .= ''; $table->data[0][1] .= ''; From ba0c6a7ed77c90cec5d0dc10dfebb767d6a7fee3 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 23 May 2022 12:51:32 +0200 Subject: [PATCH 04/45] added filter in services treeview --- .../include/class/TreeService.class.php | 44 ++++++++++++++++--- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/class/TreeService.class.php b/pandora_console/include/class/TreeService.class.php index ebca4562a6..49f9a8a144 100644 --- a/pandora_console/include/class/TreeService.class.php +++ b/pandora_console/include/class/TreeService.class.php @@ -252,6 +252,7 @@ class TreeService extends Tree protected function getProcessedServices() { $is_favourite = $this->getServiceFavouriteFilter(); + $service_search = $this->getServiceNameSearchFilter(); if (users_can_manage_group_all('AR')) { $groups_acl = ''; @@ -259,6 +260,16 @@ class TreeService extends Tree $groups_acl = 'AND ts.id_group IN ('.implode(',', $this->userGroupsArray).')'; } + $exclude_children = 'ts.id NOT IN ( + SELECT DISTINCT id_service_child + FROM tservice_element + WHERE id_server_meta = 0 + )'; + + if ($service_search !== '') { + $exclude_children = '1=1'; + } + $sql = sprintf( 'SELECT ts.id, @@ -277,15 +288,14 @@ class TreeService extends Tree FROM tservice ts LEFT JOIN tservice_element tse ON tse.id_service = ts.id - WHERE ts.id NOT IN ( - SELECT DISTINCT id_service_child - FROM tservice_element - WHERE id_server_meta = 0 - ) + WHERE %s + %s %s %s GROUP BY ts.id', + $exclude_children, $is_favourite, + $service_search, $groups_acl ); @@ -346,7 +356,12 @@ class TreeService extends Tree global $config; $service = new Service($this->id, true); - + // hd("SRVSRVSRVSRVSRVSRV", true); + // hd($service, true); + /* + if ($this->filter['searchService'] !== '') { + $filter[] = " (tservice.name LIKE '%".$this->filter['searchService']."%' OR tservice.description LIKE '%".$this->filter['searchService']."%')"; + }*/ $output = []; foreach ($service->children() as $item) { $tmp = []; @@ -704,6 +719,23 @@ class TreeService extends Tree } + /** + * Retrieve SQL filter for current filter + * + * @return string SQL filter. + */ + protected function getServiceNameSearchFilter() + { + if (isset($this->filter['searchService']) === true + && empty($this->filter['searchService']) === false + ) { + return " AND (ts.name LIKE '%".$this->filter['searchService']."%' OR ts.description LIKE '%".$this->filter['searchService']."%')"; + } + + return ''; + } + + /** * Overwrites partial functionality of general Tree.class. * From afc50aee464d3cbb1f26774c2056796b8d644596 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 23 May 2022 12:53:38 +0200 Subject: [PATCH 05/45] added filter in services treeview --- pandora_console/include/class/TreeService.class.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pandora_console/include/class/TreeService.class.php b/pandora_console/include/class/TreeService.class.php index 49f9a8a144..f86d90bdff 100644 --- a/pandora_console/include/class/TreeService.class.php +++ b/pandora_console/include/class/TreeService.class.php @@ -356,12 +356,7 @@ class TreeService extends Tree global $config; $service = new Service($this->id, true); - // hd("SRVSRVSRVSRVSRVSRV", true); - // hd($service, true); - /* - if ($this->filter['searchService'] !== '') { - $filter[] = " (tservice.name LIKE '%".$this->filter['searchService']."%' OR tservice.description LIKE '%".$this->filter['searchService']."%')"; - }*/ + $output = []; foreach ($service->children() as $item) { $tmp = []; From a78eb719958e80d1a5c6e073fc2a80f7f7365665 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 25 May 2022 13:00:04 +0200 Subject: [PATCH 06/45] #9019 Fixed id_user in active directory --- pandora_console/include/functions.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index ca0c9dad7d..64fa0bce93 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -2262,7 +2262,14 @@ function check_login($output=true) || (isset($_SESSION['merge-request-user-trick']) === true && $_SESSION['merge-request-user-trick'] === $_SESSION['id_usuario']) ) { - $config['id_user'] = $_SESSION['id_usuario']; + if (isset($config['auth']) === true && $config['auth'] === 'ad' && is_user($_SESSION['id_usuario'])) { + // User name in active directory is case insensitive. + // Get the user name from database. + $user_info = get_user_info($_SESSION['id_usuario']); + $config['id_user'] = $user_info['id_user']; + } else { + $config['id_user'] = $_SESSION['id_usuario']; + } return true; } From d9ad4977fa523a3689108fc47a4fbf4f55d055aa Mon Sep 17 00:00:00 2001 From: alejandro Date: Wed, 1 Jun 2022 13:01:40 +0200 Subject: [PATCH 07/45] make open cisco ipsla plugin compatible with snmp v3 --- pandora_plugins/cisco_ipsla/pandora_ipsla.sh | 685 +++++++++++++++++++ 1 file changed, 685 insertions(+) create mode 100644 pandora_plugins/cisco_ipsla/pandora_ipsla.sh diff --git a/pandora_plugins/cisco_ipsla/pandora_ipsla.sh b/pandora_plugins/cisco_ipsla/pandora_ipsla.sh new file mode 100644 index 0000000000..976548f40b --- /dev/null +++ b/pandora_plugins/cisco_ipsla/pandora_ipsla.sh @@ -0,0 +1,685 @@ +#!/bin/bash +# IPSLA remote Plugin for Pandora FMS +# (c) ArticaST 2014 + + +# Default values +COMMUNITY="public" +TAG_TABLE_CACHE="/tmp/ipsla_cache" + +function help { + echo -e "Cisco IP SLA Server Plugin for Pandora FMS. http://pandorafms.com" + echo -e "Syntax:\n\n-c -t -v [other options]\n" + echo -e "\t\t-c community" + echo -e "\t\t-t target" + echo -e "\t\t-v version" + echo -e "Other options\n"; + echo -e "\t\t-s show defined tags and indexes" + echo -e "\t\t-l " + echo -e "\t\t-u " + echo -e "\t\t-a " + echo -e "\t\t-A " + echo -e "\t\t-x " + echo -e "\t\t-X " + echo -e "\t\t-g " + echo -e "\t\t-m \n" + echo -e "Modules can be: \n" + echo -e "\tICPIF - Calculated Planning Impairment Factor for specified tag" + echo -e "\tMOS - Mean Opinion Score" + echo -e "\tPacket_Out_of_Sequence - Packets arriving out of sequence " + echo -e "\tPacket_Late_Arrival - Packets arriving late" + echo -e "\tvAerage_Jitter - Average jitter is the estimated average jitter observed in the last XX RTP packets" + echo -e "\tPacketLossSD - Packet loss from source to destination" + echo -e "\tPacketLossDS - Packet loss from destination to source" + echo -e "\tPacketLost - The number of packets that are lost for which we cannot determine the direction " + echo -e "\tNegativesSD - The sum of number of all negative jitter values from packets sent from source to destination " + echo -e "\tNegativesDS - The sum of number of all negative jitter values from packets sent from destination to source" + echo -e "\tPositivesSD - The sum of number of all positive jitter values from packets sent from source to destination" + echo -e "\tPositivesDS - The sum of number of all positive jitter values from packets sent from source to destination" + echo -e "\tRTTMax - Max Round Trip Time" + echo -e "\tRTTMin - Min Round Trip Time" + echo -e "\tOperNumOfRTT - The number of successful round trips" + echo -e "\tOperPacketLossSD - Packet loss from source to destination for jitter tests" + echo -e "\tOperPacketLossDS - Packet loss from destination to source for jitter tests" + echo -e "\tRttOperSense - A sense code for the completion status of the latest RTT operation." + echo -e "\tRttOperCompletionTime - The completion time of the latest RTT operation successfully completed." + echo -e "\tRttOperTime - The value of the agent system time at the time of the latest RTT operation." + echo -e "\tRttOperAddress - A string which specifies the address of the target." + echo -e "\tHTTPOperRTT - Round Trip Time taken to perform HTTP operation. This value is the sum of DNSRTT, TCPConnectRTT and TransactionRTT." + echo -e "\tHTTPOperDNSRTT Round Trip Time taken to perform DNS query within the HTTP operation." + echo -e "\tHTTPOperTCPConnectRTT - Round Trip Time taken to connect to the HTTP server." + echo -e "\tIcmpJitterAvgJitter The average of positive and negative jitter values in Source-to-Destionation and Destination-to-Source direction." + echo -e "\tHTTPOperTransactionRTT - Round Trip Time taken to download the object specified by the URL." + + echo "" + exit +} + +function show_tags { + TAG_TABLE_CACHE=$TAG_TABLE_CACHE.$TARGET + + # If not exist the cache, then create it + if [ ! -f "$TAG_TABLE_CACHE" ] + then + snmpwalk -v 1 -Onq -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.1.1.3 > $TAG_TABLE_CACHE + fi + cat $TAG_TABLE_CACHE | awk '{ print $2 }' | tr -d "\"" | grep -ve '^$' + exit +} + +function get_index { + cat $TAG_TABLE_CACHE.$TARGET | grep $1 | grep -o "[0-9]*\s" +} + +# This function requires two arguments. MODULE_TYPE TAG +function get_module { + MODULE_TYPE=$1 + TAG=$2 + INDICE=`get_index $TAG` + + if [ $version != "v3" ] + + then + + if [ "$MODULE_TYPE" == "ICPIF" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.43.$INDICE` + fi + if [ "$MODULE_TYPE" == "MOS" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.42.$INDICE` + fi + if [ "$MODULE_TYPE" == "Packet_Out_of_Sequence" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.28.$INDICE` + fi + + if [ "$MODULE_TYPE" == "Packet_Late_Arrival" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.30.$INDICE` + fi + + if [ "$MODULE_TYPE" == "Average_Jitter" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.46.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PacketLossSD" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PacketLossDS" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PacketLost" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.29.$INDICE` + fi + + if [ "$MODULE_TYPE" == "NegativesSD" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.12.$INDICE` + fi + + if [ "$MODULE_TYPE" == "NegativesDS" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.22.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PositivesSD" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.7.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PositivesDS" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.17.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RTTMax" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.5.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RTTMin" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.4.$INDICE` + fi + + if [ "$MODULE_TYPE" == "OperNumOfRTT" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.1.$INDICE` + fi + + if [ "$MODULE_TYPE" == "OperPacketLossSD" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE` + fi + + if [ "$MODULE_TYPE" == "OperPacketLossDS" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperSense" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.1.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperCompletionTime" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.2.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperTime" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.5.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperAddress" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.6.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperRTT" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.1.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperDNSRTT" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.2.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperTCPConnectRTT" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.3.$INDICE` + fi + + if [ "$MODULE_TYPE" == "IcmpJitterAvgJitter" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.4.1.44.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperTransactionRTT" ] + then + VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.4.$INDICE` + fi + fi + + if [ $version == "v3" ] + + #if snmp v3 snmpget with v3 + then + if [ $auth == "authPriv" ] + # if authpriv snmpget with all parameters + then + if [ "$MODULE_TYPE" == "ICPIF" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.43.$INDICE` + fi + if [ "$MODULE_TYPE" == "MOS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.42.$INDICE` + fi + if [ "$MODULE_TYPE" == "Packet_Out_of_Sequence" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.28.$INDICE` + fi + + if [ "$MODULE_TYPE" == "Packet_Late_Arrival" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.30.$INDICE` + fi + + if [ "$MODULE_TYPE" == "Average_Jitter" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.46.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PacketLossSD" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PacketLossDS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PacketLost" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.29.$INDICE` + fi + + if [ "$MODULE_TYPE" == "NegativesSD" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.12.$INDICE` + fi + + if [ "$MODULE_TYPE" == "NegativesDS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.22.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PositivesSD" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.7.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PositivesDS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.17.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RTTMax" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.5.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RTTMin" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.4.$INDICE` + fi + + if [ "$MODULE_TYPE" == "OperNumOfRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.1.$INDICE` + fi + + if [ "$MODULE_TYPE" == "OperPacketLossSD" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE` + fi + + if [ "$MODULE_TYPE" == "OperPacketLossDS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperSense" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.1.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperCompletionTime" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.2.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperTime" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.5.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperAddress" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.6.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.1.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperDNSRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.2.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperTCPConnectRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.3.$INDICE` + fi + + if [ "$MODULE_TYPE" == "IcmpJitterAvgJitter" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.4.1.44.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperTransactionRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.4.$INDICE` + fi + fi + if [ $auth == "authNoPriv" ] + then + if [ "$hash1" ] + then + if [ "$MODULE_TYPE" == "ICPIF" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.43.$INDICE` + fi + if [ "$MODULE_TYPE" == "MOS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.42.$INDICE` + fi + if [ "$MODULE_TYPE" == "Packet_Out_of_Sequence" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.28.$INDICE` + fi + + if [ "$MODULE_TYPE" == "Packet_Late_Arrival" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.30.$INDICE` + fi + + if [ "$MODULE_TYPE" == "Average_Jitter" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.46.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PacketLossSD" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PacketLossDS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PacketLost" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.29.$INDICE` + fi + + if [ "$MODULE_TYPE" == "NegativesSD" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.12.$INDICE` + fi + + if [ "$MODULE_TYPE" == "NegativesDS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.22.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PositivesSD" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.7.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PositivesDS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.17.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RTTMax" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.5.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RTTMin" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.4.$INDICE` + fi + + if [ "$MODULE_TYPE" == "OperNumOfRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.1.$INDICE` + fi + + if [ "$MODULE_TYPE" == "OperPacketLossSD" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE` + fi + + if [ "$MODULE_TYPE" == "OperPacketLossDS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperSense" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.1.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperCompletionTime" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.2.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperTime" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.5.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperAddress" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.6.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.1.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperDNSRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.2.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperTCPConnectRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.3.$INDICE` + fi + + if [ "$MODULE_TYPE" == "IcmpJitterAvgJitter" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.4.1.44.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperTransactionRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.4.$INDICE` + fi + else + if [ "$MODULE_TYPE" == "ICPIF" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.43.$INDICE` + fi + if [ "$MODULE_TYPE" == "MOS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.42.$INDICE` + fi + if [ "$MODULE_TYPE" == "Packet_Out_of_Sequence" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.28.$INDICE` + fi + + if [ "$MODULE_TYPE" == "Packet_Late_Arrival" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.30.$INDICE` + fi + + if [ "$MODULE_TYPE" == "Average_Jitter" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.46.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PacketLossSD" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PacketLossDS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PacketLost" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.29.$INDICE` + fi + + if [ "$MODULE_TYPE" == "NegativesSD" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.12.$INDICE` + fi + + if [ "$MODULE_TYPE" == "NegativesDS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.22.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PositivesSD" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.7.$INDICE` + fi + + if [ "$MODULE_TYPE" == "PositivesDS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.17.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RTTMax" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.5.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RTTMin" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.4.$INDICE` + fi + + if [ "$MODULE_TYPE" == "OperNumOfRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.1.$INDICE` + fi + + if [ "$MODULE_TYPE" == "OperPacketLossSD" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE` + fi + + if [ "$MODULE_TYPE" == "OperPacketLossDS" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperSense" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.1.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperCompletionTime" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.2.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperTime" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.5.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperAddress" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.6.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.1.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperDNSRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.2.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperTCPConnectRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.3.$INDICE` + fi + + if [ "$MODULE_TYPE" == "IcmpJitterAvgJitter" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.4.1.44.$INDICE` + fi + + if [ "$MODULE_TYPE" == "HTTPOperTransactionRTT" ] + then + VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.4.$INDICE` + fi + + fi + + fi + fi + + echo -n $VALOR + exit 0 +} + +if [ -z "`which snmpwalk`" ] +then + echo "ERROR: snmpwalk is not in the path. Exiting..." + exit -1 +fi + +if [ $# -eq 0 ] +then + help +fi + +# Main parsing code + +while getopts ":hc:t:v:l:u:a:A:x:X:sm:g:" optname + do + case "$optname" in + "h") + help + ;; + "c") + COMMUNITY=$OPTARG + ;; + "t") + TARGET=$OPTARG + ;; + "v") + version=$OPTARG + ;; + "l") + auth=$OPTARG + ;; + "u") + user=$OPTARG + ;; + "a") + hash1=$OPTARG + ;; + "A") + hash1pass=$OPTARG + ;; + "x") + hash2=$OPTARG + ;; + "X") + hash2pass=$OPTARG + ;; + "g") + TAG=$OPTARG + ;; + "s") + show_tags + ;; + "m") + get_module $OPTARG $TAG + ;; + ?) + help + ;; + default) + help + ;; + + esac +done + +# Execution +echo "DEBUG" + +exit 0 From c9b94273be68824aaececebb15454fe9c30b7d6d Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 7 Jun 2022 15:21:07 +0200 Subject: [PATCH 08/45] #8769 removed metaconsole_assigned_server --- pandora_console/extras/mr/56.sql | 5 +++ .../godmode/users/configure_user.php | 40 ++++--------------- pandora_console/pandoradb.sql | 1 - 3 files changed, 13 insertions(+), 33 deletions(-) create mode 100644 pandora_console/extras/mr/56.sql diff --git a/pandora_console/extras/mr/56.sql b/pandora_console/extras/mr/56.sql new file mode 100644 index 0000000000..552928b4ac --- /dev/null +++ b/pandora_console/extras/mr/56.sql @@ -0,0 +1,5 @@ +START TRANSACTION; + +ALTER TABLE `tusuario` DROP COLUMN `metaconsole_assigned_server`; + +COMMIT; diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 669bdf4fdf..32b1e1b57b 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -301,7 +301,6 @@ if ($new_user && $config['admin_can_add_user']) { if (enterprise_installed() && is_metaconsole() === true) { $user_info['metaconsole_agents_manager'] = 0; - $user_info['metaconsole_assigned_server'] = ''; $user_info['metaconsole_access_node'] = 0; } @@ -375,7 +374,6 @@ if ($create_user) { if (defined('METACONSOLE')) { $values['metaconsole_access'] = get_parameter('metaconsole_access', 'basic'); $values['metaconsole_agents_manager'] = ($user_is_admin == 1 ? 1 : get_parameter('metaconsole_agents_manager', '0')); - $values['metaconsole_assigned_server'] = get_parameter('metaconsole_assigned_server', ''); $values['metaconsole_access_node'] = ($user_is_admin == 1 ? 1 : get_parameter('metaconsole_access_node', '0')); } } @@ -588,7 +586,6 @@ if ($update_user) { if (enterprise_installed() && defined('METACONSOLE')) { $values['metaconsole_access'] = get_parameter('metaconsole_access'); $values['metaconsole_agents_manager'] = get_parameter('metaconsole_agents_manager', '0'); - $values['metaconsole_assigned_server'] = get_parameter('metaconsole_assigned_server', ''); $values['metaconsole_access_node'] = get_parameter('metaconsole_access_node', '0'); } @@ -1373,15 +1370,6 @@ if ($meta) { true ).'
'; - $metaconsole_assigned_server = '

'.__('Assigned node').ui_print_help_tip(__('Server where the agents created of this user will be placed'), true).'

'; - $servers = metaconsole_get_servers(); - $servers_for_select = []; - foreach ($servers as $server) { - $servers_for_select[$server['id']] = $server['server_name']; - } - - $metaconsole_assigned_server .= html_print_select($servers_for_select, 'metaconsole_assigned_server', $user_info['metaconsole_assigned_server'], '', '', -1, true, false, false).'
'; - $metaconsole_access_node = '

'.__('Enable node access').ui_print_help_tip(__('With this option enabled, the user will can access to nodes console'), true).'

'; $metaconsole_access_node .= html_print_checkbox( 'metaconsole_access_node', @@ -1432,7 +1420,7 @@ if (!is_metaconsole()) { '.$area_data_timezone_polys.$area_data_timezone_rects.'
'; } else { - echo $search_custom_fields_view.$metaconsole_agents_manager.$metaconsole_assigned_server.$metaconsole_access_node; + echo $search_custom_fields_view.$metaconsole_agents_manager.$metaconsole_access_node; } echo ' @@ -1548,35 +1536,23 @@ $(document).ready (function () { } else { show_double_auth_deactivation(); } - }); + }); $('input:radio[name="is_admin"]').change(function() { - if($('#radiobtn0002').prop('checked')) { + if($('#radiobtn0002').prop('checked')) { $('#metaconsole_agents_manager_div').show(); $('#metaconsole_access_node_div').show(); - if($('#checkbox-metaconsole_agents_manager').prop('checked')) { - $('#metaconsole_assigned_server_div').show(); - } - } - else { - $('#metaconsole_agents_manager_div').hide(); - $('#metaconsole_access_node_div').hide(); - $('#metaconsole_assigned_server_div').hide(); - } - }); - - $('#checkbox-metaconsole_agents_manager').change(function() { - if($('#checkbox-metaconsole_agents_manager').prop('checked')) { - $('#metaconsole_assigned_server_div').show(); } else { - $('#metaconsole_assigned_server_div').hide(); + $('#metaconsole_agents_manager_div').hide(); + $('#metaconsole_access_node_div').hide(); } }); - + + $('input:radio[name="is_admin"]').trigger('change'); $('#checkbox-metaconsole_agents_manager').trigger('change'); - + show_data_section(); $('#checkbox-ehorus_user_level_enabled').change(function () { switch_ehorus_conf(); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index ebd940c749..55217e2dc3 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1290,7 +1290,6 @@ CREATE TABLE IF NOT EXISTS `tusuario` ( `not_login` TINYINT UNSIGNED NOT NULL DEFAULT 0, `local_user` TINYINT UNSIGNED NOT NULL DEFAULT 0, `metaconsole_agents_manager` TINYINT UNSIGNED NOT NULL DEFAULT 0, - `metaconsole_assigned_server` INT UNSIGNED NOT NULL DEFAULT 0, `metaconsole_access_node` TINYINT UNSIGNED NOT NULL DEFAULT 0, `strict_acl` TINYINT UNSIGNED NOT NULL DEFAULT 0, `id_filter` INT UNSIGNED NULL DEFAULT NULL, From dc8c073f83424b70016b2578557d0f4e83c981c6 Mon Sep 17 00:00:00 2001 From: rafael Date: Mon, 20 Jun 2022 08:56:53 +0200 Subject: [PATCH 09/45] adding full snmpv3 support for cisco ipsla open plugin --- pandora_plugins/cisco_ipsla/pandora_ipsla.sh | 197 ++++++++++++++----- 1 file changed, 146 insertions(+), 51 deletions(-) mode change 100644 => 100755 pandora_plugins/cisco_ipsla/pandora_ipsla.sh diff --git a/pandora_plugins/cisco_ipsla/pandora_ipsla.sh b/pandora_plugins/cisco_ipsla/pandora_ipsla.sh old mode 100644 new mode 100755 index 976548f40b..729bf40828 --- a/pandora_plugins/cisco_ipsla/pandora_ipsla.sh +++ b/pandora_plugins/cisco_ipsla/pandora_ipsla.sh @@ -14,7 +14,7 @@ function help { echo -e "\t\t-t target" echo -e "\t\t-v version" echo -e "Other options\n"; - echo -e "\t\t-s show defined tags and indexes" + echo -e "\t\t-s show defined tags for cisco ipsla device and exit" echo -e "\t\t-l " echo -e "\t\t-u " echo -e "\t\t-a " @@ -23,12 +23,12 @@ function help { echo -e "\t\t-X " echo -e "\t\t-g " echo -e "\t\t-m \n" - echo -e "Modules can be: \n" + echo -e "Available Modules list: \n" echo -e "\tICPIF - Calculated Planning Impairment Factor for specified tag" echo -e "\tMOS - Mean Opinion Score" echo -e "\tPacket_Out_of_Sequence - Packets arriving out of sequence " echo -e "\tPacket_Late_Arrival - Packets arriving late" - echo -e "\tvAerage_Jitter - Average jitter is the estimated average jitter observed in the last XX RTP packets" + echo -e "\tAverage_Jitter - Average jitter is the estimated average jitter observed in the last XX RTP packets" echo -e "\tPacketLossSD - Packet loss from source to destination" echo -e "\tPacketLossDS - Packet loss from destination to source" echo -e "\tPacketLost - The number of packets that are lost for which we cannot determine the direction " @@ -50,167 +50,212 @@ function help { echo -e "\tHTTPOperTCPConnectRTT - Round Trip Time taken to connect to the HTTP server." echo -e "\tIcmpJitterAvgJitter The average of positive and negative jitter values in Source-to-Destionation and Destination-to-Source direction." echo -e "\tHTTPOperTransactionRTT - Round Trip Time taken to download the object specified by the URL." + echo -e "" + echo -e " Example execution" + echo -e " snmp version 3: ./pandora_ipsla.sh -t -v 3 -l authPriv -u pandorafms -a MD5 -A pandorafms -x AES -X pandorafms -g jitter -m Average_Jitter" + echo -e " snmp version 2c: ./pandora_ipsla.sh -t -v 2c -c public -g jitter -m Average_Jitter" + echo "" exit } function show_tags { - TAG_TABLE_CACHE=$TAG_TABLE_CACHE.$TARGET + local TAG_TABLE_CACHE=$TAG_TABLE_CACHE.$TARGET + + if [ $version != "3" ] + then + snmpwalk -v 1 -Onq -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.1.1.3 > $TAG_TABLE_CACHE + fi + if [ $version == "3" ] + #if snmp v3 snmpget with v3 + then + if [ $auth == "authPriv" ] + # if authpriv snmpget with all parameters + then + snmpwalk -v 3 -Onq -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass $TARGET 1.3.6.1.4.1.9.9.42.1.2.1.1.3 > $TAG_TABLE_CACHE + fi + if [ $auth == "authNoPriv" ] + then - # If not exist the cache, then create it - if [ ! -f "$TAG_TABLE_CACHE" ] - then - snmpwalk -v 1 -Onq -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.1.1.3 > $TAG_TABLE_CACHE - fi + snmpget -v 3 -Onq -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.1.1.3 > $TAG_TABLE_CACHE + fi + fi + cat $TAG_TABLE_CACHE | awk '{ print $2 }' | tr -d "\"" | grep -ve '^$' exit } +function update_tags { + local TAG_TABLE_CACHE=$TAG_TABLE_CACHE.$TARGET + + if [ $version != "3" ] + then + snmpwalk -v 1 -Onq -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.1.1.3 > $TAG_TABLE_CACHE + fi + if [ $version == "3" ] + #if snmp v3 snmpget with v3 + then + if [ $auth == "authPriv" ] + # if authpriv snmpget with all parameters + then + snmpwalk -v 3 -Onq -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass $TARGET 1.3.6.1.4.1.9.9.42.1.2.1.1.3 > $TAG_TABLE_CACHE + fi + if [ $auth == "authNoPriv" ] + then + + snmpget -v 3 -Onq -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.1.1.3 > $TAG_TABLE_CACHE + fi + fi + + +} + function get_index { - cat $TAG_TABLE_CACHE.$TARGET | grep $1 | grep -o "[0-9]*\s" + cat $TAG_TABLE_CACHE.$TARGET | grep "\"$1\"" | grep -o "[0-9]*\s" } # This function requires two arguments. MODULE_TYPE TAG function get_module { MODULE_TYPE=$1 TAG=$2 + update_tags INDICE=`get_index $TAG` - if [ $version != "v3" ] + if [ $version != "3" ] then if [ "$MODULE_TYPE" == "ICPIF" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.43.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.43.$INDICE` fi if [ "$MODULE_TYPE" == "MOS" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.42.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.42.$INDICE` fi if [ "$MODULE_TYPE" == "Packet_Out_of_Sequence" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.28.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.28.$INDICE` fi if [ "$MODULE_TYPE" == "Packet_Late_Arrival" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.30.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.30.$INDICE` fi if [ "$MODULE_TYPE" == "Average_Jitter" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.46.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.46.$INDICE` fi if [ "$MODULE_TYPE" == "PacketLossSD" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE` fi if [ "$MODULE_TYPE" == "PacketLossDS" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` fi if [ "$MODULE_TYPE" == "PacketLost" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.29.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.29.$INDICE` fi if [ "$MODULE_TYPE" == "NegativesSD" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.12.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.12.$INDICE` fi if [ "$MODULE_TYPE" == "NegativesDS" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.22.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.22.$INDICE` fi if [ "$MODULE_TYPE" == "PositivesSD" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.7.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.7.$INDICE` fi if [ "$MODULE_TYPE" == "PositivesDS" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.17.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.17.$INDICE` fi if [ "$MODULE_TYPE" == "RTTMax" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.5.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.5.$INDICE` fi if [ "$MODULE_TYPE" == "RTTMin" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.4.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.4.$INDICE` fi if [ "$MODULE_TYPE" == "OperNumOfRTT" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.1.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.1.$INDICE` fi if [ "$MODULE_TYPE" == "OperPacketLossSD" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE` fi if [ "$MODULE_TYPE" == "OperPacketLossDS" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` - fi - - if [ "$MODULE_TYPE" == "RttOperSense" ] - then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.1.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` fi if [ "$MODULE_TYPE" == "RttOperCompletionTime" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.2.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.1.$INDICE` + fi + + if [ "$MODULE_TYPE" == "RttOperSense" ] + then + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.2.$INDICE` fi if [ "$MODULE_TYPE" == "RttOperTime" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.5.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.5.$INDICE` fi if [ "$MODULE_TYPE" == "RttOperAddress" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.6.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.6.$INDICE` fi if [ "$MODULE_TYPE" == "HTTPOperRTT" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.1.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.1.$INDICE` fi if [ "$MODULE_TYPE" == "HTTPOperDNSRTT" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.2.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.2.$INDICE` fi if [ "$MODULE_TYPE" == "HTTPOperTCPConnectRTT" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.3.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.3.$INDICE` fi if [ "$MODULE_TYPE" == "IcmpJitterAvgJitter" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.4.1.44.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.4.1.44.$INDICE` fi if [ "$MODULE_TYPE" == "HTTPOperTransactionRTT" ] then - VALOR=`snmpget -$version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.4.$INDICE` + VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.4.$INDICE` fi fi - if [ $version == "v3" ] + if [ $version == "3" ] #if snmp v3 snmpget with v3 then @@ -300,12 +345,12 @@ function get_module { VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` fi - if [ "$MODULE_TYPE" == "RttOperSense" ] + if [ "$MODULE_TYPE" == "RttOperCompletionTime" ] then VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.1.$INDICE` fi - if [ "$MODULE_TYPE" == "RttOperCompletionTime" ] + if [ "$MODULE_TYPE" == "RttOperSense" ] then VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.2.$INDICE` fi @@ -432,12 +477,12 @@ function get_module { VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` fi - if [ "$MODULE_TYPE" == "RttOperSense" ] + if [ "$MODULE_TYPE" == "RttOperCompletionTime" ] then VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.1.$INDICE` fi - if [ "$MODULE_TYPE" == "RttOperCompletionTime" ] + if [ "$MODULE_TYPE" == "RttOperSense" ] then VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.2.$INDICE` fi @@ -560,12 +605,12 @@ function get_module { VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE` fi - if [ "$MODULE_TYPE" == "RttOperSense" ] + if [ "$MODULE_TYPE" == "RttOperCompletionTime" ] then VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.1.$INDICE` fi - if [ "$MODULE_TYPE" == "RttOperCompletionTime" ] + if [ "$MODULE_TYPE" == "RttOperSense" ] then VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.2.$INDICE` fi @@ -610,7 +655,7 @@ function get_module { fi fi - echo -n $VALOR + echo -n $VALOR | awk '{print $NF}' exit 0 } @@ -664,10 +709,10 @@ while getopts ":hc:t:v:l:u:a:A:x:X:sm:g:" optname TAG=$OPTARG ;; "s") - show_tags + SHOWTAGS=1 ;; "m") - get_module $OPTARG $TAG + MODULE=$OPTARG ;; ?) help @@ -680,6 +725,56 @@ while getopts ":hc:t:v:l:u:a:A:x:X:sm:g:" optname done # Execution +[ "$SHOWTAGS" ] && echo "Showing avaliables ipsla tags for the device $TARGET" && show_tags + +[ -z "$TARGET" ] && echo "Error missing target ip definition please use -t to difine it or -h to see help" && exit 1 +[ -z "$MODULE" ] && echo "Error missing module definition please use -m to difine it or -h to see help" && exit 1 +[ -z "$TAG" ] && echo "Error missing tag definition please use -g to difine it or -h to see help" && exit 1 +[ -z "$version" ] && echo "Error missing snmp version definition please use -v to difine it or -h to see help" && exit 1 + + +get_module $MODULE $TAG echo "DEBUG" exit 0 + +#RttOperSense +# 0:other +# 1:ok +# 2:disconnected +# 3:overThreshold +# 4:timeout +# 5:busy +# 6:notConnected +# 7:dropped +# 8:sequenceError +# 9:verifyError +# 10:applicationSpecific +# 11:dnsServerTimeout +# 12:tcpConnectTimeout +# 13:httpTransactionTimeout +# 14:dnsQueryError +# 15:httpError +# 16:error +# 17:mplsLspEchoTxError +# 18:mplsLspUnreachable +# 19:mplsLspMalformedReq +# 20:mplsLspReachButNotFEC +# 21:enableOk +# 22:enableNoConnect +# 23:enableVersionFail +# 24:enableInternalError +# 25:enableAbort +# 26:enableFail +# 27:enableAuthFail +# 28:enableFormatError +# 29:enablePortInUse +# 30:statsRetrieveOk +# 31:statsRetrieveNoConnect +# 32:statsRetrieveVersionFail +# 33:statsRetrieveInternalError +# 34:statsRetrieveAbort +# 35:statsRetrieveFail +# 36:statsRetrieveAuthFail +# 37:statsRetrieveFormatError +# 38:statsRetrievePortInUse \ No newline at end of file From 90c5155c1c0d7a5e7586352577de1610def54dfb Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 28 Jun 2022 11:26:08 +0200 Subject: [PATCH 10/45] #8939 conflict resolved 2 --- pandora_console/include/lib/Dashboard/Widgets/events_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/lib/Dashboard/Widgets/events_list.php b/pandora_console/include/lib/Dashboard/Widgets/events_list.php index 395b7bbc93..8b1325ed66 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/events_list.php +++ b/pandora_console/include/lib/Dashboard/Widgets/events_list.php @@ -605,7 +605,7 @@ class EventsListWidget extends Widget } if (empty($filter['search']) === false || empty($filter['user_comment']) === false) { - $fields[] = 'te.user_comment'; + $fields[] = 'user_comment'; } // Get column names. From fe46bb92359c35d8d486710627d9249622c80d30 Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 30 Jun 2022 11:24:17 +0200 Subject: [PATCH 11/45] Addded pandora_version and build_version globals --- pandora_console/include/global_config.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_console/include/global_config.php b/pandora_console/include/global_config.php index d23c6994a6..b14c2b0ae5 100644 --- a/pandora_console/include/global_config.php +++ b/pandora_console/include/global_config.php @@ -1,5 +1,7 @@ Date: Thu, 30 Jun 2022 13:41:56 +0200 Subject: [PATCH 12/45] Added Go Back input function --- pandora_console/include/functions_html.php | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index c3dea8d961..a921c2796a 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -6026,3 +6026,36 @@ function html_print_select_agent_secondary($agent, $id_agente, $options=[]) return $output; } + + +/** + * Prints a simple 'Go Back' button. + * + * @param string $url Destination Url. + * @param array $options Options. + * `button_class`: Class for button. 'w100p' by default. + * `title`: Title of the button. 'Go Back' by default. + * `action_class`: Class of icon of button. 'cancel' by default. + * @param boolean $return If true, return a formed HTML element. + * + * @return mixed + */ +function html_print_go_back_button(string $url, array $options=[], bool $return=false) +{ + $output = html_print_div( + [ + 'class' => ($options['button_class'] ?? 'w100p'), + 'content' => html_print_button( + ($options['title'] ?? __('Go back')), + 'go_back', + false, + 'window.location.href = \''.$url.'\'', + 'class="sub '.($options['action_class'] ?? ' cancel').' right"', + true + ), + ], + $return + ); + + return $output; +} From e28bfe9f3f472dbbc8ecc0a855ad472034d0af02 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Thu, 30 Jun 2022 17:17:05 +0200 Subject: [PATCH 13/45] modal sound events pandora_enterprise#9095 --- pandora_console/include/ajax/events.php | 7 +++ .../include/javascript/pandora_events.js | 48 +++++++++++++++++++ .../operation/events/sound_events.php | 3 +- pandora_console/operation/menu.php | 19 +++++++- 4 files changed, 75 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 77d9647a4b..2f55052f93 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -55,6 +55,7 @@ if (! check_acl($config['id_user'], 0, 'ER') return; } +$drawConsoleSound = (bool) get_parameter('drawConsoleSound', false); $process_buffers = (bool) get_parameter('process_buffers', false); $get_extended_event = (bool) get_parameter('get_extended_event'); $change_status = (bool) get_parameter('change_status'); @@ -2225,6 +2226,12 @@ if ($process_buffers === true) { return; } +if ($drawConsoleSound === true) { + $output = 'WIP'; + echo $output; + return; +} + if ($get_events_fired) { global $config; $filter_id = (int) get_parameter('filter_id', 0); diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index ab276cda9e..d5d09d112a 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -1028,3 +1028,51 @@ function process_buffers(buffers) { }); } } + +function openSoundEventModal(settings) { + settings = JSON.parse(atob(settings)); + + // Check modal exists and is open. + if ( + $("#modal-sound").hasClass("ui-dialog-content") && + $("#modal-sound").dialog("isOpen") + ) { + return; + } + + // Initialize modal. + $("#modal-sound") + .dialog({ + title: settings.title, + resizable: false, + modal: true, + position: { my: "right top", at: "right bottom", of: window }, + overlay: { + opacity: 0.5, + background: "black" + }, + width: 600, + height: 600, + open: function() { + $.ajax({ + method: "post", + url: settings.url, + data: { + page: settings.page, + drawConsoleSound: 1 + }, + dataType: "html", + success: function(data) { + console.log(data); + }, + error: function(error) { + console.error(error); + } + }); + }, + close: function() { + $(this).dialog("destroy"); + } + }) + .show(); +} diff --git a/pandora_console/operation/events/sound_events.php b/pandora_console/operation/events/sound_events.php index ac80788a7f..adbb82890f 100644 --- a/pandora_console/operation/events/sound_events.php +++ b/pandora_console/operation/events/sound_events.php @@ -342,7 +342,8 @@ var test_sound = false; function test_sound_button() { if (!test_sound) { $("#button_try").attr('src', '../../images/icono_test.png'); - $('body').append("