Feature: Transactional agent flag

When a module Transactional subsystem status is received, the agent
turns into transactional_agent
This commit is contained in:
fbsanchez 2016-10-27 18:33:27 +02:00
parent 43abce6393
commit 2db5823746
2 changed files with 26 additions and 0 deletions

View File

@ -223,6 +223,7 @@ our @EXPORT = qw(
pandora_update_server
pandora_update_table_from_hash
pandora_update_template_module
pandora_mark_transactional_agent
pandora_group_statistics
pandora_server_statistics
pandora_self_monitoring
@ -2287,6 +2288,25 @@ sub pandora_update_agent ($$$$$$$;$$) {
db_do ($dbh, "UPDATE tagente SET $set WHERE id_agente = ?", @{$values}, $agent_id);
}
##########################################################################
=head2 C<< pandora_mark_transactional_agent (I<$id_agente>) >>
Set an agent as transactional agent
=cut
##########################################################################
sub pandora_mark_transactional_agent($$) {
my ($dbh, $id_agente) = @_;
if ( (!(defined($id_agente))) || (!(defined($dbh))) ) {
return;
}
db_do ($dbh, "UPDATE tagente SET transactional_agent=1 WHERE id_agente = ?", $id_agente);
}
##########################################################################
=head2 C<< pandora_update_gis_data (I<$pa_config>, I<$dbh>, I<$agent_id>, I<$longitude>, I<$latitude>, I<$altitude>) >>

View File

@ -584,6 +584,12 @@ sub process_module_data ($$$$$$$$$$) {
# Name XML tag and column name don't match
$module_conf->{'nombre'} = safe_input($module_name);
# Check if module is 'Transactional subsystem status'
if ($module_conf->{'name'} eq "Transactional subsystem status") {
# Defines current agent as transactional agent
pandora_mark_transactional_agent($dbh, $agent->{'id_agente'});
}
delete $module_conf->{'name'};
# Calculate the module interval in seconds