Merge branch 'pandora_6.0' of https://github.com/pandorafms/pandorafms into pandora_6.0

This commit is contained in:
fermin831 2016-06-15 15:35:39 +02:00
commit 4472fc727b
32 changed files with 178 additions and 31 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 6.0SP2-160614 Version: 6.0SP2-160615
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="6.0SP2-160614" pandora_version="6.0SP2-160615"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '6.0SP2'; use constant AGENT_VERSION => '6.0SP2';
use constant AGENT_BUILD => '160614'; use constant AGENT_BUILD => '160615';
# Commands to retrieve total memory information in kB # Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => { use constant TOTALMEMORY_CMDS => {

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 6.0SP2 %define version 6.0SP2
%define release 160614 %define release 160615
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 6.0SP2 %define version 6.0SP2
%define release 160614 %define release 160615
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="6.0SP2" PI_VERSION="6.0SP2"
PI_BUILD="160614" PI_BUILD="160615"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{160614} {160615}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("6.0SP2(Build 160614)") #define PANDORA_VERSION ("6.0SP2(Build 160615)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(6.0SP2(Build 160614))" VALUE "ProductVersion", "(6.0SP2(Build 160615))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 6.0SP2-160614 Version: 6.0SP2-160615
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="6.0SP2-160614" pandora_version="6.0SP2-160615"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -64,7 +64,6 @@ UPDATE `talert_commands` SET `fields_descriptions` = '[\"Destination addres
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
INSERT INTO `tconfig` (`token`, `value`) VALUES ('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}');
UPDATE `tconfig` SET value = 'v6.0dev' WHERE token = 'db_scheme_version'; UPDATE `tconfig` SET value = 'v6.0dev' WHERE token = 'db_scheme_version';
--UPDATE `tconfig` SET value = 'https://artica.es/pandoraupdate6/server.php' WHERE token = 'url_update_manager';
UPDATE `tconfig` SET value = 'https://firefly.artica.es/pandoraupdate6/server.php' WHERE token = 'url_update_manager'; UPDATE `tconfig` SET value = 'https://firefly.artica.es/pandoraupdate6/server.php' WHERE token = 'url_update_manager';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------

View File

@ -64,7 +64,6 @@ UPDATE talert_commands SET fields_descriptions = '["Destination address","S
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
INSERT INTO tconfig (token, value) VALUES ('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'); INSERT INTO tconfig (token, value) VALUES ('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}');
UPDATE tconfig SET value = 'v6.0dev' WHERE token = 'db_scheme_version'; UPDATE tconfig SET value = 'v6.0dev' WHERE token = 'db_scheme_version';
--UPDATE tconfig SET value = 'https://artica.es/pandoraupdate6/server.php' WHERE token='url_update_manager';
UPDATE tconfig SET value = 'https://firefly.artica.es/pandoraupdate6/server.php' WHERE token='url_update_manager'; UPDATE tconfig SET value = 'https://firefly.artica.es/pandoraupdate6/server.php' WHERE token='url_update_manager';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC160614'; $build_version = 'PC160615';
$pandora_version = 'v6.0SP2'; $pandora_version = 'v6.0SP2';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -63,7 +63,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '6.0SP2'; $version = '6.0SP2';
$build = '160614'; $build = '160615';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -587,6 +587,12 @@ if (!empty ($table->data)) {
} }
else { else {
ui_print_info_message ( array ( 'no_close' => true, 'message' => __('There are no defined agents') ) ); ui_print_info_message ( array ( 'no_close' => true, 'message' => __('There are no defined agents') ) );
echo '<div style="text-align: right; float: right;">';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
html_print_input_hidden ('new_agent', 1);
html_print_submit_button (__('Create agent'), 'crt', false, 'class="sub next"');
echo "</form>";
echo '</div>';
} }
?> ?>

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 6.0SP2 %define version 6.0SP2
%define release 160614 %define release 160615
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 6.0SP2 %define version 6.0SP2
%define release 160614 %define release 160615
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -65,7 +65,7 @@ INSERT INTO tconfig (token, value) VALUES ('graph_res','5');
INSERT INTO tconfig (token, value) VALUES ('step_compact','1'); INSERT INTO tconfig (token, value) VALUES ('step_compact','1');
INSERT INTO tconfig (token, value) VALUES ('db_scheme_first_version','6.0orc'); INSERT INTO tconfig (token, value) VALUES ('db_scheme_first_version','6.0orc');
INSERT INTO tconfig (token, value) VALUES('db_scheme_version','6.0SP2'); INSERT INTO tconfig (token, value) VALUES('db_scheme_version','6.0SP2');
INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD160614'); INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD160615');
INSERT INTO tconfig (token, value) VALUES ('show_unknown','0'); INSERT INTO tconfig (token, value) VALUES ('show_unknown','0');
INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1'); INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1');
INSERT INTO tconfig (token, value) VALUES ('style','pandora'); INSERT INTO tconfig (token, value) VALUES ('style','pandora');

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 6.0SP2-160614 Version: 6.0SP2-160615
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="6.0SP2-160614" pandora_version="6.0SP2-160615"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "6.0SP2"; my $pandora_version = "6.0SP2";
my $pandora_build = "160614"; my $pandora_build = "160615";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 6.0SP2 %define version 6.0SP2
%define release 160614 %define release 160615
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 6.0SP2 %define version 6.0SP2
%define release 160614 %define release 160615
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="6.0SP2" PI_VERSION="6.0SP2"
PI_BUILD="160614" PI_BUILD="160615"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -1109,6 +1109,31 @@ sub get_group_id {
return $data[0]; return $data[0];
} }
################################################################################
## SUB get_module_group_id
## Get the id of a module_group given its name.
################################################################################
sub get_module_group_id {
my $name = $_[0];
my $sth;
my @data;
# SQL Get group id
$sth = $dbh->prepare ("SELECT id_mg FROM tmodule_group WHERE name = ?") || die ("Error preparing statement: " . $sth->errstr);
$sth->execute ($name) || die ("Error executing statement: " . $sth->errstr);
# Group not found
if ($sth->rows == 0) {
return -1;
}
@data = $sth->fetchrow_array ();
# Return id
return $data[0];
}
################################################################################ ################################################################################
## SUB get_module_id ## SUB get_module_id
## Get the id of a module given its name and the id of the host. ## Get the id of a module given its name and the id of the host.

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "6.0SP2 PS160614"; my $version = "6.0SP2 PS160615";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -35,7 +35,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "6.0SP2 PS160614"; my $version = "6.0SP2 PS160615";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -127,6 +127,7 @@ sub help_screen{
help_screen_line('--create_network_module', "<module_name> <module_type> <agent_name> <module_address> \n\t [<module_port> <description> <module_group> <min> <max> <post_process> <interval> \n\t <warning_min> <warning_max> <critical_min> <critical_max> <history_data> <ff_threshold>\n\t <warning_str> <critical_str> <unknown_events> <each_ff>\n\t <ff_threshold_normal> <ff_threshold_warning> <ff_threshold_critical> <timeout> <retries>]", 'Add not snmp network module to agent'); help_screen_line('--create_network_module', "<module_name> <module_type> <agent_name> <module_address> \n\t [<module_port> <description> <module_group> <min> <max> <post_process> <interval> \n\t <warning_min> <warning_max> <critical_min> <critical_max> <history_data> <ff_threshold>\n\t <warning_str> <critical_str> <unknown_events> <each_ff>\n\t <ff_threshold_normal> <ff_threshold_warning> <ff_threshold_critical> <timeout> <retries>]", 'Add not snmp network module to agent');
help_screen_line('--create_snmp_module', "<module_name> <module_type> <agent_name> <module_address> <module_port>\n\t <version> [<community> <oid> <description> <module_group> <min> <max> <post_process> <interval>\n\t <warning_min> <warning_max> <critical_min> <critical_max> <history_data> \n\t <snmp3_priv_method> <snmp3_priv_pass> <snmp3_sec_level> <snmp3_auth_method> \n\t <snmp3_auth_user> <snmp3_priv_pass> <ff_threshold> <warning_str> \n\t <critical_str> <unknown_events> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <timeout> <retries>]", 'Add snmp network module to agent'); help_screen_line('--create_snmp_module', "<module_name> <module_type> <agent_name> <module_address> <module_port>\n\t <version> [<community> <oid> <description> <module_group> <min> <max> <post_process> <interval>\n\t <warning_min> <warning_max> <critical_min> <critical_max> <history_data> \n\t <snmp3_priv_method> <snmp3_priv_pass> <snmp3_sec_level> <snmp3_auth_method> \n\t <snmp3_auth_user> <snmp3_priv_pass> <ff_threshold> <warning_str> \n\t <critical_str> <unknown_events> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <timeout> <retries>]", 'Add snmp network module to agent');
help_screen_line('--create_plugin_module', "<module_name> <module_type> <agent_name> <module_address> \n\t <module_port> <plugin_name> <user> <password> <parameters> [<description> \n\t <module_group> <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> \n\t <critical_max> <history_data> <ff_threshold> <warning_str> <critical_str>\n\t <unknown_events> <each_ff> <ff_threshold_normal> <ff_threshold_warning>\n\t <ff_threshold_critical> <timeout>]", 'Add plug-in module to agent'); help_screen_line('--create_plugin_module', "<module_name> <module_type> <agent_name> <module_address> \n\t <module_port> <plugin_name> <user> <password> <parameters> [<description> \n\t <module_group> <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> \n\t <critical_max> <history_data> <ff_threshold> <warning_str> <critical_str>\n\t <unknown_events> <each_ff> <ff_threshold_normal> <ff_threshold_warning>\n\t <ff_threshold_critical> <timeout>]", 'Add plug-in module to agent');
help_screen_line('--create_module_group', '<module_group_name>');
help_screen_line('--delete_module', 'Delete module from agent', '<module_name> <agent_name>'); help_screen_line('--delete_module', 'Delete module from agent', '<module_name> <agent_name>');
help_screen_line('--data_module', "<server_name> <agent_name> <module_name> \n\t <module_type> <module_new_data> [<datetime>]", 'Insert data to module'); help_screen_line('--data_module', "<server_name> <agent_name> <module_name> \n\t <module_type> <module_new_data> [<datetime>]", 'Insert data to module');
help_screen_line('--get_module_data', "<agent_name> <module_name> <interval> [<csv_separator>]", "\n\t Show the data of a module in the last X seconds (interval) in CSV format"); help_screen_line('--get_module_data', "<agent_name> <module_name> <interval> [<csv_separator>]", "\n\t Show the data of a module in the last X seconds (interval) in CSV format");
@ -178,10 +179,13 @@ sub help_screen{
help_screen_line('--add_agent_to_policy', '<agent_name> <policy_name>', 'Add an agent to a policy'); help_screen_line('--add_agent_to_policy', '<agent_name> <policy_name>', 'Add an agent to a policy');
help_screen_line('--delete_not_policy_modules', '', 'Delete all modules without policy from configuration file'); help_screen_line('--delete_not_policy_modules', '', 'Delete all modules without policy from configuration file');
help_screen_line('--disable_policy_alerts', '<policy_name>', 'Disable all the alerts of a policy'); help_screen_line('--disable_policy_alerts', '<policy_name>', 'Disable all the alerts of a policy');
help_screen_line('--create_policy', '<policy_name> <group_name> <description>');
help_screen_line('--create_policy_data_module', "<policy_name> <module_name> <module_type> [<description> \n\t <module_group> <min> <max> <post_process> <interval> <warning_min> <warning_max> \n\t <critical_min> <critical_max> <history_data> <data_configuration> <warning_str> \n\t <critical_str> <unknown_events> <ff_threshold> <each_ff>\n\t <ff_threshold_normal> <ff_threshold_warning> <ff_threshold_critical>\n\t <ff_timeout>]", 'Add data server module to policy'); help_screen_line('--create_policy_data_module', "<policy_name> <module_name> <module_type> [<description> \n\t <module_group> <min> <max> <post_process> <interval> <warning_min> <warning_max> \n\t <critical_min> <critical_max> <history_data> <data_configuration> <warning_str> \n\t <critical_str> <unknown_events> <ff_threshold> <each_ff>\n\t <ff_threshold_normal> <ff_threshold_warning> <ff_threshold_critical>\n\t <ff_timeout>]", 'Add data server module to policy');
help_screen_line('--create_policy_network_module', "<policy_name> <module_name> <module_type> [<module_port> \n\t <description> <module_group> <min> <max> <post_process> <interval> \n\t <warning_min> <warning_max> <critical_min> <critical_max> <history_data> <ff_threshold> \n\t <warning_str> <critical_str> <unknown_events> <each_ff>\n\t <ff_threshold_normal> <ff_threshold_warning> <ff_threshold_critical>]", "Add not snmp network module to policy"); help_screen_line('--create_policy_network_module', "<policy_name> <module_name> <module_type> [<module_port> \n\t <description> <module_group> <min> <max> <post_process> <interval> \n\t <warning_min> <warning_max> <critical_min> <critical_max> <history_data> <ff_threshold> \n\t <warning_str> <critical_str> <unknown_events> <each_ff>\n\t <ff_threshold_normal> <ff_threshold_warning> <ff_threshold_critical>]", "Add not snmp network module to policy");
help_screen_line('--create_policy_snmp_module', "<policy_name> <module_name> <module_type> <module_port> \n\t <version> [<community> <oid> <description> <module_group> <min> <max> \n\t <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> <history_data>\n\t <snmp3_priv_method> <snmp3_priv_pass> <snmp3_sec_level> <snmp3_auth_method> <snmp3_auth_user> \n\t <snmp3_priv_pass> <ff_threshold> <warning_str> <critical_str>\n\t <unknown_events> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical>]", 'Add snmp network module to policy'); help_screen_line('--create_policy_snmp_module', "<policy_name> <module_name> <module_type> <module_port> \n\t <version> [<community> <oid> <description> <module_group> <min> <max> \n\t <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> <history_data>\n\t <snmp3_priv_method> <snmp3_priv_pass> <snmp3_sec_level> <snmp3_auth_method> <snmp3_auth_user> \n\t <snmp3_priv_pass> <ff_threshold> <warning_str> <critical_str>\n\t <unknown_events> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical>]", 'Add snmp network module to policy');
help_screen_line('--create_policy_plugin_module', "<policy_name> <module_name> <module_type> \n\t <module_port> <plugin_name> <user> <password> <parameters> [<description> <module_group> <min> \n\t <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max>\n\t <history_data> <ff_threshold> <warning_str> <critical_str>\n\t <unknown_events> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical>]", 'Add plug-in module to policy'); help_screen_line('--create_policy_plugin_module', "<policy_name> <module_name> <module_type> \n\t <module_port> <plugin_name> <user> <password> <parameters> [<description> <module_group> <min> \n\t <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max>\n\t <history_data> <ff_threshold> <warning_str> <critical_str>\n\t <unknown_events> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical>]", 'Add plug-in module to policy');
help_screen_line('--create_policy_data_module_from_local_component', '<policy_name> <component_name>');
help_screen_line('--add_collection_to_policy', "<policy_name> <collection_name>");
help_screen_line('--validate_policy_alerts', '<policy_name>', 'Validate the alerts of a given policy'); help_screen_line('--validate_policy_alerts', '<policy_name>', 'Validate the alerts of a given policy');
help_screen_line('--get_policy_modules', '<policy_name>', 'Get the modules of a policy'); help_screen_line('--get_policy_modules', '<policy_name>', 'Get the modules of a policy');
help_screen_line('--get_policies', '[<agent_name>]', "Get all the policies (without parameters) or \n\tthe policies of a given agent (agent name as parameter)"); help_screen_line('--get_policies', '[<agent_name>]', "Get all the policies (without parameters) or \n\tthe policies of a given agent (agent name as parameter)");
@ -1291,6 +1295,19 @@ sub cli_create_data_module($) {
} }
} }
##############################################################################
# Create module group.
# Related option: --create_module_group
##############################################################################
sub cli_create_module_group () {
my $module_group_name = @ARGV[2];
my $id_module_group = get_module_group_id($dbh, $module_group_name);
non_exist_check($id_module_group,'group',$module_group_name);
db_insert ($dbh, 'id_mg', 'INSERT INTO tmodule_group (name) VALUES (?)', safe_input($module_group_name));
}
############################################################################## ##############################################################################
# Create network module from component. # Create network module from component.
# Related option: --create_network_module_from_component # Related option: --create_network_module_from_component
@ -4370,6 +4387,10 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 27, 24); param_check($ltotal, 27, 24);
cli_create_data_module(0); cli_create_data_module(0);
} }
elsif ($param eq '--create_module_group') {
param_check($ltotal, 1, 1);
cli_create_module_group();
}
elsif ($param eq '--create_network_module') { elsif ($param eq '--create_network_module') {
param_check($ltotal, 26, 20); param_check($ltotal, 26, 20);
cli_create_network_module(0); cli_create_network_module(0);
@ -4490,6 +4511,18 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 4, 1); param_check($ltotal, 4, 1);
cli_module_get_data(); cli_module_get_data();
} }
elsif ($param eq '--add_collection_to_policy') {
param_check($ltotal, 2, 2);
cli_add_collection_to_policy();
}
elsif ($param eq '--create_policy_data_module_from_local_component') {
param_check($ltotal, 2, 2);
cli_create_policy_data_module_from_local_component();
}
elsif ($param eq '--create_policy') {
param_check($ltotal, 3, 2);
cli_create_policy();
}
elsif ($param eq '--create_policy_data_module') { elsif ($param eq '--create_policy_data_module') {
param_check($ltotal, 23, 20); param_check($ltotal, 23, 20);
cli_create_data_module(1); cli_create_data_module(1);
@ -4790,6 +4823,43 @@ sub pandora_get_local_component_id($$) {
return defined ($lc_id) ? $lc_id : -1; return defined ($lc_id) ? $lc_id : -1;
} }
##############################################################################
# Create policy
# Related option: --create_policy
##############################################################################
sub cli_create_policy () {
my ($policy_name, $group_name, $description) = @ARGV[2..4];
my $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]);
non_exist_check($policy_id,'policy',$policy_name);
my $id_group = get_group_id($dbh,$group_name);
exist_check($id_group,'group',$group_name);
my $id = enterprise_hook('create_policy',[$dbh, safe_input($policy_name), safe_input($description), $id_group]);
return $id;
}
##############################################################################
# Add collection to a policy
# Related option: --add_collection_to_policy
##############################################################################
sub cli_add_collection_to_policy () {
my ($policy_name, $collection_name) = @ARGV[2..3];
my $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]);
exist_check($policy_id,'policy',$policy_name);
my $collection_id = enterprise_hook('get_collection_id',[$dbh, safe_input($collection_name)]);
exist_check($collection_id,'group',$collection_name);
my $id = enterprise_hook('add_collection_to_policy_db',[$dbh, $policy_id, $collection_id]);
return $id;
}
############################################################################## ##############################################################################
# Create data module from local component. # Create data module from local component.
# Related option: --create_data_module_from_local_component # Related option: --create_data_module_from_local_component
@ -4814,6 +4884,25 @@ sub cli_create_data_module_from_local_component() {
enterprise_hook('pandora_create_module_from_local_component',[$conf, $component, $agent_id, $dbh]); enterprise_hook('pandora_create_module_from_local_component',[$conf, $component, $agent_id, $dbh]);
} }
##############################################################################
# Create policy data module from local component.
# Related option: --create_policy_data_module_from_local_component
##############################################################################
sub cli_create_policy_data_module_from_local_component() {
my ($policy_name, $component_name) = @ARGV[2..3];
my $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]);
exist_check($policy_id,'policy',$policy_name);
my $lc_id = pandora_get_local_component_id($dbh, $component_name);
exist_check($lc_id,'local component',$component_name);
# Get local component data
my $component = get_db_single_row ($dbh, 'SELECT * FROM tlocal_component WHERE id = ?', $lc_id);
enterprise_hook('pandora_create_policy_data_module_from_local_component',[$conf, $component, $policy_id, $dbh]);
}
############################################################################## ##############################################################################
# Create local component. # Create local component.
# Related option: --create_local_component # Related option: --create_local_component

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from include.common_classes_60 import PandoraWebDriverTestCase from include.common_classes_60 import PandoraWebDriverTestCase
from include.common_functions_60 import login, click_menu_element from include.common_functions_60 import login, click_menu_element, detect_and_pass_all_wizards
from selenium import webdriver from selenium import webdriver
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.keys import Keys
@ -17,6 +17,7 @@ class PAN1(PandoraWebDriverTestCase):
def test_pan1(self): def test_pan1(self):
driver = self.driver driver = self.driver
login(driver,"admin","pandora",self.base_url) login(driver,"admin","pandora",self.base_url)
detect_and_pass_all_wizards(driver)
click_menu_element(driver,"General Setup") click_menu_element(driver,"General Setup")
self.assertEqual("IP list with API access", driver.find_element_by_id("table2-15-0").text) self.assertEqual("IP list with API access", driver.find_element_by_id("table2-15-0").text)

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from include.common_classes_60 import PandoraWebDriverTestCase from include.common_classes_60 import PandoraWebDriverTestCase
from include.common_functions_60 import login, click_menu_element from include.common_functions_60 import login, click_menu_element, detect_and_pass_all_wizards
from selenium import webdriver from selenium import webdriver
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.keys import Keys
@ -12,11 +12,12 @@ import unittest, time, re
class PAN2(PandoraWebDriverTestCase): class PAN2(PandoraWebDriverTestCase):
test_name = u'PAN_2' test_name = u'PAN_2'
test_description = u'Creation two agents and delete this agents using bulk operation' test_description = u'Creation two agents and delete this agents using bulk operation'
tickets_associated = [] tickets_associated = [3831]
def test_pan2(self): def test_pan2(self):
driver = self.driver driver = self.driver
login(driver,"admin","pandora",self.base_url) login(driver,"admin","pandora",self.base_url)
detect_and_pass_all_wizards(driver)
click_menu_element(driver,"Agent detail") click_menu_element(driver,"Agent detail")
driver.find_element_by_id("submit-crt").click() driver.find_element_by_id("submit-crt").click()
driver.find_element_by_id("text-agente").click() driver.find_element_by_id("text-agente").click()

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from include.common_classes_60 import PandoraWebDriverTestCase from include.common_classes_60 import PandoraWebDriverTestCase
from include.common_functions_60 import login, click_menu_element, refresh_N_times_until_find_element from include.common_functions_60 import login, click_menu_element, refresh_N_times_until_find_element, detect_and_pass_all_wizards
from selenium import webdriver from selenium import webdriver
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.keys import Keys
@ -18,6 +18,7 @@ class PAN3(PandoraWebDriverTestCase):
def test_pan3(self): def test_pan3(self):
driver = self.driver driver = self.driver
login(driver,"admin","pandora",self.base_url) login(driver,"admin","pandora",self.base_url)
detect_and_pass_all_wizards(driver)
click_menu_element(driver,"Agent detail") click_menu_element(driver,"Agent detail")
driver.find_element_by_id("submit-crt").click() driver.find_element_by_id("submit-crt").click()
driver.find_element_by_id("text-agente").click() driver.find_element_by_id("text-agente").click()

View File

@ -64,3 +64,29 @@ def is_element_present(driver, how, what):
try: driver.find_element(by=how, value=what) try: driver.find_element(by=how, value=what)
except NoSuchElementException: return False except NoSuchElementException: return False
return True return True
def detect_and_pass_pandorin(driver):
if is_element_present(driver,By.NAME,'clippy_is_annoying'):
driver.find_element_by_id('checkbox-clippy_is_annoying').click()
driver.find_element_by_class_name('introjs-skipbutton').click()
alert = driver.switch_to_alert()
alert.accept()
def detect_and_pass_initial_wizard(driver):
#We need to distinguish between the REQUIRED wizard
if is_element_present(driver,By.ID,'login_id_dialog'):
driver.find_element_by_id('text-email').clear()
driver.find_element_by_id('text-email').send_keys("test@pandora.com")
driver.find_element_by_id('submit-id_dialog_button').click()
def detect_and_pass_newsletter_wizard(driver):
if is_element_present(driver,By.ID,'login_accept_register'):
driver.find_element_by_id('submit-finish_dialog_button').click()
driver.find_element_by_id('submit-yes_registration').click()
def detect_and_pass_all_wizards(driver):
detect_and_pass_pandorin(driver)
detect_and_pass_initial_wizard(driver)
detect_and_pass_newsletter_wizard(driver)