2012-02-03 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/Core.pm: Added support for ff interval. Small
	  improvements.
	
	* lib/PandoraFMS/DataServer.pm: Added "timestamp" to the list of
	  valid XML tags.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5484 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2012-02-03 12:31:08 +00:00
parent e66a8983ad
commit 1faca416fd
3 changed files with 24 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2012-02-03 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Added support for ff interval. Small
improvements.
* lib/PandoraFMS/DataServer.pm: Added "timestamp" to the list of
valid XML tags.
2012-02-01 Ramon Novoa <rnovoa@artica.es> 2012-02-01 Ramon Novoa <rnovoa@artica.es>
* conf/pandora_server.conf, * conf/pandora_server.conf,

View File

@ -895,15 +895,28 @@ sub pandora_process_module ($$$$$$$$$;$) {
# Get new status # Get new status
my $new_status = get_module_status ($processed_data, $module, $module_type); my $new_status = get_module_status ($processed_data, $module, $module_type);
# Calculate the current interval
my $current_interval = ($module->{'module_interval'} == 0 ? $agent->{'intervalo'} : $module->{'module_interval'});
#Update module status #Update module status
my $current_utimestamp = time (); my $current_utimestamp = time ();
if ($last_status == $new_status) { if ($last_status == $new_status) {
# Avoid overflows
$status_changes = $module->{'min_ff_event'} if ($status_changes > $module->{'min_ff_event'});
$status_changes++; $status_changes++;
} else { } else {
$status_changes = 0; $status_changes = 0;
} }
if ($status_changes == $module->{'min_ff_event'}) { # Active ff interval
if ($module->{'module_ff_interval'} != 0 && $status_changes < $module->{'min_ff_event'}) {
$current_interval = $module->{'module_ff_interval'};
}
# Change status
if ($status_changes == $module->{'min_ff_event'} && $status != $new_status) {
generate_status_event ($pa_config, $processed_data, $agent, $module, $new_status, $status, $dbh); generate_status_event ($pa_config, $processed_data, $agent, $module, $new_status, $status, $dbh);
$status = $new_status; $status = $new_status;
} }
@ -929,8 +942,7 @@ sub pandora_process_module ($$$$$$$$$;$) {
my $last_try = ($1 == 0) ? 0 : timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900); my $last_try = ($1 == 0) ? 0 : timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900);
my $save = ($module->{'history_data'} == 1 && ($agent_status->{'datos'} ne $processed_data || $last_try < ($utimestamp - 86400))) ? 1 : 0; my $save = ($module->{'history_data'} == 1 && ($agent_status->{'datos'} ne $processed_data || $last_try < ($utimestamp - 86400))) ? 1 : 0;
my $current_interval = ($module->{'module_interval'} == 0 ? $agent->{'intervalo'} : $module->{'module_interval'});
db_do ($dbh, 'UPDATE tagente_estado SET datos = ?, estado = ?, last_status = ?, status_changes = ?, utimestamp = ?, timestamp = ?, db_do ($dbh, 'UPDATE tagente_estado SET datos = ?, estado = ?, last_status = ?, status_changes = ?, utimestamp = ?, timestamp = ?,
id_agente = ?, current_interval = ?, running_by = ?, last_execution_try = ?, last_try = ? id_agente = ?, current_interval = ?, running_by = ?, last_execution_try = ?, last_try = ?
WHERE id_agente_modulo = ?', $processed_data, $status, $last_status, $status_changes, WHERE id_agente_modulo = ?', $processed_data, $status, $last_status, $status_changes,

View File

@ -456,7 +456,7 @@ sub process_module_data ($$$$$$$$$) {
my $tags = {'name' => 0, 'data' => 0, 'type' => 0, 'description' => 0, 'max' => 0, my $tags = {'name' => 0, 'data' => 0, 'type' => 0, 'description' => 0, 'max' => 0,
'min' => 0, 'descripcion' => 0, 'post_process' => 0, 'module_interval' => 0, 'min_critical' => 0, 'min' => 0, 'descripcion' => 0, 'post_process' => 0, 'module_interval' => 0, 'min_critical' => 0,
'max_critical' => 0, 'min_warning' => 0, 'max_warning' => 0, 'disabled' => 0, 'min_ff_event' => 0, 'max_critical' => 0, 'min_warning' => 0, 'max_warning' => 0, 'disabled' => 0, 'min_ff_event' => 0,
'datalist' => 0, 'status' => 0}; 'datalist' => 0, 'status' => 0, 'timestamp' => 0};
# Other tags will be saved here # Other tags will be saved here
$module_conf->{'extended_info'} = ''; $module_conf->{'extended_info'} = '';