[Server] [Linux Agent] Added cron_interval to modules XML to avoid cron blocked modules go to unknown
This commit is contained in:
parent
1b3c9db30d
commit
cedf825526
|
@ -2355,10 +2355,13 @@ sub check_module_cron {
|
|||
|
||||
my $interval = $main_interval * $module->{'interval'};
|
||||
|
||||
$module->{'cron_utimestamp'} = $now + cron_next_execution(
|
||||
my $time_to_next_execution = cron_next_execution(
|
||||
$module->{'cron'},
|
||||
$interval
|
||||
);
|
||||
|
||||
$module->{'cron_utimestamp'} = $now + $time_to_next_execution;
|
||||
$module->{'cron_interval'} = $time_to_next_execution;
|
||||
|
||||
if ($Conf{'debug'} eq '1') {
|
||||
log_message ('debug', "Cron for module $module->{'name'} will be executed next time at timestamp: $module->{'cron_utimestamp'}.");
|
||||
|
@ -2474,8 +2477,9 @@ sub write_module_xml ($@) {
|
|||
# Module Alert template
|
||||
$Xml .= " <alert_template>" . $module->{'alert_template'} . "</alert_template>\n" if (defined ($module->{'alert_template'}));
|
||||
|
||||
# Module Alert template
|
||||
# Module Crontab
|
||||
$Xml .= " <crontab>" . $module->{'cron'} . "</crontab>\n" if (defined ($module->{'cron'}) and ($module->{'cron'} ne ""));
|
||||
$Xml .= " <cron_interval>" . $module->{'cron_interval'} . "</cron_interval>\n" if (defined ($module->{'cron'}) and (defined ($module->{'cron_interval'})));
|
||||
|
||||
# FF threshold configuration
|
||||
$Xml .= " <min_ff_event_normal>" . $module->{'min_ff_event_normal'} . "</min_ff_event_normal>\n" if (defined ($module->{'min_ff_event_normal'}));
|
||||
|
|
|
@ -611,7 +611,7 @@ sub process_module_data ($$$$$$$$$$) {
|
|||
'unknown_instructions' => '', 'tags' => '', 'critical_inverse' => 0, 'warning_inverse' => 0, 'quiet' => 0,
|
||||
'module_ff_interval' => 0, 'alert_template' => '', 'crontab' => '', 'min_ff_event_normal' => 0,
|
||||
'min_ff_event_warning' => 0, 'min_ff_event_critical' => 0, 'ff_timeout' => 0, 'each_ff' => 0, 'module_parent' => 0,
|
||||
'module_parent_unlink' => 0};
|
||||
'module_parent_unlink' => 0, 'cron_interval' => 0};
|
||||
|
||||
# Other tags will be saved here
|
||||
$module_conf->{'extended_info'} = '';
|
||||
|
@ -644,8 +644,12 @@ sub process_module_data ($$$$$$$$$$) {
|
|||
delete $module_conf->{'name'};
|
||||
|
||||
# Calculate the module interval in seconds
|
||||
$module_conf->{'module_interval'} = 1 unless defined ($module_conf->{'module_interval'});
|
||||
$module_conf->{'module_interval'} *= $interval if (defined ($module_conf->{'module_interval'}));
|
||||
if (defined($module_conf->{'cron_interval'})) {
|
||||
$module_conf->{'module_interval'} = 1 unless defined ($module_conf->{'module_interval'});
|
||||
$module_conf->{'module_interval'} *= $interval if (defined ($module_conf->{'module_interval'}));
|
||||
} else {
|
||||
$module_conf->{'module_interval'} = $module_conf->{'cron_interval'};
|
||||
}
|
||||
|
||||
# Allow , as a decimal separator
|
||||
$module_conf->{'post_process'} =~ s/,/./ if (defined ($module_conf->{'post_process'}));
|
||||
|
|
Loading…
Reference in New Issue