Merge branch 'ent-10247-Verificar-como-hace-la-comprobacion-del-spool-la-consola' into 'develop'

get data in file count from module

See merge request artica/pandorafms!6746
This commit is contained in:
Rafael Ameijeiras 2024-02-06 13:49:02 +00:00
commit e7f74210dc

View File

@ -27,6 +27,7 @@
*/
use PandoraFMS\Tools\Files;
use PandoraFMS\Agent;
global $config;
@ -1214,6 +1215,7 @@ class ConsoleSupervisor
'',
$config['num_files_attachment']
);
if ($filecount > $config['num_files_attachment']) {
$this->notify(
[
@ -1331,17 +1333,28 @@ class ConsoleSupervisor
$MAX_FILES_DATA_IN = 1000;
$MAX_BADXML_FILES_DATA_IN = 150;
$filecount = $this->countFiles(
$remote_config_dir,
'',
$MAX_FILES_DATA_IN
);
$filecount = 0;
$agentId = db_get_value('id_agente', 'tagente', 'nombre', 'pandora.internals');
if ($agentId !== false) {
$agent = new Agent($agentId);
$moduleId = $agent->searchModules(
['nombre' => 'Data_in_files'],
1
)->toArray()['id_agente_modulo'];
if ($moduleId > 0) {
$filecount = (int) modules_get_last_value($moduleId);
}
}
// If cannot open directory, count is '-1', skip.
if ($filecount > $MAX_FILES_DATA_IN) {
$this->notify(
[
'type' => 'NOTIF.FILES.DATAIN',
'title' => __('There are too much files in spool').'.',
'title' => __('There are too many files in spool').'.',
'message' => __(
'There are more than %d files in %s. Consider checking DataServer performance',
$MAX_FILES_DATA_IN,