Exclude disabled agents scheduled stops. Ticket #3878.
This commit is contained in:
parent
b33fce3215
commit
e9e5520ea9
|
@ -40,3 +40,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge
|
|||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tplanned_downtime_agents`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tplanned_downtime_agents ADD COLUMN `manually_disabled` tinyint(1) DEFAULT 0;
|
||||
|
|
|
@ -35,3 +35,7 @@ INSERT INTO tconfig (token, value) VALUES ('big_operation_step_datos_purge', '10
|
|||
INSERT INTO tconfig (token, value) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO tconfig (token, value) VALUES ('days_autodisable_deletion', '30');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tplanned_downtime_agents`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tplanned_downtime_agents ADD COLUMN manually_disabled NUMBER(5, 0) DEFAULT 0;
|
||||
|
|
|
@ -277,6 +277,17 @@ $table->data[34][0] = __('Limit parameters massive') .
|
|||
$table->data[34][1] = html_print_input_text('limit_parameters_massive',
|
||||
$config['limit_parameters_massive'], '', 10, 10, true);
|
||||
|
||||
$table->data[35][0] = __('Include agents');
|
||||
$table->data[35][1] = __('Yes').' '.html_print_radio_button ('include_agents', 1, '', $config["include_agents"], true).' ';
|
||||
$table->data[35][1] .= __('No').' '.html_print_radio_button ('include_agents', 0, '', $config["include_agents"], true);
|
||||
/*$row = array();
|
||||
$row[0] = __('Include agents');
|
||||
|
||||
$row[1] = __('Yes') . ' ' . html_print_radio_button ('include_agents', 1, '', $config["include_agents"], true) . ' ';
|
||||
$row[1] .= __('No') . ' ' . html_print_radio_button ('include_agents', 0, '', $config["include_agents"], true);
|
||||
|
||||
$data['include_agents'] = $row;*/
|
||||
|
||||
|
||||
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general&pure='.$config['pure'].'">';
|
||||
|
||||
|
|
|
@ -203,6 +203,8 @@ function config_update_config () {
|
|||
$error_update[] = __('Limit parameters massive');
|
||||
if (!config_update_value ('identification_reminder', get_parameter('identification_reminder')))
|
||||
$error_update[] = __('Identification_reminder');
|
||||
if (!config_update_value ('include_agents', (bool)get_parameter('include_agents')))
|
||||
$error_update[] = __('Include_agents');
|
||||
break;
|
||||
case 'enterprise':
|
||||
if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) {
|
||||
|
@ -901,7 +903,11 @@ function config_process_config () {
|
|||
if (!isset ($config["log_collector"])) {
|
||||
config_update_value ('log_collector', 0);
|
||||
}
|
||||
|
||||
|
||||
if (!isset ($config["include_agents"])) {
|
||||
config_update_value ('include_agents', 0);
|
||||
}
|
||||
|
||||
if (!isset ($config["log_dir"])) {
|
||||
if ($is_windows)
|
||||
$default = 'C:\\PandoraFMS\\Pandora_Server\\data_in\\log';
|
||||
|
|
|
@ -1338,6 +1338,7 @@ CREATE TABLE IF NOT EXISTS `tplanned_downtime_agents` (
|
|||
`id_agent` mediumint(8) unsigned NOT NULL default '0',
|
||||
`id_downtime` mediumint(8) NOT NULL default '0',
|
||||
`all_modules` tinyint(1) default 1,
|
||||
`manually_disabled` tinyint(1) default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_downtime`) REFERENCES tplanned_downtime(`id`)
|
||||
ON DELETE CASCADE
|
||||
|
|
|
@ -415,6 +415,8 @@ sub pandora_load_config {
|
|||
$pa_config->{"warmup_unknown_interval"} = 300; # 6.1
|
||||
$pa_config->{"warmup_unknown_on"} = 1; # 6.1
|
||||
|
||||
$pa_config->{'include_agents'} = 0; #6.1
|
||||
|
||||
# Check for UID0
|
||||
if ($pa_config->{"quiet"} != 0){
|
||||
if ($> == 0){
|
||||
|
@ -929,6 +931,9 @@ sub pandora_load_config {
|
|||
$pa_config->{'warmup_unknown_interval'}= clean_blank($1);
|
||||
$pa_config->{'warmup_unknown_on'} = 0 if ($pa_config->{'warmup_unknown_interval'} == 0); # On by default.
|
||||
}
|
||||
elsif ($parametro =~ m/^include_agents\s+([0-1])/i) {
|
||||
$pa_config->{'include_agents'}= safe_input($1);
|
||||
}
|
||||
} # end of loop for parameter #
|
||||
|
||||
# Set to RDBMS' standard port
|
||||
|
|
|
@ -1576,6 +1576,13 @@ sub pandora_planned_downtime_set_disabled_elements($$$) {
|
|||
}
|
||||
|
||||
if ($only_alerts == 0) {
|
||||
|
||||
if($pa_config->{'include_agents'} == 0){
|
||||
db_do($dbh, 'UPDATE tplanned_downtime_agents
|
||||
SET manually_disabled = 1 WHERE id_agent IN (SELECT id_agente FROM tagente WHERE disabled = 1)
|
||||
AND id_downtime = ' . $downtime->{'id'});
|
||||
}
|
||||
|
||||
db_do ($dbh, 'UPDATE tagente
|
||||
SET disabled = 1
|
||||
WHERE id_agente = ?', $downtime_agent->{'id_agent'});
|
||||
|
@ -1619,6 +1626,12 @@ sub pandora_planned_downtime_unset_disabled_elements($$$) {
|
|||
db_do ($dbh, 'UPDATE tagente
|
||||
SET disabled = 0
|
||||
WHERE id_agente = ?', $downtime_agent->{'id_agent'});
|
||||
|
||||
if($pa_config->{'include_agents'} == 0){
|
||||
db_do ($dbh, 'UPDATE tagente
|
||||
SET disabled = 1
|
||||
WHERE id_agente IN (SELECT id_agent FROM tplanned_downtime_agents WHERE manually_disabled = 1)');
|
||||
}
|
||||
}
|
||||
else {
|
||||
db_do ($dbh, 'UPDATE talert_template_modules
|
||||
|
|
Loading…
Reference in New Issue