mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
Merge branch 'ent-12138-eliminar-agent-access-graph' into 'develop'
Ent 12138 eliminar agent access graph See merge request artica/pandorafms!6522
This commit is contained in:
commit
0f1519aed3
@ -1,5 +1,8 @@
|
|||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
|
-- Delete table tagent_access
|
||||||
|
DROP TABLE tagent_access;
|
||||||
|
|
||||||
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
|
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -27,7 +27,6 @@ if (! check_acl($config['id_user'], 0, 'DM')) {
|
|||||||
|
|
||||||
// Get some general DB stats (not very heavy)
|
// Get some general DB stats (not very heavy)
|
||||||
// NOTE: this is not realtime monitoring stats, are more focused on DB sanity
|
// NOTE: this is not realtime monitoring stats, are more focused on DB sanity
|
||||||
$stat_access = db_get_sql('SELECT COUNT(*) FROM tagent_access WHERE id_agent != 0');
|
|
||||||
$stat_data = db_get_sql('SELECT COUNT(*) FROM tagente_datos WHERE id_agente_modulo != 0');
|
$stat_data = db_get_sql('SELECT COUNT(*) FROM tagente_datos WHERE id_agente_modulo != 0');
|
||||||
$stat_data_log4x = db_get_sql('SELECT COUNT(*) FROM tagente_datos_log4x WHERE id_agente_modulo != 0');
|
$stat_data_log4x = db_get_sql('SELECT COUNT(*) FROM tagente_datos_log4x WHERE id_agente_modulo != 0');
|
||||||
$stat_data_string = db_get_sql('SELECT COUNT(*) FROM tagente_datos_string WHERE id_agente_modulo != 0');
|
$stat_data_string = db_get_sql('SELECT COUNT(*) FROM tagente_datos_string WHERE id_agente_modulo != 0');
|
||||||
@ -149,18 +148,6 @@ echo $stat_modules;
|
|||||||
echo '</b></td></tr>';
|
echo '</b></td></tr>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo '<tr class="rowOdd"><td>';
|
|
||||||
echo __('Total agent access records');
|
|
||||||
echo '<td><b>';
|
|
||||||
if ($stat_access > $max_access) {
|
|
||||||
echo "<font color='#ff0000'>$stat_access</font>";
|
|
||||||
} else {
|
|
||||||
echo $stat_access;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</b></td></tr>';
|
|
||||||
|
|
||||||
// Sanity
|
// Sanity
|
||||||
echo '<tr><th colspan=2><i>';
|
echo '<tr><th colspan=2><i>';
|
||||||
echo __('Database sanity');
|
echo __('Database sanity');
|
||||||
|
@ -154,8 +154,7 @@ if ($update_config == 1 && $config['history_db_enabled'] == 1) {
|
|||||||
$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control']));
|
$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control']));
|
||||||
|
|
||||||
$total_agents = db_get_value('count(*)', 'tagente');
|
$total_agents = db_get_value('count(*)', 'tagente');
|
||||||
$disable_agentaccess = ($total_agents >= 200 && $config['agentaccess'] == 0) ? true : false;
|
// $disable_agentaccess = ($total_agents >= 200 && $config['agentaccess'] == 0) ? true : false;
|
||||||
|
|
||||||
$table_status = new StdClass();
|
$table_status = new StdClass();
|
||||||
$table_status->width = '100%';
|
$table_status->width = '100%';
|
||||||
$table_status->class = 'databox filters';
|
$table_status->class = 'databox filters';
|
||||||
@ -666,8 +665,8 @@ $table_other->data[2][1] = html_print_label_input_block(
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
/*
|
||||||
$table_other->data[3][0] = html_print_label_input_block(
|
$table_other->data[3][0] = html_print_label_input_block(
|
||||||
__('Use agent access graph'),
|
__('Use agent access graph'),
|
||||||
html_print_checkbox_switch(
|
html_print_checkbox_switch(
|
||||||
'agentaccess',
|
'agentaccess',
|
||||||
@ -676,9 +675,9 @@ $table_other->data[3][0] = html_print_label_input_block(
|
|||||||
true,
|
true,
|
||||||
$disable_agentaccess
|
$disable_agentaccess
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
$table_other->data[3][1] = html_print_label_input_block(
|
$table_other->data[3][0] = html_print_label_input_block(
|
||||||
__('Max. recommended number of files in attachment directory'),
|
__('Max. recommended number of files in attachment directory'),
|
||||||
html_print_input_text(
|
html_print_input_text(
|
||||||
'num_files_attachment',
|
'num_files_attachment',
|
||||||
|
@ -269,13 +269,6 @@ class ConsoleSupervisor
|
|||||||
$this->checkSyncQueueStatus();
|
$this->checkSyncQueueStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Check number of agents is equals and more than 200.
|
|
||||||
* NOTIF.ACCESSSTASTICS.PERFORMANCE
|
|
||||||
*/
|
|
||||||
|
|
||||||
$this->checkAccessStatisticsPerformance();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Checkc agent missing libraries.
|
* Checkc agent missing libraries.
|
||||||
* NOTIF.AGENT.LIBRARY
|
* NOTIF.AGENT.LIBRARY
|
||||||
@ -573,13 +566,6 @@ class ConsoleSupervisor
|
|||||||
$this->checkSyncQueueStatus();
|
$this->checkSyncQueueStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Check number of agents is equals and more than 200.
|
|
||||||
* NOTIF.ACCESSSTASTICS.PERFORMANCE
|
|
||||||
*/
|
|
||||||
|
|
||||||
$this->checkAccessStatisticsPerformance();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Checkc agent missing libraries.
|
* Checkc agent missing libraries.
|
||||||
* NOTIF.AGENT.LIBRARY
|
* NOTIF.AGENT.LIBRARY
|
||||||
|
@ -580,9 +580,6 @@ class Diagnostics extends Wizard
|
|||||||
$countModuleData = db_get_value_sql(
|
$countModuleData = db_get_value_sql(
|
||||||
'SELECT COUNT(*) FROM tagente_datos'
|
'SELECT COUNT(*) FROM tagente_datos'
|
||||||
);
|
);
|
||||||
$countAgentAccess = db_get_value_sql(
|
|
||||||
'SELECT COUNT(*) FROM tagent_access'
|
|
||||||
);
|
|
||||||
$countEvents = db_get_value_sql('SELECT COUNT(*) FROM tevento');
|
$countEvents = db_get_value_sql('SELECT COUNT(*) FROM tevento');
|
||||||
|
|
||||||
if (enterprise_installed() === true) {
|
if (enterprise_installed() === true) {
|
||||||
@ -595,39 +592,35 @@ class Diagnostics extends Wizard
|
|||||||
$result = [
|
$result = [
|
||||||
'error' => false,
|
'error' => false,
|
||||||
'data' => [
|
'data' => [
|
||||||
'countAgents' => [
|
'countAgents' => [
|
||||||
'name' => __('Total agents'),
|
'name' => __('Total agents'),
|
||||||
'value' => $countAgents,
|
'value' => $countAgents,
|
||||||
],
|
],
|
||||||
'countModules' => [
|
'countModules' => [
|
||||||
'name' => __('Total modules'),
|
'name' => __('Total modules'),
|
||||||
'value' => $countModules,
|
'value' => $countModules,
|
||||||
],
|
],
|
||||||
'countGroups' => [
|
'countGroups' => [
|
||||||
'name' => __('Total groups'),
|
'name' => __('Total groups'),
|
||||||
'value' => $countGroups,
|
'value' => $countGroups,
|
||||||
],
|
],
|
||||||
'countModuleData' => [
|
'countModuleData' => [
|
||||||
'name' => __('Total module data records'),
|
'name' => __('Total module data records'),
|
||||||
'value' => $countModuleData,
|
'value' => $countModuleData,
|
||||||
],
|
],
|
||||||
'countAgentAccess' => [
|
'countEvents' => [
|
||||||
'name' => __('Total agent access record'),
|
|
||||||
'value' => $countAgentAccess,
|
|
||||||
],
|
|
||||||
'countEvents' => [
|
|
||||||
'name' => __('Total events'),
|
'name' => __('Total events'),
|
||||||
'value' => $countEvents,
|
'value' => $countEvents,
|
||||||
],
|
],
|
||||||
'countTraps' => [
|
'countTraps' => [
|
||||||
'name' => __('Total traps'),
|
'name' => __('Total traps'),
|
||||||
'value' => $countTraps,
|
'value' => $countTraps,
|
||||||
],
|
],
|
||||||
'countUsers' => [
|
'countUsers' => [
|
||||||
'name' => __('Total users'),
|
'name' => __('Total users'),
|
||||||
'value' => $countUsers,
|
'value' => $countUsers,
|
||||||
],
|
],
|
||||||
'countSessions' => [
|
'countSessions' => [
|
||||||
'name' => __('Total sessions'),
|
'name' => __('Total sessions'),
|
||||||
'value' => $countSessions,
|
'value' => $countSessions,
|
||||||
],
|
],
|
||||||
|
@ -917,10 +917,6 @@ function config_update_config()
|
|||||||
$error_update[] = __('Batch statistics period (secs)');
|
$error_update[] = __('Batch statistics period (secs)');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_update_value('agentaccess', (int) get_parameter('agentaccess'), true) === false) {
|
|
||||||
$error_update[] = __('Use agent access graph');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config_update_value('num_files_attachment', (int) get_parameter('num_files_attachment'), true) === false) {
|
if (config_update_value('num_files_attachment', (int) get_parameter('num_files_attachment'), true) === false) {
|
||||||
$error_update[] = __('Max. recommended number of files in attachment directory');
|
$error_update[] = __('Max. recommended number of files in attachment directory');
|
||||||
}
|
}
|
||||||
@ -2237,10 +2233,6 @@ function config_process_config()
|
|||||||
config_update_value('show_qr_code_header', false);
|
config_update_value('show_qr_code_header', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($config['agentaccess'])) {
|
|
||||||
config_update_value('agentaccess', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['timezone'])) {
|
if (!isset($config['timezone'])) {
|
||||||
config_update_value('timezone', 'Europe/Berlin');
|
config_update_value('timezone', 'Europe/Berlin');
|
||||||
}
|
}
|
||||||
|
@ -2525,92 +2525,6 @@ function combined_graph_summatory_average(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Print a graph with access data of agents.
|
|
||||||
*
|
|
||||||
* @param integer $id_agent Agent Id.
|
|
||||||
* @param integer $period Timestamp period graph.
|
|
||||||
* @param boolean|null $return Type return.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function graphic_agentaccess(
|
|
||||||
int $id_agent,
|
|
||||||
int $period=0,
|
|
||||||
?bool $return=false,
|
|
||||||
?bool $agent_view=false
|
|
||||||
) {
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
// Dates.
|
|
||||||
$date = get_system_time();
|
|
||||||
$datelimit = ($date - $period);
|
|
||||||
$interval = 3600;
|
|
||||||
|
|
||||||
// Query.
|
|
||||||
$sql = sprintf(
|
|
||||||
'SELECT utimestamp, count(*) as data
|
|
||||||
FROM tagent_access
|
|
||||||
WHERE id_agent = %d
|
|
||||||
AND utimestamp >= %d
|
|
||||||
AND utimestamp <= %d
|
|
||||||
GROUP BY TRUNCATE(utimestamp/%d,0)',
|
|
||||||
$id_agent,
|
|
||||||
$datelimit,
|
|
||||||
$date,
|
|
||||||
$interval
|
|
||||||
);
|
|
||||||
|
|
||||||
$data = db_get_all_rows_sql($sql);
|
|
||||||
|
|
||||||
// Array data.
|
|
||||||
$data_array = [];
|
|
||||||
$colors = [];
|
|
||||||
if (isset($data) === true && is_array($data) === true) {
|
|
||||||
foreach ($data as $value) {
|
|
||||||
$time = io_safe_output(date('H:m', $value['utimestamp']));
|
|
||||||
$labels[] = $time;
|
|
||||||
$data_array[] = [
|
|
||||||
'y' => (int) $value['data'],
|
|
||||||
'x' => $time,
|
|
||||||
];
|
|
||||||
|
|
||||||
$colors[] = '#82b92f';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$options = [];
|
|
||||||
$options['grid']['hoverable'] = true;
|
|
||||||
|
|
||||||
if ($agent_view === true) {
|
|
||||||
$options['agent_view'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$options = [
|
|
||||||
'height' => 125,
|
|
||||||
'colors' => $colors,
|
|
||||||
'legend' => ['display' => false],
|
|
||||||
'scales' => [
|
|
||||||
'x' => [
|
|
||||||
'grid' => ['display' => false],
|
|
||||||
'ticks' => [
|
|
||||||
'fonts' => ['size' => 8],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'y' => [
|
|
||||||
'grid' => ['display' => false],
|
|
||||||
'ticks' => [
|
|
||||||
'fonts' => ['size' => 8],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'labels' => $labels,
|
|
||||||
];
|
|
||||||
|
|
||||||
return vbar_graph($data_array, $options);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a pie graph with alerts defined/fired data
|
* Print a pie graph with alerts defined/fired data
|
||||||
*
|
*
|
||||||
|
@ -313,55 +313,6 @@ for ($i = 0; $i < $custom_fields_count; $i++) {
|
|||||||
* END: TABLE DATA BUILD
|
* END: TABLE DATA BUILD
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* START: ACCESS RATE GRAPH
|
|
||||||
*/
|
|
||||||
|
|
||||||
$access_agent = db_get_value_sql(
|
|
||||||
'SELECT COUNT(id_agent)
|
|
||||||
FROM tagent_access
|
|
||||||
WHERE id_agent = '.$id_agente
|
|
||||||
);
|
|
||||||
|
|
||||||
if ((bool) $config['agentaccess'] === true && $access_agent > 0) {
|
|
||||||
$agentAccessRateHeader = html_print_div(
|
|
||||||
[
|
|
||||||
'class' => 'agent_details_header',
|
|
||||||
'content' => '<span class="subsection_header_title">'.__('Agent access rate (Last 24h)').'</span>',
|
|
||||||
],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$agentAccessRateContent = html_print_div(
|
|
||||||
[
|
|
||||||
'class' => 'white-table-graph-content',
|
|
||||||
'content' => graphic_agentaccess(
|
|
||||||
$id_agente,
|
|
||||||
SECONDS_1DAY,
|
|
||||||
true,
|
|
||||||
true
|
|
||||||
),
|
|
||||||
],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$agentAccessRate = html_print_div(
|
|
||||||
[
|
|
||||||
'class' => 'box-flat agent_details_col mrgn_lft_20px w50p',
|
|
||||||
'id' => 'table_access_rate',
|
|
||||||
'content' => $agentAccessRateHeader.$agentAccessRateContent,
|
|
||||||
],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$agentAccessRate = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* END: ACCESS RATE GRAPH
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* START: TABLE INTERFACES
|
* START: TABLE INTERFACES
|
||||||
*/
|
*/
|
||||||
@ -598,7 +549,7 @@ html_print_div(
|
|||||||
html_print_div(
|
html_print_div(
|
||||||
[
|
[
|
||||||
'class' => 'agent_details_line',
|
'class' => 'agent_details_line',
|
||||||
'content' => $agentEvents.$agentAccessRate,
|
'content' => $agentEvents,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -293,12 +293,12 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
|
|||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `tagent_access`
|
-- Table `tagent_access`
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
CREATE TABLE IF NOT EXISTS `tagent_access` (
|
-- CREATE TABLE IF NOT EXISTS `tagent_access` (
|
||||||
`id_agent` INT UNSIGNED NOT NULL DEFAULT 0,
|
-- `id_agent` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
`utimestamp` BIGINT NOT NULL DEFAULT 0,
|
-- `utimestamp` BIGINT NOT NULL DEFAULT 0,
|
||||||
KEY `agent_index` (`id_agent`),
|
-- KEY `agent_index` (`id_agent`),
|
||||||
KEY `idx_utimestamp` USING BTREE (`utimestamp`)
|
-- KEY `idx_utimestamp` USING BTREE (`utimestamp`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
-- ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `talert_snmp`
|
-- Table `talert_snmp`
|
||||||
|
@ -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).
|
||||||
@ -466,7 +465,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
|
||||||
|
@ -2159,24 +2159,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);
|
|
||||||
|
|
||||||
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>) >>
|
||||||
|
|
||||||
@ -3426,14 +3408,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,
|
||||||
@ -4238,9 +4216,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);
|
||||||
|
|
||||||
@ -6709,8 +6684,7 @@ sub pandora_installation_monitoring($$) {
|
|||||||
FROM
|
FROM
|
||||||
information_schema.tables
|
information_schema.tables
|
||||||
WHERE
|
WHERE
|
||||||
table_schema not in ('information_schema', 'mysql')
|
table_schema not in ('information_schema', 'mysql')"
|
||||||
AND table_name NOT IN ('tagent_access, tevento')"
|
|
||||||
);
|
);
|
||||||
$module->{'unit'} = '%';
|
$module->{'unit'} = '%';
|
||||||
push(@modules, $module);
|
push(@modules, $module);
|
||||||
|
@ -279,25 +279,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',
|
||||||
@ -225,8 +224,7 @@ sub table_stats {
|
|||||||
FROM information_schema.TABLES
|
FROM information_schema.TABLES
|
||||||
WHERE TABLE_SCHEMA=?
|
WHERE TABLE_SCHEMA=?
|
||||||
AND TABLE_NAME IN (?, ?, ?, ?, ?, ?, ?)",
|
AND TABLE_NAME IN (?, ?, ?, ?, ?, ?, ?)",
|
||||||
$conf->{'dbname'},
|
$conf->{'dbname'},,
|
||||||
'tagent_access',
|
|
||||||
'tagente',
|
'tagente',
|
||||||
'tagente_datos',
|
'tagente_datos',
|
||||||
'tagente_datos_string',
|
'tagente_datos_string',
|
||||||
@ -309,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',
|
||||||
@ -319,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) {
|
||||||
@ -474,7 +465,6 @@ Module table $table_stats->{'tagente_modulo'} $tab
|
|||||||
Data table $table_stats->{'tagente_datos'} $table_comments->{'tagente_datos'}
|
Data table $table_stats->{'tagente_datos'} $table_comments->{'tagente_datos'}
|
||||||
String data table $table_stats->{'tagente_datos_string'} $table_comments->{'tagente_datos_string'}
|
String data table $table_stats->{'tagente_datos_string'} $table_comments->{'tagente_datos_string'}
|
||||||
Event table $table_stats->{'tevento'} $table_comments->{'tevento'}
|
Event table $table_stats->{'tevento'} $table_comments->{'tevento'}
|
||||||
Access stats $table_stats->{'tagent_access'} $table_comments->{'tagent_access'}
|
|
||||||
Audit information $table_stats->{'tsesion'} $table_comments->{'tsesion'}
|
Audit information $table_stats->{'tsesion'} $table_comments->{'tsesion'}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user