From d4675bea8da724f30a300734c6f328d60ecb614d Mon Sep 17 00:00:00 2001 From: Hirofumi Kosaka Date: Mon, 26 Sep 2016 18:47:41 +0900 Subject: [PATCH 01/17] Consider multi-byte chars in plugin_macros (in network components). --- pandora_console/godmode/modules/manage_network_components.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index 5a28657a51..2fa34b06c9 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -70,7 +70,7 @@ if (!empty($macros)) { $macros[$k]['value'] = get_parameter($m['macro'], ''); } - $macros = json_encode($macros); + $macros = io_json_mb_encode($macros); } $max_timeout = (int) get_parameter ('max_timeout'); From 7e80de2b80db7516e1ae7b8f14640b45cf362515 Mon Sep 17 00:00:00 2001 From: cesar991 Date: Mon, 26 Sep 2016 12:31:08 +0200 Subject: [PATCH 02/17] Add create_plugin_component function in network_components_functions.py file --- .../include/network_components_functions.py | 71 ++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/tests/console/include/network_components_functions.py b/tests/console/include/network_components_functions.py index 7bf9df0e75..ee15245c56 100644 --- a/tests/console/include/network_components_functions.py +++ b/tests/console/include/network_components_functions.py @@ -10,8 +10,7 @@ import random, time import string -def create_network_component_tcp(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,description=None): - +def create_network_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,description=None): # type_component is for example -> Remote ICMP network agent (latency) or Remote TCP network agent, numeric data @@ -77,3 +76,71 @@ def create_network_component_tcp(driver,name,type_component,group,module_group,m driver.find_element_by_id("submit-crt").click() +def create_plugin_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,description=None): + + # Type is for example -> Generic boolean or Generic numeric incremental (absolute) + + click_menu_element(driver,"Network components") + + driver.find_element_by_id("id_component_type").click() + Select(driver.find_element_by_id("id_component_type")).select_by_visible_text("Create a new plug-in component") + + driver.find_element_by_id("text-name").click() + driver.find_element_by_id("text-name").clear() + driver.find_element_by_id("text-name").send_keys(name) + + driver.find_element_by_id("type").click() + Select(driver.find_element_by_id("type")).select_by_visible_text(type_component) + + driver.find_element_by_id("id_group").click() + Select(driver.find_element_by_id("id_group")).select_by_visible_text(group) + + driver.find_element_by_id("id_module_group").click() + Select(driver.find_element_by_id("id_module_group")).select_by_visible_text(module_group) + + if min_warning != None: + + driver.find_element_by_id("text-min_warning").click() + driver.find_element_by_id("text-min_warning").clear() + driver.find_element_by_id("text-min_warning").send_keys(min_warning) + + if max_warning != None: + + driver.find_element_by_id("text-max_warning").click() + driver.find_element_by_id("text-max_warning").clear() + driver.find_element_by_id("text-max_warning").send_keys(max_warning) + + if min_critical != None: + + driver.find_element_by_id("text-min_critical").click() + driver.find_element_by_id("text-min_critical").clear() + driver.find_element_by_id("text-min_critical").send_keys(min_critical) + + + if max_critical != None: + + driver.find_element_by_id("text-max_critical").click() + driver.find_element_by_id("text-max_critical").clear() + driver.find_element_by_id("text-max_critical").send_keys(max_critical) + + # str_warning and str_critical for Generic string type: + if str_warning != None: + + driver.find_element_by_id("text-str_warning").click() + driver.find_element_by_id("text-str_warning").clear() + driver.find_element_by_id("text-str_warning").send_keys(str_warning) + + if str_critical != None: + + driver.find_element_by_id("text-str_critical").click() + driver.find_element_by_id("text-str_critical").clear() + driver.find_element_by_id("text-str_critical").send_keys(str_critical) + + if description != None: + + driver.find_element_by_id("textarea_description").click() + driver.find_element_by_id("textarea_description").clear() + driver.find_element_by_id("textarea_description").send_keys(description) + + driver.find_element_by_id("submit-crt").click() + From c3d07bfe12562e77d21e609aa8d781693f2c81b5 Mon Sep 17 00:00:00 2001 From: cesar991 Date: Mon, 26 Sep 2016 13:32:09 +0200 Subject: [PATCH 03/17] Add a new tests file Network_components.py and repair errors in network_components_functions.py --- tests/console/Network_components.py | 82 +++++++++++++++++++ .../include/network_components_functions.py | 10 ++- 2 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 tests/console/Network_components.py diff --git a/tests/console/Network_components.py b/tests/console/Network_components.py new file mode 100644 index 0000000000..dd50f1af92 --- /dev/null +++ b/tests/console/Network_components.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- +from include.common_classes_60 import PandoraWebDriverTestCase +from include.common_functions_60 import login, click_menu_element, detect_and_pass_all_wizards, gen_random_string +from include.agent_functions import search_agent,create_agent,delete_agent +from include.api_functions import * +from include.module_functions import search_module +from include.network_components_functions import * +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.support.ui import Select +from selenium.common.exceptions import NoSuchElementException +from selenium.common.exceptions import NoAlertPresentException +from selenium.webdriver.remote.webelement import WebElement + +import unittest2, time, re + + +class PAN13(PandoraWebDriverTestCase): + + + test_name = u'Planned_downtime' + test_description = u'Planed downtime test' + tickets_associated = [] + + def test_A_create_network_component(self): + + u""" + Create and search new network component module + """ + + driver = self.driver + self.login() + detect_and_pass_all_wizards(driver) + + agent_name = gen_random_string(6) + network_component_name = gen_random_string(6) + + activate_api(driver,"1234") + + params = [agent_name,"127.0.0.1","0","4","0","300","2","pandorafms","2","0","0","pruebas"] + create_agent_api(driver,params,user="admin",pwd="pandora") + + lista = driver.current_url.split('/') + + url = lista[0]+'//'+lista[2]+'/pandora_console' + + driver.get(url) + + create_network_component(driver,network_component_name,"Remote TCP network agent, boolean data","Network Management","Application",min_warning=10,max_critical=100,description="New network component by test") + + search_agent(driver,agent_name,go_to_agent=True) + + driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Manage"]').click() + driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Modules"]').click() + + Select(driver.find_element_by_id("moduletype")).select_by_visible_text("Create a new network server module") + + driver.find_element_by_xpath('//*[@id="main"]/form/table/tbody/tr/td[5]/input').click() + + driver.find_element_by_xpath('//a[contains(.,"Advanced options")]').click() + + Select(driver.find_element_by_id("network_component_group")).select_by_visible_text("Network Management") + + time.sleep(3) + + Select(driver.find_element_by_id("network_component")).select_by_visible_text(network_component_name) + + driver.find_element_by_id("submit-crtbutton").click() + + search_module (driver,agent_name,network_component_name,go_to_module=False) + + self.assertEqual(network_component_name in driver.page_source,True) + + + +if __name__ == "__main__": + unittest2.main() + + + + diff --git a/tests/console/include/network_components_functions.py b/tests/console/include/network_components_functions.py index ee15245c56..bbca51eeb6 100644 --- a/tests/console/include/network_components_functions.py +++ b/tests/console/include/network_components_functions.py @@ -10,7 +10,7 @@ import random, time import string -def create_network_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,description=None): +def create_network_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,min_critical=None,max_critical=None,str_warning=None,str_critical=None,description=None): # type_component is for example -> Remote ICMP network agent (latency) or Remote TCP network agent, numeric data @@ -18,6 +18,8 @@ def create_network_component(driver,name,type_component,group,module_group,min_w driver.find_element_by_id("id_component_type").click() Select(driver.find_element_by_id("id_component_type")).select_by_visible_text("Create a new network component") + + driver.find_element_by_id("submit-crt").click() driver.find_element_by_id("text-name").click() driver.find_element_by_id("text-name").clear() @@ -76,14 +78,16 @@ def create_network_component(driver,name,type_component,group,module_group,min_w driver.find_element_by_id("submit-crt").click() -def create_plugin_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,description=None): +def create_plugin_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,min_critical=None,max_critical=None,str_warning=None,str_critical=None,description=None): - # Type is for example -> Generic boolean or Generic numeric incremental (absolute) + # type_component is for example -> Generic boolean or Generic numeric incremental (absolute) click_menu_element(driver,"Network components") driver.find_element_by_id("id_component_type").click() Select(driver.find_element_by_id("id_component_type")).select_by_visible_text("Create a new plug-in component") + + driver.find_element_by_id("submit-crt").click() driver.find_element_by_id("text-name").click() driver.find_element_by_id("text-name").clear() From 5b1a5f48639ab25182fdcb05d7de5f1c7e67f503 Mon Sep 17 00:00:00 2001 From: cesar991 Date: Mon, 26 Sep 2016 15:45:42 +0200 Subject: [PATCH 04/17] Add new test in Network_components.py and repair a few errors in network_components_functions.py --- tests/console/Network_components.py | 49 ++++++++++++++++++- .../include/network_components_functions.py | 5 +- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/tests/console/Network_components.py b/tests/console/Network_components.py index dd50f1af92..ebcd20513a 100644 --- a/tests/console/Network_components.py +++ b/tests/console/Network_components.py @@ -16,7 +16,7 @@ from selenium.webdriver.remote.webelement import WebElement import unittest2, time, re -class PAN13(PandoraWebDriverTestCase): +class Network_components(PandoraWebDriverTestCase): test_name = u'Planned_downtime' @@ -73,6 +73,53 @@ class PAN13(PandoraWebDriverTestCase): self.assertEqual(network_component_name in driver.page_source,True) + def test_B_create_plugin_component(self): + + u""" + Create and search new plug-in component + """ + + driver = self.driver + + agent_name = gen_random_string(6) + plugin_component_name = gen_random_string(6) + + activate_api(driver,"1234") + + params = [agent_name,"127.0.0.1","0","4","0","300","2","pandorafms","2","0","0","pruebas"] + create_agent_api(driver,params,user="admin",pwd="pandora") + + lista = driver.current_url.split('/') + + url = lista[0]+'//'+lista[2]+'/pandora_console' + + driver.get(url) + + create_plugin_component(driver,plugin_component_name,"Generic numeric","Network Management","Application",max_warning=50,max_critical=100,description="New plugin component") + + search_agent(driver,agent_name,go_to_agent=True) + + driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Manage"]').click() + driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Modules"]').click() + + Select(driver.find_element_by_id("moduletype")).select_by_visible_text("Create a new plug-in server module") + + driver.find_element_by_xpath('//*[@id="main"]/form/table/tbody/tr/td[5]/input').click() + + driver.find_element_by_xpath('//a[contains(.,"Advanced options")]').click() + + Select(driver.find_element_by_id("network_component_group")).select_by_visible_text("Network Management") + + time.sleep(3) + + Select(driver.find_element_by_id("network_component")).select_by_visible_text(plugin_component_name) + + driver.find_element_by_id("submit-crtbutton").click() + + search_module (driver,agent_name,plugin_component_name,go_to_module=False) + + self.assertEqual(plugin_component_name in driver.page_source,True) + if __name__ == "__main__": unittest2.main() diff --git a/tests/console/include/network_components_functions.py b/tests/console/include/network_components_functions.py index bbca51eeb6..de67513dfa 100644 --- a/tests/console/include/network_components_functions.py +++ b/tests/console/include/network_components_functions.py @@ -84,9 +84,8 @@ def create_plugin_component(driver,name,type_component,group,module_group,min_wa click_menu_element(driver,"Network components") - driver.find_element_by_id("id_component_type").click() - Select(driver.find_element_by_id("id_component_type")).select_by_visible_text("Create a new plug-in component") - + driver.find_element_by_xpath('//*[@id="id_component_type"]/option[2]').click() + driver.find_element_by_id("submit-crt").click() driver.find_element_by_id("text-name").click() From 0b696e9c3b45a949b603bb1ee580fece17a9a6fe Mon Sep 17 00:00:00 2001 From: cesar991 Date: Mon, 26 Sep 2016 16:30:52 +0200 Subject: [PATCH 05/17] Add new test copy_modules_in_bulk and repair errors in bulk_operations.py --- tests/console/Bulk_operations.py | 49 ++++++++++++++++++++++++ tests/console/include/bulk_operations.py | 7 +--- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/tests/console/Bulk_operations.py b/tests/console/Bulk_operations.py index 5bf01e3ac8..2d731e69e7 100644 --- a/tests/console/Bulk_operations.py +++ b/tests/console/Bulk_operations.py @@ -324,7 +324,56 @@ class Bulk_operations(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//tr//td[contains(.,"2")]') self.assertIsInstance(element,WebElement) + def test_H_copy_modules_in_bulk(self): + u""" + Create three agents One of them with a module. Through a bulk operation, copy this module in other two agents + """ + + agent_name_1 = gen_random_string(6) + agent_name_2 = gen_random_string(6) + agent_name_3 = gen_random_string(6) + + module_name_1 = gen_random_string(6) + + driver = self.driver + + activate_api(driver,"1234") + + params = [agent_name_1,"127.0.0.1","0","4","0","300","2","pandorafms","2","0","0","pruebas"] + create_agent_api(driver,params,user="admin",pwd="pandora") + + params = [agent_name_2,"127.0.0.1","0","4","0","300","2","pandorafms","2","0","0","pruebas"] + create_agent_api(driver,params,user="admin",pwd="pandora") + + params = [agent_name_3,"127.0.0.1","0","4","0","300","2","pandorafms","2","0","0","pruebas"] + create_agent_api(driver,params,user="admin",pwd="pandora") + + params = [agent_name_1,module_name_1,"0","6","1","0","0","0","0","0","0","0","0","129.99.40.1","0","0","180","0","0","0","0","Host_Alive"] + add_network_module_to_agent_api(driver,params,user="admin",pwd="pandora",apipwd="1234") + + lista = driver.current_url.split('/') + + url = lista[0]+'//'+lista[2]+'/pandora_console' + + driver.get(url) + + destiny_agents_list = [agent_name_2,agent_name_3] + + module_list = [module_name_1] + + agent_name = agent_name_1.lower() + + copy_modules_in_bulk(driver,agent_name,module_list,destiny_agents_list) + + search_module(driver,agent_name_2,module_name_1) + + self.assertEqual(module_name_1 in driver.page_source,True) + + search_module(driver,agent_name_3,module_name_1) + + self.assertEqual(module_name_1 in driver.page_source,True) + if __name__ == "__main__": unittest2.main() diff --git a/tests/console/include/bulk_operations.py b/tests/console/include/bulk_operations.py index 71784b74cd..06854e9686 100644 --- a/tests/console/include/bulk_operations.py +++ b/tests/console/include/bulk_operations.py @@ -98,8 +98,6 @@ def copy_modules_in_bulk(driver,owner_agent_name,module_name_list,destiny_agents Select(driver.find_element_by_id("option")).select_by_visible_text("Copy modules in bulk") time.sleep(2) - driver.find_element_by_id("source_id_agent").click() - Select(driver.find_element_by_id("source_id_agent")).select_by_visible_text(owner_agent_name) time.sleep(3) @@ -110,10 +108,9 @@ def copy_modules_in_bulk(driver,owner_agent_name,module_name_list,destiny_agents for agent_name in destiny_agents_list: Select(driver.find_element_by_id("destiny_id_agent")).select_by_visible_text(agent_name) - driver.find_element_by_id("submit-go").click() - - + alert = driver.switch_to_alert() + alert.accept() def edit_modules_in_bulk(driver,module_name_list,agent_name_list,new_module_group=None,new_min=None,new_max=None,ff_threshold_list=None): From 902036c0ec5c4a6027b14e1d90dd5583638e2b7c Mon Sep 17 00:00:00 2001 From: luzik Date: Mon, 26 Sep 2016 19:52:53 +0200 Subject: [PATCH 06/17] Docker bug workaround 'Text file busy' This is workaround of this docker issue https://github.com/docker/docker/issues/9547 --- pandora_server/docker_entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/docker_entrypoint.sh b/pandora_server/docker_entrypoint.sh index 9529488f2b..38fc841da2 100755 --- a/pandora_server/docker_entrypoint.sh +++ b/pandora_server/docker_entrypoint.sh @@ -38,7 +38,7 @@ fi #Create the pandora user to run the anyterd, mainly /usr/sbin/useradd -d /home/pandora -s /bin/false -M -g 0 pandora -cd /tmp/pandorafms/pandora_server && chmod +x pandora_server_installer && ./pandora_server_installer --install +cd /tmp/pandorafms/pandora_server && chmod +x pandora_server_installer && sync && ./pandora_server_installer --install #Configure the Pandora FMS Server to connect to the database sed -i "s/dbname pandora/dbname $PANDORA_DB_NAME/g" /etc/pandora/pandora_server.conf From 7d33af357da631c0050ee864ccd5d693bc35f544 Mon Sep 17 00:00:00 2001 From: luzik Date: Mon, 26 Sep 2016 20:46:23 +0200 Subject: [PATCH 07/17] added net-snmp-utils to Dockerfile pandora-console required net-snmp-utils to run SNMP wizard from web console --- pandora_console/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/Dockerfile b/pandora_console/Dockerfile index add7d4e380..3f46b9c25b 100644 --- a/pandora_console/Dockerfile +++ b/pandora_console/Dockerfile @@ -45,6 +45,7 @@ RUN yum install -y \ php-common \ php-zip \ nmap \ + net-snmp-utils \ xprobe2 #Clone the repo From 9c38192340ce4622844f9ed1bea03cedee81c814 Mon Sep 17 00:00:00 2001 From: artica Date: Tue, 27 Sep 2016 00:01:21 +0200 Subject: [PATCH 08/17] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb.data.oracle.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index c43d4b02e2..1631070da1 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.1dev-160926 +Version: 6.1dev-160927 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 01decab2ff..d3a3df531f 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.1dev-160926" +pandora_version="6.1dev-160927" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 35b40c36e6..3f6284ee59 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '6.1dev'; -use constant AGENT_BUILD => '160926'; +use constant AGENT_BUILD => '160927'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index abaca5a6e7..7f096bddaf 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.1dev -%define release 160926 +%define release 160927 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index b4703701d1..b756a6aedb 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.1dev -%define release 160926 +%define release 160927 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 8f2c83b0d9..b4c669f892 100644 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="6.1dev" -PI_BUILD="160926" +PI_BUILD="160927" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 6b4bc25cef..6e903c3c78 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{160926} +{160927} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index b7061f3637..3d46502de3 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("6.1dev(Build 160926)") +#define PANDORA_VERSION ("6.1dev(Build 160927)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 32c16b6f83..5ab81204c1 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(6.1dev(Build 160926))" + VALUE "ProductVersion", "(6.1dev(Build 160927))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 71438091a5..d8a020f0b8 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.1dev-160926 +Version: 6.1dev-160927 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 596b38cb56..22254e6c90 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.1dev-160926" +pandora_version="6.1dev-160927" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 197688cd6d..19cf46656e 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC160926'; +$build_version = 'PC160927'; $pandora_version = 'v6.1dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 3e8ccc8708..a078ee42e1 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Tue, 27 Sep 2016 10:56:38 +0200 Subject: [PATCH 09/17] Add test C in Network_components and repair functions in network_components_functions --- tests/console/Network_components.py | 65 ++++++++++++++-- .../include/network_components_functions.py | 75 ++++++++++++++++++- 2 files changed, 128 insertions(+), 12 deletions(-) diff --git a/tests/console/Network_components.py b/tests/console/Network_components.py index ebcd20513a..146c1a2b95 100644 --- a/tests/console/Network_components.py +++ b/tests/console/Network_components.py @@ -19,11 +19,11 @@ import unittest2, time, re class Network_components(PandoraWebDriverTestCase): - test_name = u'Planned_downtime' - test_description = u'Planed downtime test' + test_name = u'Network_components' + test_description = u'Network components test' tickets_associated = [] - def test_A_create_network_component(self): + def atest_A_create_network_component(self): u""" Create and search new network component module @@ -73,14 +73,18 @@ class Network_components(PandoraWebDriverTestCase): self.assertEqual(network_component_name in driver.page_source,True) - def test_B_create_plugin_component(self): + def atest_B_create_plugin_component(self): u""" Create and search new plug-in component """ driver = self.driver + + self.login() + detect_and_pass_all_wizards(driver) + agent_name = gen_random_string(6) plugin_component_name = gen_random_string(6) @@ -120,10 +124,55 @@ class Network_components(PandoraWebDriverTestCase): self.assertEqual(plugin_component_name in driver.page_source,True) + def test_C_create_wmi_component(self): + + u""" + Create and search new wmi component + """ + + driver = self.driver + + self.login() + detect_and_pass_all_wizards(driver) + + agent_name = gen_random_string(6) + plugin_component_name = gen_random_string(6) + + activate_api(driver,"1234") + + params = [agent_name,"127.0.0.1","0","4","0","300","2","pandorafms","2","0","0","pruebas"] + create_agent_api(driver,params,user="admin",pwd="pandora") + + lista = driver.current_url.split('/') + + url = lista[0]+'//'+lista[2]+'/pandora_console' + + driver.get(url) + + create_wmi_component(driver,plugin_component_name,"Generic numeric","Network Management","Application",max_warning=50,max_critical=100,description="New WMI component") + + search_agent(driver,agent_name,go_to_agent=True) + + driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Manage"]').click() + driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Modules"]').click() + + Select(driver.find_element_by_id("moduletype")).select_by_visible_text("Create a new WMI server module") + + driver.find_element_by_xpath('//*[@id="main"]/form/table/tbody/tr/td[5]/input').click() + + driver.find_element_by_xpath('//a[contains(.,"Advanced options")]').click() + + Select(driver.find_element_by_id("network_component_group")).select_by_visible_text("Network Management") + + time.sleep(3) + + Select(driver.find_element_by_id("network_component")).select_by_visible_text(plugin_component_name) + + driver.find_element_by_id("submit-crtbutton").click() + + search_module (driver,agent_name,plugin_component_name,go_to_module=False) + + self.assertEqual(plugin_component_name in driver.page_source,True) if __name__ == "__main__": unittest2.main() - - - - diff --git a/tests/console/include/network_components_functions.py b/tests/console/include/network_components_functions.py index de67513dfa..0c387e0d4c 100644 --- a/tests/console/include/network_components_functions.py +++ b/tests/console/include/network_components_functions.py @@ -28,8 +28,7 @@ def create_network_component(driver,name,type_component,group,module_group,min_w driver.find_element_by_id("type").click() Select(driver.find_element_by_id("type")).select_by_visible_text(type_component) - driver.find_element_by_id("id_group").click() - Select(driver.find_element_by_id("id_group")).select_by_visible_text(group) + driver.find_element_by_xpath('//option[contains(.,"'+group+'")]').click() driver.find_element_by_id("id_module_group").click() Select(driver.find_element_by_id("id_module_group")).select_by_visible_text(module_group) @@ -58,6 +57,7 @@ def create_network_component(driver,name,type_component,group,module_group,min_w driver.find_element_by_id("text-max_critical").clear() driver.find_element_by_id("text-max_critical").send_keys(max_critical) + # str_warning and str_critical if type_component supports this type if str_warning != None: driver.find_element_by_id("text-str_warning").click() @@ -95,8 +95,7 @@ def create_plugin_component(driver,name,type_component,group,module_group,min_wa driver.find_element_by_id("type").click() Select(driver.find_element_by_id("type")).select_by_visible_text(type_component) - driver.find_element_by_id("id_group").click() - Select(driver.find_element_by_id("id_group")).select_by_visible_text(group) + driver.find_element_by_xpath('//option[contains(.,"'+group+'")]').click() driver.find_element_by_id("id_module_group").click() Select(driver.find_element_by_id("id_module_group")).select_by_visible_text(module_group) @@ -147,3 +146,71 @@ def create_plugin_component(driver,name,type_component,group,module_group,min_wa driver.find_element_by_id("submit-crt").click() +def create_wmi_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,min_critical=None,max_critical=None,str_warning=None,str_critical=None,description=None): + + # type_component is for example -> Generic boolean or Generic numeric incremental (absolute) + + click_menu_element(driver,"Network components") + + driver.find_element_by_xpath('//*[@id="id_component_type"]/option[3]').click() + + driver.find_element_by_id("submit-crt").click() + + driver.find_element_by_id("text-name").click() + driver.find_element_by_id("text-name").clear() + driver.find_element_by_id("text-name").send_keys(name) + + driver.find_element_by_id("type").click() + Select(driver.find_element_by_id("type")).select_by_visible_text(type_component) + + driver.find_element_by_xpath('//option[contains(.,"'+group+'")]').click() + + driver.find_element_by_id("id_module_group").click() + Select(driver.find_element_by_id("id_module_group")).select_by_visible_text(module_group) + + if min_warning != None: + + driver.find_element_by_id("text-min_warning").click() + driver.find_element_by_id("text-min_warning").clear() + driver.find_element_by_id("text-min_warning").send_keys(min_warning) + + if max_warning != None: + + driver.find_element_by_id("text-max_warning").click() + driver.find_element_by_id("text-max_warning").clear() + driver.find_element_by_id("text-max_warning").send_keys(max_warning) + + if min_critical != None: + + driver.find_element_by_id("text-min_critical").click() + driver.find_element_by_id("text-min_critical").clear() + driver.find_element_by_id("text-min_critical").send_keys(min_critical) + + + if max_critical != None: + + driver.find_element_by_id("text-max_critical").click() + driver.find_element_by_id("text-max_critical").clear() + driver.find_element_by_id("text-max_critical").send_keys(max_critical) + + # str_warning and str_critical if type_component is Generic boolean + if str_warning != None: + + driver.find_element_by_id("text-str_warning").click() + driver.find_element_by_id("text-str_warning").clear() + driver.find_element_by_id("text-str_warning").send_keys(str_warning) + + if str_critical != None: + + driver.find_element_by_id("text-str_critical").click() + driver.find_element_by_id("text-str_critical").clear() + driver.find_element_by_id("text-str_critical").send_keys(str_critical) + + if description != None: + + driver.find_element_by_id("textarea_description").click() + driver.find_element_by_id("textarea_description").clear() + driver.find_element_by_id("textarea_description").send_keys(description) + + driver.find_element_by_id("submit-crt").click() + From 33e7e40856701f1e26a30704342d81def6f01dbd Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 27 Sep 2016 12:16:14 +0200 Subject: [PATCH 10/17] ticket Integria: 4070 fixed visual console add custom graph #4070 --- .../reporting/visual_console_builder.editor.js | 4 ++-- .../include/ajax/visual_console_builder.ajax.php | 5 +++-- pandora_console/include/functions_visual_map.php | 6 ++++-- .../include/graphs/functions_pchart.php | 15 ++++++++------- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index e580afd8d5..b4a777d5d6 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -1239,8 +1239,8 @@ function setModuleGraph(id_data) { id_agente_modulo = data['id_agente_modulo']; id_custom_graph = data['id_custom_graph']; label = data['label']; - height = data['height']; - width = data['width']; + height = (data['height'] + 60); + width = (data['width'] + 60); period = data['period']; background_color = data['image']; diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 5ba5a4e059..9631063b6d 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -153,7 +153,7 @@ switch ($action) { if ($id_custom_graph != 0) { $img = custom_graphs_print( $id_custom_graph, $height, $width, $period, - true, true, 0, true, $background_color); + null, true, 0, true, $background_color); } else { $img = grafico_modulo_sparse($id_agent_module, @@ -189,7 +189,8 @@ switch ($action) { case 'get_layout_data': $layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element)); - + $layoutData['height'] = $layoutData['height'] + 60; + $layoutData['width'] = $layoutData['width'] + 60; echo json_encode($layoutData); break; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index f9686953e7..6bdc617829 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -94,8 +94,10 @@ function visual_map_print_item($mode = "read", $layoutData, require_once ($config["homedir"] . '/include/functions_graph.php'); require_once ($config["homedir"] . '/include/functions_custom_graphs.php'); - $width = $layoutData['width']; - $height = $max_percentile = $layoutData['height']; + //add 60 px for visual console map + $width = $layoutData['width'] + 60; + $height = $layoutData['height'] + 60; + $max_percentile = $layoutData['height']; $top = $layoutData['pos_y']; $left = $layoutData['pos_x']; $id = $layoutData['id']; diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index 655f51d047..e54fbafc05 100644 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -691,7 +691,7 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, "Mode"=>SCALE_MODE_START0, "LabelRotation" => 60); $margin_left = 40; $margin_top = 10; - $margin_bottom = 10 * $max_chars; + $margin_bottom = 3 * $max_chars; break; case "hbar": $scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE, @@ -718,13 +718,13 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $myPicture->setGraphArea($margin_left,$margin_top,$width - $water_mark_width,$height-$margin_bottom); $myPicture->drawScale($scaleSettings); - + /* if (isset($legend)) { - /* Write the chart legend */ + /* Write the chart legend $size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); $myPicture->drawLegend($width-$size['Width'],0,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL, "BoxWidth"=>10, "BoxHeight"=>10)); } - + */ /* Turn on shadow computing */ $myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); @@ -1137,8 +1137,9 @@ function pch_bullet_chart($graph_type, $data, $legend, $MyData->setSerieDescription("Labels", __("Agents/Modules")); $height_t = ($height * count($data) ) + 40; - $width_t = ($width + ( 200 + $max_chars)); - $max_chars = graph_get_max_index($legend_values); + $height_t = $height; + $max_chars = graph_get_max_index($legend); + $width_t = ($width + ( 100 + $max_chars)); /* Create the pChart object */ $myPicture = new pImage($width_t, $height_t,$MyData); @@ -1151,7 +1152,7 @@ function pch_bullet_chart($graph_type, $data, $legend, $height_t - 10; /* Draw the scale and chart */ - $myPicture->setGraphArea(220,20,($width + 80), $height_t); + $myPicture->setGraphArea(250,20,($width + 100), $height_t); $myPicture->drawScale(array("Pos"=>SCALE_POS_TOPBOTTOM, "Mode"=>SCALE_MODE_ADDALL_START0, "LabelingMethod"=>LABELING_DIFFERENT, "GridR"=>255, "GridG"=>255, "GridB"=>255, "GridAlpha"=>50, "TickR"=>0,"TickG"=>0, "TickB"=>0, From 71467794885b730fa8a72f21cde64ff09e76a82e Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 27 Sep 2016 12:42:10 +0200 Subject: [PATCH 11/17] Commented out the ACL_tag test. --- tests/console/ACL.py | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/console/ACL.py b/tests/console/ACL.py index 99ddb25539..db4189b914 100644 --- a/tests/console/ACL.py +++ b/tests/console/ACL.py @@ -133,48 +133,48 @@ class ACLTags(PandoraWebDriverTestCase): u"""Create agent and two modules, one without tag and with tag, create a user with tag and check this user can view module with tag and user canĀ“t view module without tag""" - agent_name = gen_random_string(6) - module_name_A = gen_random_string(6) - module_name_B = gen_random_string(6) - user_name = gen_random_string(6) + #agent_name = gen_random_string(6) + #module_name_A = gen_random_string(6) + #module_name_B = gen_random_string(6) + #user_name = gen_random_string(6) - driver = self.driver - self.login() - detect_and_pass_all_wizards(driver) + #driver = self.driver + #self.login() + #detect_and_pass_all_wizards(driver) - create_agent(driver,agent_name,group="Applications",ip="192.168.50.50") + #create_agent(driver,agent_name,group="Applications",ip="192.168.50.50") #We create a module without a tag - create_module("network_server",driver,agent_name=agent_name,module_name=module_name_A,component_group="Network Management",network_component="Host Alive",ip="192.168.50.50") + #create_module("network_server",driver,agent_name=agent_name,module_name=module_name_A,component_group="Network Management",network_component="Host Alive",ip="192.168.50.50") #We now create a modulo with tag "critical" - create_module("network_server",driver,agent_name=agent_name,module_name=module_name_B,component_group="Network Management",network_component="Host Alive",ip="192.168.50.50",tag_name="critical") + #create_module("network_server",driver,agent_name=agent_name,module_name=module_name_B,component_group="Network Management",network_component="Host Alive",ip="192.168.50.50",tag_name="critical") - l = [("Operator (Read)","All",["critical"])] + #l = [("Operator (Read)","All",["critical"])] - create_user(driver,user_name,"pandora",profile_list=l) + #create_user(driver,user_name,"pandora",profile_list=l) - self.logout() + #self.logout() - self.login(user=user_name) + #self.login(user=user_name) - detect_and_pass_all_wizards(driver) + #detect_and_pass_all_wizards(driver) - search_agent(driver,agent_name) + #search_agent(driver,agent_name) - time.sleep(6) + #time.sleep(6) #The user should be able to see the module with Tag - module = driver.find_element_by_xpath('//td[contains(.,"'+module_name_B+'")]') - self.assertIsInstance(module,WebElement) + #module = driver.find_element_by_xpath('//td[contains(.,"'+module_name_B+'")]') + #self.assertIsInstance(module,WebElement) #The user should NOT be able to see the module without tag - modules = driver.find_elements_by_xpath('//td[contains(.,"'+module_name_A+'")]') - self.assertEqual(modules,[]) + #modules = driver.find_elements_by_xpath('//td[contains(.,"'+module_name_A+'")]') + #self.assertEqual(modules,[]) if __name__ == "__main__": unittest2.main() From 626027a3025809cef2a58de8b112a53aa7925fa6 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 27 Sep 2016 15:50:42 +0200 Subject: [PATCH 12/17] fixed minor error in reports alerts tickets: 4063 --- pandora_console/include/functions_reporting.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 43ea87e9bd..d211d95046 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2631,8 +2631,8 @@ function reporting_alert_report_group($report, $content) { $data_row['fired'] = array(); $firedTimes = get_module_alert_fired( - $content['id_agent_module'], - $alert['id_alert_template'], + $alert['id_agent_module'], + $alert['id'], (int) $content['period'], (int) $report["datetime"]); @@ -2739,7 +2739,7 @@ function reporting_alert_report_agent($report, $content) { $data_row['fired'] = array(); $firedTimes = get_module_alert_fired( $alert['id_agent_module'], - $alert['id_alert_template'], + $alert['id'], (int) $content['period'], (int) $report["datetime"]); From 4416785e75666c3929f88f1f599e73b94e0af253 Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 28 Sep 2016 00:01:25 +0200 Subject: [PATCH 13/17] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb.data.oracle.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 1631070da1..13c46629c4 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.1dev-160927 +Version: 6.1dev-160928 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index d3a3df531f..7daca84d92 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.1dev-160927" +pandora_version="6.1dev-160928" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 3f6284ee59..fde3ba6770 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '6.1dev'; -use constant AGENT_BUILD => '160927'; +use constant AGENT_BUILD => '160928'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 7f096bddaf..393b03787f 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.1dev -%define release 160927 +%define release 160928 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index b756a6aedb..9956ee7bff 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.1dev -%define release 160927 +%define release 160928 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index b4c669f892..ee20c148cd 100644 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="6.1dev" -PI_BUILD="160927" +PI_BUILD="160928" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 6e903c3c78..c29cbc5c8a 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{160927} +{160928} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 3d46502de3..4b6e1f1d92 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("6.1dev(Build 160927)") +#define PANDORA_VERSION ("6.1dev(Build 160928)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 5ab81204c1..993851e1a9 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(6.1dev(Build 160927))" + VALUE "ProductVersion", "(6.1dev(Build 160928))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index d8a020f0b8..dce60aeaa1 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.1dev-160927 +Version: 6.1dev-160928 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 22254e6c90..4e87429197 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.1dev-160927" +pandora_version="6.1dev-160928" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 19cf46656e..68cbb1c93e 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC160927'; +$build_version = 'PC160928'; $pandora_version = 'v6.1dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index a078ee42e1..5b051b4fb8 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Wed, 28 Sep 2016 09:37:48 +0200 Subject: [PATCH 14/17] Add test Apply_policy_to_agents_with_spaces in Policies.py --- tests/console/Policies.py | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/console/Policies.py b/tests/console/Policies.py index 2805e31416..049017e413 100644 --- a/tests/console/Policies.py +++ b/tests/console/Policies.py @@ -128,6 +128,59 @@ class Policies(PandoraWebDriverTestCase): module = driver.find_element_by_xpath('//td[contains(.,"'+module_name_2+'")]') self.assertIsInstance(module,WebElement) + @is_enterprise + def test_E_Apply_policy_to_agents_with_spaces(self): + + u""" + Create a policy and two agents with spaces in name, apply policy in this agents and check that this it works + """ + + policy_name = gen_random_string(6) + agent_name_1 = "test agent 1" + agent_name_2 = "test agent 2" + agent_name_3 = "test agent 3" + module_name = gen_random_string(6) + + driver = self.driver + + create_agent(driver,agent_name_1,description="First agent by test") + create_agent(driver,agent_name_2,description="Second agent by test") + create_agent(driver,agent_name_3,description="Third agent by test") + + create_policy(driver,policy_name,"Applications",description="This is policy by test") + + add_module_policy(driver,policy_name,"network_server",driver,module_name=module_name,component_group="Network Management",network_component="Host Alive") + + list_agent = (agent_name_1,agent_name_2,agent_name_3) + apply_policy_to_agent(driver,policy_name,list_agent) + + + search_agent(driver,agent_name_1,go_to_agent=True) + + driver.find_element_by_xpath('//*[@id="menu_tab"]/ul//img[@data-title="Manage"]').click() + driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Modules"]').click() + + module = driver.find_element_by_xpath('//td[contains(.,"'+module_name+'")]') + self.assertIsInstance(module,WebElement) + + + search_agent(driver,agent_name_2,go_to_agent=True) + + driver.find_element_by_xpath('//*[@id="menu_tab"]/ul//img[@data-title="Manage"]').click() + driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Modules"]').click() + + module = driver.find_element_by_xpath('//td[contains(.,"'+module_name+'")]') + self.assertIsInstance(module,WebElement) + + + search_agent(driver,agent_name_3,go_to_agent=True) + + driver.find_element_by_xpath('//*[@id="menu_tab"]/ul//img[@data-title="Manage"]').click() + driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Modules"]').click() + + module = driver.find_element_by_xpath('//td[contains(.,"'+module_name+'")]') + self.assertIsInstance(module,WebElement) + if __name__ == "__main__": unittest2.main() From 6daa28e69a80ec60aa7671e1701724dc8e194738 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 28 Sep 2016 12:24:35 +0200 Subject: [PATCH 15/17] Updates on grep_log 1 data per mathed instance in multiline output (cherry picked from commit 91512d54d96d43fdb085e0a366bd4a9b06ded31a) --- pandora_agents/unix/plugins/grep_log | 38 ++++++++++++++++++---------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/pandora_agents/unix/plugins/grep_log b/pandora_agents/unix/plugins/grep_log index 7661a2951d..495bdc0127 100755 --- a/pandora_agents/unix/plugins/grep_log +++ b/pandora_agents/unix/plugins/grep_log @@ -188,7 +188,10 @@ sub parse_log (;$$) { seek(LOGFILE, $Idx_pos, 0); # Parse log file - my @data; + my %data; + + # Matched line id + my $matched_line = 0; if ( (defined($up_lines)) || (defined($bot_lines)) ){ # Detailed workmode @@ -210,8 +213,9 @@ sub parse_log (;$$) { $flag = 1; # Push upper lines for (my $i = ($curr_line-$up_lines); $i<=$curr_line; $i++){ + if ($i < 0) {next;} if (defined ($lines[$i])) { - push (@data, $lines[$i]); + push (@{$data{$matched_line}}, $lines[$i]); } } @@ -220,16 +224,17 @@ sub parse_log (;$$) { # Push bottom lines for (my $i = ($curr_line+$flag); $i<=($curr_line+$bot_lines); $i++){ if (defined ($lines[$i])) { - push (@data, $lines[$i]); + push (@{$data{$matched_line}}, $lines[$i]); } } } + $matched_line++; } } else { # Standar workmode while ($line = ) { if ($line =~ m/$Reg_exp/i) { - push @data, $line; + push (@{$data{$matched_line++}}, $line); } } } @@ -240,7 +245,7 @@ sub parse_log (;$$) { # Save the index file save_idx(); - return @data; + return \%data; } ############################################################################### @@ -262,11 +267,12 @@ sub print_summary() { # SUB parse_log # Print log data to stdout. ############################################################################### -sub print_log (@) { - my @data = @_; +sub print_log ($) { + my $data = shift; # No data - if ($#data < 0) { + my @kdata = keys (%{$data}); + if ($#kdata < 0) { print_summary() if ($summary_flag == 1); return; } @@ -276,8 +282,8 @@ sub print_log (@) { my $output = "\n"; $output .= "\n"; $output .= "{$line}; } $output .= "]]>"; $output .= "\n"; @@ -292,8 +298,12 @@ sub print_log (@) { $output .= "\n"; $output .= "\n"; $output .= "\n"; - foreach my $line (@data) { - $output .= "\n"; + foreach my $line (@kdata) { + $output .= "{$line}}) { + $output .= $content; + } + $output .= "]]>\n"; } $output .= "\n"; $output .= "\n"; @@ -348,9 +358,9 @@ if (! -e $Idx_file) { load_idx(); # Parse log file -my @data = parse_log($up_lines,$bot_lines); +my $data = parse_log($up_lines,$bot_lines); # Print output to stdout -print_log (@data); +print_log ($data); exit 0; From d98b108443850a14f6b0fcb58cb8b3ca97a62c52 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 28 Sep 2016 12:36:40 +0200 Subject: [PATCH 16/17] Fixed line endings (cherry picked from commit ce90d552bc4282ce38dda7e5ec020e550317267f) --- pandora_agents/unix/plugins/grep_log | 1 - 1 file changed, 1 deletion(-) diff --git a/pandora_agents/unix/plugins/grep_log b/pandora_agents/unix/plugins/grep_log index 495bdc0127..6f606bf4b9 100755 --- a/pandora_agents/unix/plugins/grep_log +++ b/pandora_agents/unix/plugins/grep_log @@ -19,7 +19,6 @@ # GNU General Public License for more details. # ############################################################################### - use strict; use File::Basename; From 00519707ba42a44ed768ca724b09fa627fde76e3 Mon Sep 17 00:00:00 2001 From: cesar991 Date: Wed, 28 Sep 2016 12:53:30 +0200 Subject: [PATCH 17/17] Add test alert and new functions in alert_functions.py --- tests/console/Alerts.py | 43 ++++++++++++++++++ tests/console/include/alert_functions.py | 56 ++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 tests/console/Alerts.py diff --git a/tests/console/Alerts.py b/tests/console/Alerts.py new file mode 100644 index 0000000000..c94e0e64c1 --- /dev/null +++ b/tests/console/Alerts.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +from include.common_classes_60 import PandoraWebDriverTestCase +from include.common_functions_60 import login, click_menu_element, refresh_N_times_until_find_element, detect_and_pass_all_wizards, is_element_present, logout +from include.alert_functions import * +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.support.ui import Select +from selenium.common.exceptions import StaleElementReferenceException, NoSuchElementException +from selenium.common.exceptions import NoAlertPresentException +from selenium.webdriver.remote.webelement import WebElement +import unittest2, time, re + +class Alerts (PandoraWebDriverTestCase): + + test_name = u'Alerts tests' + tickets_associated = [] + + def test_create_new_email_action(self): + + u""" + Create a new alert action using eMail command and check that create ok + """ + + action_name = gen_random_string(6) + + driver = self.driver + self.login() + detect_and_pass_all_wizards(driver) + + create_new_action_to_alert(driver,action_name,"Applications","eMail",field1="prueba@prueba.com",field2="Test",field3="This is a test") + + element = driver.find_element_by_xpath('//td[contains(.,"Successfully created")]') + self.assertIsInstance(element,WebElement) + + click_menu_element(driver,"Actions") + + element = driver.find_element_by_xpath('//a[contains(.,"'+action_name+'")]') + self.assertIsInstance(element,WebElement) + +if __name__ == "__main__": + unittest2.main() + diff --git a/tests/console/include/alert_functions.py b/tests/console/include/alert_functions.py index e61a29eea7..1d2c1f19a3 100644 --- a/tests/console/include/alert_functions.py +++ b/tests/console/include/alert_functions.py @@ -31,6 +31,62 @@ def force_alert_of_module(driver,agent_name,module_name,template_name): time.sleep(10) +def create_new_action_to_alert(driver,action_name,action_group,command,threshold=None,field1=None,field2=None,field3=None): + + click_menu_element(driver,"Actions") + driver.find_element_by_id("submit-create").click() + + driver.find_element_by_id("text-name").clear() + driver.find_element_by_id("text-name").send_keys(action_name) + + driver.find_element_by_xpath('//option[contains(.,"'+action_group+'")]').click() + + driver.find_element_by_xpath('//option[contains(.,"'+command+'")]').click() + + if threshold != None: + + driver.find_element_by_id("text-action_threshold").clear() + driver.find_element_by_id("text-action_threshold").send_keys(threshold) + + if command == "eMail" and field1 != None and field2 != None and field3 != None: + + driver.find_element_by_id("textarea_field1_value").clear() + driver.find_element_by_id("textarea_field1_value").send_keys(field1) + + driver.find_element_by_id("textarea_field2_value").clear() + driver.find_element_by_id("textarea_field2_value").send_keys(field2) + + driver.find_element_by_id("textarea_field3_value").clear() + driver.find_element_by_id("textarea_field3_value").send_keys(field3) + driver.find_element_by_id("submit-create").click() + + +def create_new_command_to_alert(driver,command_name,command,list_field_description,list_field_values,description=None): + + click_menu_element(driver,"Commands") + driver.find_element_by_id("submit-create").click() + + driver.find_element_by_id("text-name").clear() + Select(driver.find_element_by_id("text-name")).send_keys(command_name) + + driver.find_element_by_id("textarea_command").clear() + Select(driver.find_element_by_id("textarea_command")).send_keys(command) + + if description != None: + + driver.find_element_by_id("textarea_description").clear() + Select(driver.find_element_by_id("textarea_description")).send_keys(description) + i=1 + for field_description in list_field_description: + driver.find_element_by_id("text-field"+i+"_description").clear() + Select(driver.find_element_by_id("text-field"+i+"_description")).send_keys(field_description) + + i=1 + for field_value in list_field_values: + driver.find_element_by_id("text-field"+i+"_description").clear() + Select(driver.find_element_by_id("text-field"+i+"_description")).send_keys(field_value) + + driver.find_element_by_id("submit-create").click()