diff --git a/pandora_console/extras/mr/13.sql b/pandora_console/extras/mr/13.sql index ccf8b35725..92a88e037d 100644 --- a/pandora_console/extras/mr/13.sql +++ b/pandora_console/extras/mr/13.sql @@ -12,6 +12,27 @@ START TRANSACTION; INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`) VALUES (21, 'Cluster', 'Cluster agent', 'so_cluster.png'); + CREATE TABLE IF NOT EXISTS `tprovisioning`( + `id` int unsigned NOT NULL auto_increment, + `name` varchar(100) NOT NULL, + `description` TEXT default '', + `order` int(11) NOT NULL default 0, + `config` TEXT default '', + PRIMARY KEY (`id`) + ) engine=InnoDB DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `tprovisioning_rules`( + `id` int unsigned NOT NULL auto_increment, + `id_provisioning` int unsigned NOT NULL, + `order` int(11) NOT NULL default 0, + `operator` enum('AND','OR') default 'OR', + `type` enum('alias','ip-range') default 'alias', + `value` varchar(100) NOT NULL default '', + PRIMARY KEY (`id`), + FOREIGN KEY (`id_provisioning`) REFERENCES tprovisioning(`id`) + ON DELETE CASCADE + ) engine=InnoDB DEFAULT CHARSET=utf8; + create table IF NOT EXISTS `tmigration_queue`( `id` int unsigned not null auto_increment, `id_source_agent` int unsigned not null, @@ -37,4 +58,4 @@ START TRANSACTION; ON UPDATE CASCADE ) engine=InnoDB DEFAULT CHARSET=utf8; -COMMIT; \ No newline at end of file +COMMIT; diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 67c6847423..7944a5d4e3 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1534,6 +1534,32 @@ create table IF NOT EXISTS `tcluster_agent`( ON UPDATE CASCADE ) engine=InnoDB DEFAULT CHARSET=utf8; +-- --------------------------------------------------------------------- +-- Table `tprovisioning` +-- --------------------------------------------------------------------- +create table IF NOT EXISTS `tprovisioning`( + `id` int unsigned NOT NULL auto_increment, + `name` varchar(100) NOT NULL, + `description` TEXT default '', + `order` int(11) NOT NULL default 0, + `config` TEXT default '', + PRIMARY KEY (`id`) +) engine=InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `tprovisioning_rules` +-- --------------------------------------------------------------------- +create table IF NOT EXISTS `tprovisioning_rules`( + `id` int unsigned NOT NULL auto_increment, + `id_provisioning` int unsigned NOT NULL, + `order` int(11) NOT NULL default 0, + `operator` enum('AND','OR') default 'OR', + `type` enum('alias','ip-range') default 'alias', + `value` varchar(100) NOT NULL default '', + PRIMARY KEY (`id`), + FOREIGN KEY (`id_provisioning`) REFERENCES tprovisioning(`id`) + ON DELETE CASCADE +) engine=InnoDB DEFAULT CHARSET=utf8; -- --------------------------------------------------------------------- -- Table `tmigration_queue` @@ -1567,4 +1593,3 @@ create table IF NOT EXISTS `tmigration_module_queue`( ON DELETE CASCADE ON UPDATE CASCADE ) engine=InnoDB DEFAULT CHARSET=utf8; - diff --git a/pandora_console/images/toggle_green.png b/pandora_console/images/toggle_green.png new file mode 100644 index 0000000000..b5df607290 Binary files /dev/null and b/pandora_console/images/toggle_green.png differ diff --git a/pandora_console/images/toggle_red.png b/pandora_console/images/toggle_red.png new file mode 100644 index 0000000000..639f82fe21 Binary files /dev/null and b/pandora_console/images/toggle_red.png differ diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index a02660b431..678f649a6a 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1931,7 +1931,7 @@ CREATE TABLE IF NOT EXISTS `tupdate_journal` ( -- --------------------------------------------------------------------- -- Table `talert_snmp_action` -- --------------------------------------------------------------------- -CREATE TABLE IF NOT EXISTS `talert_snmp_action` ( +CREATE TABLE IF NOT EXISTS `talert_snmp_action` ( `id` int(10) unsigned NOT NULL auto_increment, `id_alert_snmp` int(10) unsigned NOT NULL default '0', `alert_type` int(2) unsigned NOT NULL default '0', @@ -1956,7 +1956,7 @@ CREATE TABLE IF NOT EXISTS `talert_snmp_action` ( -- --------------------------------------------------------------------- -- Table `tsessions_php` -- --------------------------------------------------------------------- -CREATE TABLE tsessions_php ( +CREATE TABLE IF NOT EXISTS `tsessions_php` ( `id_session` CHAR(52) NOT NULL, `last_active` INTEGER NOT NULL, `data` TEXT, @@ -3081,6 +3081,33 @@ create table IF NOT EXISTS `tcluster_agent`( ON UPDATE CASCADE ) engine=InnoDB DEFAULT CHARSET=utf8; +-- --------------------------------------------------------------------- +-- Table `tprovisioning` +-- --------------------------------------------------------------------- +create table IF NOT EXISTS `tprovisioning`( + `id` int unsigned NOT NULL auto_increment, + `name` varchar(100) NOT NULL, + `description` TEXT default '', + `order` int(11) NOT NULL default 0, + `config` TEXT default '', + PRIMARY KEY (`id`) +) engine=InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `tprovisioning_rules` +-- --------------------------------------------------------------------- +create table IF NOT EXISTS `tprovisioning_rules`( + `id` int unsigned NOT NULL auto_increment, + `id_provisioning` int unsigned NOT NULL, + `order` int(11) NOT NULL default 0, + `operator` enum('AND','OR') default 'OR', + `type` enum('alias','ip-range') default 'alias', + `value` varchar(100) NOT NULL default '', + PRIMARY KEY (`id`), + FOREIGN KEY (`id_provisioning`) REFERENCES tprovisioning(`id`) + ON DELETE CASCADE +) engine=InnoDB DEFAULT CHARSET=utf8; + -- --------------------------------------------------------------------- -- Table `tmigration_queue` -- --------------------------------------------------------------------- @@ -3113,4 +3140,3 @@ create table IF NOT EXISTS `tmigration_module_queue`( ON DELETE CASCADE ON UPDATE CASCADE ) engine=InnoDB DEFAULT CHARSET=utf8; - diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server index 1f13627cb3..6a5c979c7d 100755 --- a/pandora_server/bin/pandora_server +++ b/pandora_server/bin/pandora_server @@ -359,6 +359,7 @@ sub pandora_server_tasks ($) { # Pandora self monitoring if (defined($pa_config->{"self_monitoring"}) && $pa_config->{"self_monitoring"} == 1 + && !is_metaconsole($pa_config) && $counter % $pa_config->{'self_monitoring_interval'} == 0) { pandora_self_monitoring ($pa_config, $dbh); } diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 9e9bd92d14..3f981c2946 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -171,6 +171,8 @@ sub pandora_get_sharedconfig ($$) { # NOTE: This must be read when checking license limits! #$pa_config->{"node_metaconsole"} = pandora_get_tconfig_token ($dbh, 'node_metaconsole', 0); + $pa_config->{"provisioning_mode"} = pandora_get_tconfig_token ($dbh, 'provisioning_mode', ''); + if ($pa_config->{'include_agents'} eq '') { $pa_config->{'include_agents'} = 0; @@ -473,6 +475,10 @@ sub pandora_load_config { $pa_config->{"unknown_updates"} = 0; # 7.0.718 + $pa_config->{"provisioningserver"} = 1; # 7.0 720 + $pa_config->{"provisioningserver_threads"} = 1; # 7.0 720 + $pa_config->{"provisioning_cache_interval"} = 300; # 7.0 720 + # Check for UID0 if ($pa_config->{"quiet"} != 0){ if ($> == 0){ @@ -1090,6 +1096,15 @@ sub pandora_load_config { elsif ($parametro =~ m/^unknown_updates\s+([0-1])/i) { $pa_config->{'unknown_updates'} = clean_blank($1); } + elsif ($parametro =~ m/^provisioningserver\s+([0-1])/i){ + $pa_config->{'provisioningserver'}= clean_blank($1); + } + elsif ($parametro =~ m/^provisioningserver_threads\s+([0-9]*)/i){ + $pa_config->{'provisioningserver_threads'}= clean_blank($1); + } + elsif ($parametro =~ m/^provisioning_cache_interval\s+([0-9]*)/i){ + $pa_config->{'provisioning_cache_interval'}= clean_blank($1); + } } # end of loop for parameter # # Set to RDBMS' standard port diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index 3b3736f93f..56bfc90d9e 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -334,7 +334,6 @@ sub process_xml_data ($$$$$) { if (defined ($data->{'group_id'}) && $data->{'group_id'} ne '') { $group_id = $data->{'group_id'}; if (! defined (get_group_name ($dbh, $group_id))) { - print "UNABLE GROUP ID\n"; pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': group ID '" . $group_id . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh); logger($pa_config, "Group ID " . $group_id . " does not exist.", 3); return; @@ -342,13 +341,11 @@ sub process_xml_data ($$$$$) { } elsif (defined ($data->{'group'}) && $data->{'group'} ne '') { $group_id = get_group_id ($dbh, $data->{'group'}); if (! defined (get_group_name ($dbh, $group_id))) { - print "UNABLE GROUP\n"; pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': group '" . safe_output($data->{'group'}) . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh); logger($pa_config, "Group " . $data->{'group'} . " does not exist.", 3); return; } } else { - print "UNABLE AUTOCREATE\n"; pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': autocreate_group $group_id does not exist. Edit the pandora_server.conf file and change it.", 0, 0, 0, 0, 0, 'error', 0, $dbh); logger($pa_config, "Group id $group_id does not exist (check autocreate_group config token).", 3); return; diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index ff6763c13a..3ca50a64ae 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -64,6 +64,7 @@ our @EXPORT = qw( SYNCSERVER SYSLOGSERVER WUXSERVER + PROVISIONINGSERVER MIGRATIONSERVER METACONSOLE_LICENSE $DEVNULL @@ -136,7 +137,8 @@ use constant MFSERVER => 15; use constant SYNCSERVER => 16; use constant WUXSERVER => 17; use constant SYSLOGSERVER => 18; -use constant MIGRATIONSERVER => 19; +use constant PROVISIONINGSERVER => 19; +use constant MIGRATIONSERVER => 20; # Module status use constant MODULE_NORMAL => 0;