#12138 Clean code server
This commit is contained in:
parent
2b416382a4
commit
578dba8207
|
@ -128,7 +128,6 @@ sub pandora_get_sharedconfig ($$) {
|
||||||
my ($pa_config, $dbh) = @_;
|
my ($pa_config, $dbh) = @_;
|
||||||
|
|
||||||
# Agentaccess option
|
# Agentaccess option
|
||||||
#$pa_config->{"agentaccess"} = pandora_get_tconfig_token ($dbh, 'agentaccess', 1);
|
|
||||||
|
|
||||||
# Realtimestats 0 disabled, 1 enabled.
|
# Realtimestats 0 disabled, 1 enabled.
|
||||||
# Master servers will generate all the information (global tactical stats).
|
# Master servers will generate all the information (global tactical stats).
|
||||||
|
@ -458,7 +457,6 @@ sub pandora_load_config {
|
||||||
# don't get an error later.
|
# don't get an error later.
|
||||||
$pa_config->{"realtimestats"} = 0;
|
$pa_config->{"realtimestats"} = 0;
|
||||||
$pa_config->{"stats_interval"} = 300;
|
$pa_config->{"stats_interval"} = 300;
|
||||||
#$pa_config->{"agentaccess"} = 1;
|
|
||||||
$pa_config->{"event_storm_protection"} = 0;
|
$pa_config->{"event_storm_protection"} = 0;
|
||||||
$pa_config->{"use_custom_encoding"} = 0;
|
$pa_config->{"use_custom_encoding"} = 0;
|
||||||
$pa_config->{"node_metaconsole"} = 0; # > 7.0NG
|
$pa_config->{"node_metaconsole"} = 0; # > 7.0NG
|
||||||
|
|
|
@ -2093,24 +2093,6 @@ sub send_console_notification {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
=head2 C<< pandora_access_update (I<$pa_config>, I<$agent_id>, I<$dbh>) >>
|
|
||||||
|
|
||||||
Update agent access table.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
##########################################################################
|
|
||||||
sub pandora_access_update ($$$) {
|
|
||||||
my ($pa_config, $agent_id, $dbh) = @_;
|
|
||||||
|
|
||||||
return if ($agent_id < 0);
|
|
||||||
return;
|
|
||||||
#if ($pa_config->{"agentaccess"} == 0){
|
|
||||||
# return;
|
|
||||||
#}
|
|
||||||
#db_do ($dbh, "INSERT INTO tagent_access (id_agent, utimestamp) VALUES (?, ?)", $agent_id, time ());
|
|
||||||
}
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
=head2 C<< pandora_process_module (I<$pa_config>, I<$data>, I<$agent>, I<$module>, I<$module_type>, I<$timestamp>, I<$utimestamp>, I<$server_id>, I<$dbh>) >>
|
=head2 C<< pandora_process_module (I<$pa_config>, I<$data>, I<$agent>, I<$module>, I<$module_type>, I<$timestamp>, I<$utimestamp>, I<$server_id>, I<$dbh>) >>
|
||||||
|
|
||||||
|
@ -3362,14 +3344,10 @@ sub pandora_update_agent ($$$$$$$;$$$) {
|
||||||
|
|
||||||
# No access update for data without interval.
|
# No access update for data without interval.
|
||||||
# Single modules from network server, for example. This could be very Heavy for Pandora FMS
|
# Single modules from network server, for example. This could be very Heavy for Pandora FMS
|
||||||
if ($agent_interval != -1){
|
if ($agent_interval == -1){
|
||||||
pandora_access_update ($pa_config, $agent_id, $dbh);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
# Do not update the agent interval
|
|
||||||
$agent_interval = undef;
|
$agent_interval = undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Update tagente
|
# Update tagente
|
||||||
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime());
|
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime());
|
||||||
my ($set, $values) = db_update_get_values ({'agent_version' => $agent_version,
|
my ($set, $values) = db_update_get_values ({'agent_version' => $agent_version,
|
||||||
|
@ -4169,9 +4147,6 @@ sub pandora_delete_agent ($$;$) {
|
||||||
# Delete the agent
|
# Delete the agent
|
||||||
db_do ($dbh, 'DELETE FROM tagente WHERE id_agente = ?', $agent_id);
|
db_do ($dbh, 'DELETE FROM tagente WHERE id_agente = ?', $agent_id);
|
||||||
|
|
||||||
# Delete agent access data
|
|
||||||
#db_do ($dbh, 'DELETE FROM tagent_access WHERE id_agent = ?', $agent_id);
|
|
||||||
|
|
||||||
# Delete addresses
|
# Delete addresses
|
||||||
db_do ($dbh, 'DELETE FROM taddress_agent WHERE id_ag = ?', $agent_id);
|
db_do ($dbh, 'DELETE FROM taddress_agent WHERE id_ag = ?', $agent_id);
|
||||||
|
|
||||||
|
@ -6592,13 +6567,6 @@ sub pandora_installation_monitoring($$) {
|
||||||
push(@modules, $module);
|
push(@modules, $module);
|
||||||
undef $module;
|
undef $module;
|
||||||
|
|
||||||
# Total agent access record
|
|
||||||
#$module->{'name'} = "total_access_data";
|
|
||||||
#$module->{'description'} = 'Total agent access records';
|
|
||||||
#$module->{'data'} = get_db_value($dbh, 'SELECT COUNT(id_agent) FROM tagent_access');
|
|
||||||
#push(@modules, $module);
|
|
||||||
#undef $module;
|
|
||||||
|
|
||||||
# Total users
|
# Total users
|
||||||
$module->{'name'} = "total_users";
|
$module->{'name'} = "total_users";
|
||||||
$module->{'description'} = 'Total users';
|
$module->{'description'} = 'Total users';
|
||||||
|
|
|
@ -276,25 +276,7 @@ sub pandora_purgedb ($$$) {
|
||||||
|
|
||||||
log_message ('PURGE', "Deleting old access data (More than 24hr)");
|
log_message ('PURGE', "Deleting old access data (More than 24hr)");
|
||||||
|
|
||||||
#$first_mark = get_db_value_limit ($dbh, 'SELECT utimestamp FROM tagent_access ORDER BY utimestamp ASC', 1);
|
|
||||||
#if (defined ($first_mark)) {
|
|
||||||
# $total_time = $ulimit_access_timestamp - $first_mark;
|
|
||||||
# $purge_steps = int( $total_time / $BIG_OPERATION_STEP);
|
|
||||||
# if ($purge_steps > 0) {
|
|
||||||
# for (my $ax = 1; $ax <= $BIG_OPERATION_STEP; $ax++){
|
|
||||||
# db_do ($dbh, "DELETE FROM tagent_access WHERE utimestamp < ". ( $first_mark + ($purge_steps * $ax)) . " AND utimestamp >= ". $first_mark);
|
|
||||||
# log_message ('PURGE', "Agent access deletion progress %$ax", "\r");
|
|
||||||
# # Do a nanosleep here for 0,01 sec
|
|
||||||
# usleep (10000);
|
|
||||||
# }
|
|
||||||
# log_message ('', "\n");
|
|
||||||
# } else {
|
|
||||||
# log_message ('PURGE', "No agent access data to purge.");
|
|
||||||
# }
|
|
||||||
#} else {
|
|
||||||
# log_message ('PURGE', "No agent access data.");
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Purge the reports
|
# Purge the reports
|
||||||
if (defined($conf->{'_enterprise_installed'}) && $conf->{'_enterprise_installed'} eq '1' &&
|
if (defined($conf->{'_enterprise_installed'}) && $conf->{'_enterprise_installed'} eq '1' &&
|
||||||
defined($conf->{'_metaconsole'}) && $conf->{'_metaconsole'} eq '1'){
|
defined($conf->{'_metaconsole'}) && $conf->{'_metaconsole'} eq '1'){
|
||||||
|
|
|
@ -212,7 +212,6 @@ sub stress_agent {
|
||||||
sub table_stats {
|
sub table_stats {
|
||||||
my ($dbh, $conf) = @_;
|
my ($dbh, $conf) = @_;
|
||||||
my $stats = {
|
my $stats = {
|
||||||
#tagent_access => 'N/A',
|
|
||||||
tagente => 'N/A',
|
tagente => 'N/A',
|
||||||
tagente_datos => 'N/A',
|
tagente_datos => 'N/A',
|
||||||
tagente_datos_string => 'N/A',
|
tagente_datos_string => 'N/A',
|
||||||
|
@ -308,7 +307,6 @@ sub generate_optimized_my_cnf {
|
||||||
sub table_comments {
|
sub table_comments {
|
||||||
my ($stats) = @_;
|
my ($stats) = @_;
|
||||||
my $comments = {
|
my $comments = {
|
||||||
#tagent_access => 'OK',
|
|
||||||
tagente => 'OK',
|
tagente => 'OK',
|
||||||
tagente_datos => 'OK',
|
tagente_datos => 'OK',
|
||||||
tagente_datos_string => 'OK',
|
tagente_datos_string => 'OK',
|
||||||
|
@ -318,12 +316,6 @@ sub table_comments {
|
||||||
tsesion => 'OK',
|
tsesion => 'OK',
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ($stats->{'tagent_access'} > $stats->{'tagente'} * 24 * 250) {
|
|
||||||
# $comments->{'tagent_access'} = 'CRITICAL: Table too big. Please contact our support team at: support@artica.es';
|
|
||||||
#} elsif ($stats->{'tagent_access'} > $stats->{'tagente'} * 24 * 100) {
|
|
||||||
# $comments->{'tagent_access'} = 'WARNING: Table too big. Please contact our support team at: support@artica.es';
|
|
||||||
#}
|
|
||||||
|
|
||||||
if ($stats->{'tagente_datos'} > 5000000) {
|
if ($stats->{'tagente_datos'} > 5000000) {
|
||||||
$comments->{'tagente_datos'} = 'CRITICAL: Table too big. Please use a history database or decrease the purge period.';
|
$comments->{'tagente_datos'} = 'CRITICAL: Table too big. Please use a history database or decrease the purge period.';
|
||||||
} elsif ($stats->{'tagente_datos'} > 1000000) {
|
} elsif ($stats->{'tagente_datos'} > 1000000) {
|
||||||
|
|
Loading…
Reference in New Issue