mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 09:15:15 +02:00
Merge branch 'develop' into ent-11494-nuevo-widget-service-level-detail
This commit is contained in:
commit
6455314f0c
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.774-231201
|
||||
Version: 7.0NG.774-231205
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.774-231201"
|
||||
pandora_version="7.0NG.774-231205"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -1039,7 +1039,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.774';
|
||||
use constant AGENT_BUILD => '231201';
|
||||
use constant AGENT_BUILD => '231205';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231201
|
||||
%define release 231205
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -5,7 +5,7 @@
|
||||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231201
|
||||
%define release 231205
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
@ -5,7 +5,7 @@
|
||||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231201
|
||||
%define release 231205
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
@ -5,7 +5,7 @@
|
||||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231201
|
||||
%define release 231205
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
Name: %{name}
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231201
|
||||
%define release 231205
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.774"
|
||||
PI_BUILD="231201"
|
||||
PI_BUILD="231205"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{231201}
|
||||
{231205}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.774 Build 231201")
|
||||
#define PANDORA_VERSION ("7.0NG.774 Build 231205")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Pandora FMS"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.774(Build 231201))"
|
||||
VALUE "ProductVersion", "(7.0NG.774(Build 231205))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.774-231201
|
||||
Version: 7.0NG.774-231205
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.774-231201"
|
||||
pandora_version="7.0NG.774-231205"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -1720,3 +1720,4 @@ include/functions_integriaims.php
|
||||
include/ajax/integria_incidents.ajax.php
|
||||
enterprise/operation/log/log_source.php
|
||||
enterprise/include/class/LogSource.class.php
|
||||
include/chart_generator.php
|
@ -600,43 +600,176 @@ html_print_div(
|
||||
'content' => html_print_table($tableAgent, true).$CodeQRTable,
|
||||
]
|
||||
);
|
||||
/*
|
||||
TODO REVIEW
|
||||
$table_satellite = '';
|
||||
if ($remote_agent === true) {
|
||||
// Satellite server selector.
|
||||
$satellite_servers = db_get_all_rows_filter(
|
||||
'tserver',
|
||||
['server_type' => SERVER_TYPE_ENTERPRISE_SATELLITE],
|
||||
[
|
||||
'id_server',
|
||||
'name',
|
||||
]
|
||||
);
|
||||
|
||||
$satellite_names = [];
|
||||
if (empty($satellite_servers) === false) {
|
||||
foreach ($satellite_servers as $s_server) {
|
||||
$satellite_names[$s_server['id_server']] = $s_server['name'];
|
||||
// Basic Options.
|
||||
$tableBasicAgent = new stdClass();
|
||||
$tableBasicAgent->class = 'filter-table-adv';
|
||||
$tableBasicAgent->data = [];
|
||||
$disabledBasic = false;
|
||||
$tableClassDisabled = '';
|
||||
if ($new_agent === true || $remote_agent === false || $has_remote_conf === false) {
|
||||
$disabledBasic = true;
|
||||
$tableClassDisabled = ' basic-options-disabled';
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
// Get all plugins (BASIC OPTIONS).
|
||||
$agent_plugin = new PandoraFMS\Agent($id_agente);
|
||||
$plugins = $agent_plugin->getPlugins();
|
||||
// Check if some plugin was enabled/disabled in conf.
|
||||
foreach ($plugins as $key => $row) {
|
||||
if (preg_match('/pandora_hardening/', $row['raw']) === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$security_hardening = 0;
|
||||
} else {
|
||||
$security_hardening = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$table_satellite = '<div class="label_select"><p class="input_label">'.__('Satellite').'</p>';
|
||||
$table_satellite .= '<div class="label_select_parent">';
|
||||
if ($id_os === '1' || $id_os === '8') {
|
||||
if (preg_match('/(module_plugin grep_log_module ).*/', $row['raw']) === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$enable_log_collector = 0;
|
||||
} else {
|
||||
$enable_log_collector = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$table_satellite .= html_print_input(
|
||||
if (preg_match('/(module_plugin inventory).*/', $row['raw']) === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$enable_inventory = 0;
|
||||
} else {
|
||||
$enable_inventory = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (preg_match('/.vbs/', $row['raw']) === 1 && preg_match('/nettraffic.vbs/', $row['raw']) === 0 && preg_match('/software_installed.vbs/', $row['raw']) === 0 && preg_match('/df.vbs/', $row['raw']) === 0 && preg_match('/win_cf.vbs/', $row['raw']) === 0) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$enable_inventory = 0;
|
||||
} else {
|
||||
$enable_inventory = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($id_os === '9') {
|
||||
$modules = $agent_plugin->getModules();
|
||||
foreach ($modules as $key => $row) {
|
||||
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$enable_log_collector = 0;
|
||||
} else {
|
||||
$enable_log_collector = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($agent_plugin, $plugins);
|
||||
if (($new_agent === true && $config['current_package'] >= 774) || ($agent_version >= 774 && $new_agent === false)) {
|
||||
if ($disabledBasic === true || $has_remote_conf === false) {
|
||||
$message = __('Remote config disabled, please activate to enable agent basic options');
|
||||
$tableBasicAgent->data[] = '<span>'.$message.'</span>';
|
||||
}
|
||||
|
||||
$tableBasicAgent->data[] = html_print_label_input_block(
|
||||
__('Enable security hardening monitoring'),
|
||||
html_print_input(
|
||||
[
|
||||
'type' => 'select',
|
||||
'fields' => $satellite_names,
|
||||
'name' => 'satellite_server',
|
||||
'selected' => $satellite_server,
|
||||
'nothing' => __('None'),
|
||||
'nothinf_value' => 0,
|
||||
'return' => true,
|
||||
'type' => 'switch',
|
||||
'id' => 'security_hardening',
|
||||
'name' => 'security_hardening',
|
||||
'value' => $security_hardening,
|
||||
'disabled' => $disabledBasic,
|
||||
]
|
||||
).'<div class="label_select_child_icons"></div></div></div>';
|
||||
).html_print_input_hidden('options_package', '1', true)
|
||||
);
|
||||
|
||||
$tableBasicAgent->data[] = html_print_label_input_block(
|
||||
__('Enable log collection'),
|
||||
html_print_input(
|
||||
[
|
||||
'type' => 'switch',
|
||||
'id' => 'enable_log_collector',
|
||||
'name' => 'enable_log_collector',
|
||||
'value' => $enable_log_collector,
|
||||
'disabled' => $disabledBasic,
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$tableBasicAgent->data[] = html_print_label_input_block(
|
||||
__('Enable inventory'),
|
||||
html_print_input(
|
||||
[
|
||||
'type' => 'switch',
|
||||
'id' => 'enable_inventory',
|
||||
'name' => 'enable_inventory',
|
||||
'value' => $enable_inventory,
|
||||
'disabled' => $disabledBasic,
|
||||
]
|
||||
).html_print_input_hidden('enable_basic_options', '1', true)
|
||||
);
|
||||
|
||||
if ($config['ehorus_enabled'] === '1') {
|
||||
$pandoraRC_Id = html_print_image(
|
||||
'images/alert_recovered@svg.svg',
|
||||
true,
|
||||
[
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
'title' => __('Pandora RC connected with id ').$config['ehorus_custom_field'],
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$pandoraRC_Id = html_print_image(
|
||||
'images/alerts.svg',
|
||||
true,
|
||||
[
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
'title' => __('This agent do not have a Pandora RC agent installed, install one.'),
|
||||
]
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
$tableBasicAgent->data[] = html_print_label_input_block(
|
||||
__('Enable remote control'),
|
||||
$pandoraRC_Id
|
||||
);
|
||||
|
||||
$WarningPackage = '';
|
||||
if (($new_agent === true && $config['current_package'] < 774) || ($agent_version < 774 && $new_agent === false)) {
|
||||
$WarningPackage = html_print_image(
|
||||
'images/alert-yellow@svg.svg',
|
||||
true,
|
||||
[
|
||||
'title' => __('Only available for agents 774 or higher'),
|
||||
'alt' => __('Only available for agents 774 or higher'),
|
||||
'class' => 'main_menu_icon mrgn_lft_5px',
|
||||
]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$tableBasicAgent->data[] = '<span>'.__('Remote config is enabled only in the Enteprise version').'</span>';
|
||||
$tableBasicAgent->data[] .= html_print_input_hidden(
|
||||
'enable_basic_options',
|
||||
'0',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
ui_toggle(
|
||||
html_print_table($tableBasicAgent, true),
|
||||
'<span class="subsection_header_title">'.__('Basic options').$WarningPackage.'</span>',
|
||||
'',
|
||||
'basic_options',
|
||||
true,
|
||||
false,
|
||||
'white_box_content',
|
||||
'no-border white_table_graph'.$tableClassDisabled,
|
||||
'box-flat white_table_graph invisible'
|
||||
);
|
||||
|
||||
// Advanced options.
|
||||
$tableAdvancedAgent = new stdClass();
|
||||
@ -1256,7 +1389,8 @@ ui_require_jquery_file('bgiframe');
|
||||
});
|
||||
|
||||
$("#checkbox-cascade_protection").change(function () {
|
||||
var checked = $("#checkbox-cascade_protection").is(":checked"); if (checked) {
|
||||
var checked = $("#checkbox-cascade_protection").is(":checked");
|
||||
if (checked) {
|
||||
$("#cascade_protection_module").removeAttr("disabled");
|
||||
$("#text-id_parent").attr("required", "required");
|
||||
}
|
||||
@ -1266,7 +1400,7 @@ ui_require_jquery_file('bgiframe');
|
||||
$("#text-id_parent").removeAttr("required");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var safe_mode_checked = $("#checkbox-safe_mode").is(":checked");
|
||||
if (safe_mode_checked) {
|
||||
$("#safe_mode_module").removeAttr("disabled");
|
||||
@ -1274,10 +1408,10 @@ ui_require_jquery_file('bgiframe');
|
||||
else {
|
||||
$("#safe_mode_module").attr("disabled", 'disabled');
|
||||
}
|
||||
|
||||
|
||||
$("#checkbox-safe_mode").change(function () {
|
||||
var safe_mode_checked = $("#checkbox-safe_mode").is(":checked");
|
||||
|
||||
|
||||
if (safe_mode_checked) {
|
||||
$("#safe_mode_module").removeAttr("disabled");
|
||||
}
|
||||
@ -1311,5 +1445,17 @@ ui_require_jquery_file('bgiframe');
|
||||
}
|
||||
});
|
||||
|
||||
check_basic_options();
|
||||
$('#id_os').on('change', function(){
|
||||
check_basic_options();
|
||||
})
|
||||
});
|
||||
|
||||
function check_basic_options(){
|
||||
if ($('#id_os').val() == 1 || $('#id_os').val() == 8 || $('#id_os').val() == 9) {
|
||||
$('#basic_options').removeClass('invisible');
|
||||
} else {
|
||||
$('#basic_options').addClass('invisible');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -232,7 +232,7 @@ if ($create_agent) {
|
||||
$cps = (int) get_parameter_switch('cps', -1);
|
||||
$fixed_ip = (int) get_parameter_switch('fixed_ip', 0);
|
||||
$vul_scan_enabled = (int) get_parameter_switch('vul_scan_enabled', 2);
|
||||
|
||||
$agent_version = $config['current_package'];
|
||||
$secondary_groups = (array) get_parameter('secondary_groups_selected', '');
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
||||
@ -300,6 +300,7 @@ if ($create_agent) {
|
||||
'cps' => $cps,
|
||||
'fixed_ip' => $fixed_ip,
|
||||
'vul_scan_enabled' => $vul_scan_enabled,
|
||||
'agent_version' => $agent_version,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
@ -1015,6 +1016,13 @@ if ($update_agent) {
|
||||
$satellite_server = (int) get_parameter('satellite_server', 0);
|
||||
$fixed_ip = (int) get_parameter_switch('fixed_ip', 0);
|
||||
$vul_scan_enabled = (int) get_parameter_switch('vul_scan_enabled', 2);
|
||||
$security_vunerability = (int) get_parameter_switch('security_vunerability', 0);
|
||||
$security_hardening = (int) get_parameter_switch('security_hardening', 0);
|
||||
$security_monitoring = (int) get_parameter_switch('security_monitoring', 0);
|
||||
$enable_log_collector = (int) get_parameter_switch('enable_log_collector', 0);
|
||||
$enable_inventory = (int) get_parameter_switch('enable_inventory', 0);
|
||||
$enable_basic_options = get_parameter('enable_basic_options');
|
||||
$options_package = get_parameter('options_package', '0');
|
||||
|
||||
if ($fields === false) {
|
||||
$fields = [];
|
||||
@ -1243,6 +1251,81 @@ if ($update_agent) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($enable_basic_options === '1') {
|
||||
// Get all plugins (BASIC OPTIONS).
|
||||
$agent = new PandoraFMS\Agent($id_agente);
|
||||
$plugins = $agent->getPlugins();
|
||||
foreach ($plugins as $key => $row) {
|
||||
// Only check plugins when agent package is bigger than 774.
|
||||
if ($options_package === '1') {
|
||||
if (preg_match('/pandora_hardening/', $row['raw']) === 1) {
|
||||
if ($security_hardening === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$agent->enablePlugins($row['raw']);
|
||||
}
|
||||
} else {
|
||||
if ($row['disabled'] !== 1) {
|
||||
$agent->disablePlugins($row['raw']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/(module_plugin grep_log_module ).*/', $row['raw']) === 1) {
|
||||
if ($enable_log_collector === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$agent->enablePlugins($row['raw']);
|
||||
}
|
||||
} else {
|
||||
if ($row['disabled'] !== 1) {
|
||||
$agent->disablePlugins($row['raw']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Inventory switch enable when basic options are enabled.
|
||||
if (preg_match('/(module_plugin inventory).*/', $row['raw']) === 1) {
|
||||
if ($enable_inventory === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$agent->enablePlugins($row['raw']);
|
||||
}
|
||||
} else {
|
||||
if ($row['disabled'] !== 1) {
|
||||
$agent->disablePlugins($row['raw']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Inventory switch enable when basic options are enabled.
|
||||
if (preg_match('/.vbs/', $row['raw']) === 1 && preg_match('/nettraffic.vbs/', $row['raw']) === 0 && preg_match('/software_installed.vbs/', $row['raw']) === 0 && preg_match('/df.vbs/', $row['raw']) === 0 && preg_match('/win_cf.vbs/', $row['raw']) === 0) {
|
||||
if ($enable_inventory === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$agent->enablePlugins($row['raw']);
|
||||
}
|
||||
} else {
|
||||
if ($row['disabled'] !== 1) {
|
||||
$agent->disablePlugins($row['raw']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$modules = $agent->getModules();
|
||||
foreach ($modules as $key => $row) {
|
||||
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) {
|
||||
if ($enable_log_collector === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$agent->enableModule($row['module_name'], $row);
|
||||
}
|
||||
} else {
|
||||
if ($row['disabled'] !== 1) {
|
||||
$agent->disableModule($row['module_name'], $row);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Read agent data
|
||||
@ -1300,6 +1383,19 @@ if ($id_agente) {
|
||||
$satellite_server = (int) $agent['satellite_server'];
|
||||
$fixed_ip = (int) $agent['fixed_ip'];
|
||||
$vul_scan_enabled = (int) $agent['vul_scan_enabled'];
|
||||
if (strpos($agent['agent_version'], '(')) {
|
||||
$agent_version = (int) explode('.', explode('(', $agent['agent_version'])[0])[2];
|
||||
} else {
|
||||
if (strpos($agent['agent_version'], 'build') || strpos($agent['agent_version'], 'Build')) {
|
||||
$agent_version = (int) explode('.', explode('build', $agent['agent_version'])[0])[2];
|
||||
} else {
|
||||
if (strpos($agent['agent_version'], '.')) {
|
||||
$agent_version = (int) explode('.', $agent['agent_version'])[2];
|
||||
} else {
|
||||
$agent_version = $agent['agent_version'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$update_module = (bool) get_parameter('update_module');
|
||||
|
@ -171,7 +171,7 @@ foreach ($password_fields as $k => $p) {
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
if ($("#id_plugin").val() === 0) {
|
||||
if ($("#id_plugin").val() !== 0) {
|
||||
changePluginSelect();
|
||||
}
|
||||
});
|
||||
|
@ -435,6 +435,7 @@ if ($get_agent_alerts_datatable === true) {
|
||||
}
|
||||
|
||||
$idGroup = $filter_alert['ag_group'];
|
||||
$search_sg = $filter_alert['search_sg'];
|
||||
$tag_filter = $filter_alert['tag'];
|
||||
$action_filter = $filter_alert['action'];
|
||||
|
||||
@ -658,10 +659,9 @@ if ($get_agent_alerts_datatable === true) {
|
||||
$id_groups = array_keys(
|
||||
users_get_groups($config['id_user'], 'AR', false)
|
||||
);
|
||||
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, $search_sg);
|
||||
|
||||
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter);
|
||||
|
||||
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter);
|
||||
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, $search_sg);
|
||||
}
|
||||
} else {
|
||||
if ($idAgent !== 0) {
|
||||
@ -673,9 +673,9 @@ if ($get_agent_alerts_datatable === true) {
|
||||
users_get_groups($config['id_user'], $access, false)
|
||||
);
|
||||
|
||||
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, false);
|
||||
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, false, $search_sg);
|
||||
|
||||
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, false);
|
||||
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, false, $search_sg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,324 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Generate charts with given parameters.
|
||||
*
|
||||
* @category ChartGenerator.
|
||||
* @package Pandora FMS
|
||||
* @subpackage Opensource.
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Pandora FMS
|
||||
* Please see https://pandorafms.com/community/ for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
require_once __DIR__.'/config.php';
|
||||
require_once __DIR__.'/functions.php';
|
||||
require_once __DIR__.'/functions_db.php';
|
||||
require_once __DIR__.'/auth/mysql.php';
|
||||
require_once $config['homedir'].'/include/lib/User.php';
|
||||
require_once $config['homedir'].'/include/functions_reporting.php';
|
||||
require_once $config['homedir'].'/include/functions_graph.php';
|
||||
require_once $config['homedir'].'/include/functions_custom_graphs.php';
|
||||
require_once $config['homedir'].'/include/functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_tags.php';
|
||||
|
||||
$data_raw = get_parameter('data');
|
||||
$data_decoded = json_decode(io_safe_output($data_raw), true);
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
$data = $data_decoded['data'];
|
||||
$session_id = $data_decoded['session_id'];
|
||||
$type_graph_pdf = $data_decoded['type_graph_pdf'];
|
||||
$id_user = $data_decoded['id_user'];
|
||||
$slicebar = $data_decoded['slicebar'];
|
||||
$slicebar_value = $data_decoded['slicebar_value'];
|
||||
|
||||
$data_combined = [];
|
||||
if (isset($data_decoded['data_combined']) === true) {
|
||||
$data_combined = $data_decoded['data_combined'];
|
||||
}
|
||||
|
||||
$data_module_list = [];
|
||||
if (isset($data_decoded['data_module_list']) === true) {
|
||||
$data_module_list = $data_decoded['data_module_list'];
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize session.
|
||||
global $config;
|
||||
|
||||
// Care whit this!!! check_login not working if you remove this.
|
||||
$config['id_user'] = $id_user;
|
||||
$_SESSION['id_usuario'] = $id_user;
|
||||
|
||||
// Checks for server api req.
|
||||
$bypassLogin = false;
|
||||
if ($data_decoded['apipass'] !== null
|
||||
&& ($config['server_unique_identifier'] === $_SESSION['id_usuario'])
|
||||
) {
|
||||
$apiPassword = io_output_password(
|
||||
db_get_value_filter(
|
||||
'value',
|
||||
'tconfig',
|
||||
['token' => 'api_password']
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
if ($apiPassword === $data_decoded['apipass']) {
|
||||
$bypassLogin = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($config[$slicebar])) {
|
||||
$config[$slicebar] = $slicebar_value;
|
||||
}
|
||||
|
||||
// Try to initialize session using existing php session id.
|
||||
$user = new PandoraFMS\User(['phpsessionid' => $session_id]);
|
||||
|
||||
if (check_login(false) === false && $bypassLogin !== true) {
|
||||
// Error handler.
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Access denied</title>
|
||||
<link rel="stylesheet" href="styles/pandora.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/pandora_minimal.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui.min.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<script language="javascript" type='text/javascript' src='javascript/pandora.js?v=<?php echo $config['current_package']; ?>'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/pandora_ui.js?v=<?php echo $config['current_package']; ?>'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/jquery.current.js?v=<?php echo $config['current_package']; ?>'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Access is not granted</h1>
|
||||
<div id="container-chart-generator-item" style="display:none; margin:0px;width:100px;height:100px;">
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
|
||||
// Access granted.
|
||||
$params = $data;
|
||||
if (isset($params['backgroundColor']) === false) {
|
||||
$params['backgroundColor'] = 'inherit';
|
||||
}
|
||||
|
||||
// Metaconsole connection to the node.
|
||||
$server_id = 0;
|
||||
if (isset($params['server_id']) === true) {
|
||||
$server_id = $params['server_id'];
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true && empty($server_id) === false) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
// Error connecting.
|
||||
if (metaconsole_connect($server) !== NOERR) {
|
||||
?>
|
||||
<html>
|
||||
<body>
|
||||
<?php
|
||||
ui_print_error_message(
|
||||
__('There was a problem connecting with the node')
|
||||
);
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$user_language = get_user_language($config['id_user']);
|
||||
if (file_exists('languages/'.$user_language.'.mo') === true) {
|
||||
$cfr = new CachedFileReader('languages/'.$user_language.'.mo');
|
||||
$l10n = new gettext_reader($cfr);
|
||||
$l10n->load_tables();
|
||||
}
|
||||
|
||||
$hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
|
||||
?>
|
||||
<!DOCTYPE>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Pandora FMS Graph</title>
|
||||
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/pandora.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/pandora_minimal.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/js/jquery-ui.min.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/js/jquery-ui_custom.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
||||
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/pandora_ui.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
|
||||
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/jquery.current.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
|
||||
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/jquery.pandora.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
|
||||
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/jquery-ui.min.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
|
||||
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/pandora.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.time.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.pie.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.crosshair.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.stack.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.selection.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.resize.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.threshold.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.threshold.multiple.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.symbol.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.exportdata.pandora.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.axislabels.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script type="text/javascript">
|
||||
var phpTimezone = "<?php echo date_default_timezone_get(); ?>";
|
||||
</script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/pandora.flot.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chart.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chartjs-plugin-datalabels.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
|
||||
</head>
|
||||
<body style='width:794px; margin: 0px; background-color: <?php echo $params['backgroundColor']; ?>;'>
|
||||
<?php
|
||||
$params['only_image'] = false;
|
||||
$params['menu'] = false;
|
||||
|
||||
$params['disable_black'] = true;
|
||||
$params_combined = $data_combined;
|
||||
$module_list = $data_module_list;
|
||||
|
||||
$viewport = [
|
||||
'width' => 0,
|
||||
'height' => 0,
|
||||
];
|
||||
|
||||
$style = 'width:100%;';
|
||||
if (isset($params['options']['viewport']) === true) {
|
||||
$viewport = $params['options']['viewport'];
|
||||
if (empty($viewport['width']) === false) {
|
||||
$style .= 'width:'.$viewport['width'].'px;';
|
||||
}
|
||||
|
||||
if (empty($viewport['height']) === false) {
|
||||
$style .= 'height:'.$viewport['height'].'px;';
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div id="container-chart-generator-item" style="'.$style.' margin:0px;">';
|
||||
switch ($type_graph_pdf) {
|
||||
case 'combined':
|
||||
$params['pdf'] = true;
|
||||
$result = graphic_combined_module(
|
||||
$module_list,
|
||||
$params,
|
||||
$params_combined
|
||||
);
|
||||
|
||||
echo $result;
|
||||
break;
|
||||
|
||||
case 'sparse':
|
||||
$params['pdf'] = true;
|
||||
echo grafico_modulo_sparse($params);
|
||||
break;
|
||||
|
||||
case 'pie_graph':
|
||||
$params['pdf'] = true;
|
||||
$chart = get_build_setup_charts(
|
||||
'PIE',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
echo $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'vbar_graph':
|
||||
$params['pdf'] = true;
|
||||
$chart = get_build_setup_charts(
|
||||
'BAR',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
echo $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'ring_graph':
|
||||
$params['pdf'] = true;
|
||||
$params['options']['width'] = 500;
|
||||
$params['options']['height'] = 500;
|
||||
|
||||
$chart = get_build_setup_charts(
|
||||
'DOUGHNUT',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
echo $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'line_graph':
|
||||
$params['pdf'] = true;
|
||||
$params['options']['width'] = '100%';
|
||||
$params['options']['height'] = 200;
|
||||
$chart = get_build_setup_charts(
|
||||
'LINE',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
echo $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'slicebar':
|
||||
// TO-DO Cambiar esto para que se pase por POST, NO SE PUEDE PASAR POR GET.
|
||||
$params['graph_data'] = json_decode(io_safe_output($config[$params['tokem_config']]), true);
|
||||
delete_config_token($params['tokem_config']);
|
||||
echo flot_slicesbar_graph(
|
||||
$params['graph_data'],
|
||||
$params['period'],
|
||||
$params['width'],
|
||||
$params['height'],
|
||||
$params['legend'],
|
||||
$params['colors'],
|
||||
$params['fontpath'],
|
||||
$params['round_corner'],
|
||||
$params['homeurl'],
|
||||
$params['watermark'],
|
||||
$params['adapt_key'],
|
||||
$params['stat_winalse'],
|
||||
$params['id_agent'],
|
||||
$params['full_legend_daterray'],
|
||||
$params['not_interactive'],
|
||||
$params['ttl'],
|
||||
$params['sizeForTicks'],
|
||||
$params['show'],
|
||||
$params['date_to'],
|
||||
$params['server_id']
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Code...
|
||||
break;
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
?>
|
||||
</body>
|
||||
</html>
|
@ -2383,7 +2383,7 @@ class ConsoleSupervisor
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION',
|
||||
'title' => __('This instance is not registered in the Update manager section'),
|
||||
'title' => __('This instance is not registered in the Warp Update section'),
|
||||
'message' => __('Click here to start the registration process'),
|
||||
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
]
|
||||
|
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC231201';
|
||||
$build_version = 'PC231205';
|
||||
$pandora_version = 'v7.0NG.774';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -4390,48 +4390,22 @@ function generator_chart_to_pdf(
|
||||
$module_list=false
|
||||
) {
|
||||
global $config;
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$hack_metaconsole = '';
|
||||
if (is_metaconsole() === true) {
|
||||
$hack_metaconsole = '../..';
|
||||
} else {
|
||||
$hack_metaconsole = '';
|
||||
}
|
||||
|
||||
$url = ui_get_full_url(false).$hack_metaconsole.'/include/chart_generator.php';
|
||||
|
||||
if (!$params['return_img_base_64']) {
|
||||
$img_file = 'img_'.uniqid().'.png';
|
||||
$img_path = $config['homedir'].'/attachment/'.$img_file;
|
||||
$img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file;
|
||||
}
|
||||
|
||||
$session_id = session_id();
|
||||
if ($type_graph_pdf === 'combined') {
|
||||
$data = [
|
||||
'data' => $params,
|
||||
'session_id' => $session_id,
|
||||
'type_graph_pdf' => $type_graph_pdf,
|
||||
'data_module_list' => $module_list,
|
||||
'data_combined' => $params_combined,
|
||||
'id_user' => $config['id_user'],
|
||||
'slicebar' => $_SESSION['slicebar'],
|
||||
'slicebar_value' => $config[$_SESSION['slicebar']],
|
||||
'apipass' => get_parameter('apipass', null),
|
||||
|
||||
];
|
||||
} else {
|
||||
$data = [
|
||||
'data' => $params,
|
||||
'session_id' => $session_id,
|
||||
'type_graph_pdf' => $type_graph_pdf,
|
||||
'id_user' => $config['id_user'],
|
||||
'slicebar' => $_SESSION['slicebar'],
|
||||
'slicebar_value' => $config[$_SESSION['slicebar']],
|
||||
'apipass' => get_parameter('apipass', null),
|
||||
];
|
||||
if ($type_graph_pdf !== 'combined') {
|
||||
$params_combined = [];
|
||||
$module_list = [];
|
||||
}
|
||||
|
||||
unset($data['data']['graph_data']);
|
||||
// If not install chromium avoid 500 convert tu images no data to show.
|
||||
$chromium_dir = io_safe_output($config['chromium_path']);
|
||||
$result_ejecution = exec($chromium_dir.' --version');
|
||||
@ -4451,22 +4425,16 @@ function generator_chart_to_pdf(
|
||||
|
||||
// Creates a new page.
|
||||
$page = $browser->createPage();
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, ['data' => json_encode($data)]);
|
||||
// Generate Html.
|
||||
$html = chart_generator(
|
||||
$type_graph_pdf,
|
||||
$params,
|
||||
$params_combined,
|
||||
$module_list
|
||||
);
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
$page->setHtml($response);
|
||||
/*
|
||||
//For debug url with parameters.
|
||||
$navigation = $page->navigate($url.'?data='.urlencode(json_encode($data)));
|
||||
$navigation->waitForNavigation(Page::DOM_CONTENT_LOADED);
|
||||
*/
|
||||
$page->setHtml($html);
|
||||
|
||||
// Dynamic.
|
||||
$dynamic_height = $page->evaluate('document.getElementById("container-chart-generator-item").clientHeight')->getReturnValue();
|
||||
@ -4513,6 +4481,211 @@ function generator_chart_to_pdf(
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Html print chart for chromium
|
||||
*
|
||||
* @param string $type_graph_pdf Chart mode.
|
||||
* @param array $params Params.
|
||||
* @param array $params_combined Params Combined charts.
|
||||
* @param array $module_list Module list Combined charts.
|
||||
*
|
||||
* @return string Output Html.
|
||||
*/
|
||||
function chart_generator(
|
||||
string $type_graph_pdf,
|
||||
array $params,
|
||||
array $params_combined=[],
|
||||
array $module_list=[]
|
||||
) : string {
|
||||
global $config;
|
||||
|
||||
include_once $config['homedir'].'/include/graphs/functions_d3.php';
|
||||
|
||||
if (isset($params['backgroundColor']) === false) {
|
||||
$params['backgroundColor'] = 'inherit';
|
||||
}
|
||||
|
||||
$hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
|
||||
|
||||
$output = '<!DOCTYPE>';
|
||||
$output .= '<html>';
|
||||
$output .= '<head>';
|
||||
$output .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
|
||||
$output .= '<title>Pandora FMS Graph</title>';
|
||||
$output .= '<script type="text/javascript">';
|
||||
$output .= 'var phpTimezone = "'.date_default_timezone_get().'";';
|
||||
$output .= 'var configHomeurl = "'.((is_metaconsole() === false) ? $config['homeurl'] : '../../').'";';
|
||||
$output .= '</script>';
|
||||
|
||||
$css_files = [
|
||||
'pandora' => 'include/styles/',
|
||||
'pandora_minimal' => 'include/styles/',
|
||||
'jquery-ui.min' => 'include/styles/js/',
|
||||
'jquery-ui_custom' => 'include/styles/js/',
|
||||
];
|
||||
|
||||
foreach ($css_files as $name => $path) {
|
||||
$output .= ui_require_css_file($name, $path, true, true);
|
||||
}
|
||||
|
||||
$js_files = [
|
||||
'pandora_ui' => 'include/javascript/',
|
||||
'jquery.current' => 'include/javascript/',
|
||||
'jquery.pandora' => 'include/javascript/',
|
||||
'jquery-ui.min' => 'include/javascript/',
|
||||
'date' => 'include/javascript/timezone/src/',
|
||||
'pandora' => 'include/javascript/',
|
||||
'jquery.flot' => 'include/graphs/flot/',
|
||||
'jquery.flot.min' => 'include/graphs/flot/',
|
||||
'jquery.flot.time' => 'include/graphs/flot/',
|
||||
'jquery.flot.pie' => 'include/graphs/flot/',
|
||||
'jquery.flot.crosshair.min' => 'include/graphs/flot/',
|
||||
'jquery.flot.stack.min' => 'include/graphs/flot/',
|
||||
'jquery.flot.selection.min' => 'include/graphs/flot/',
|
||||
'jquery.flot.resize.min' => 'include/graphs/flot/',
|
||||
'jquery.flot.threshold' => 'include/graphs/flot/',
|
||||
'jquery.flot.threshold.multiple' => 'include/graphs/flot/',
|
||||
'jquery.flot.symbol.min' => 'include/graphs/flot/',
|
||||
'jquery.flot.exportdata.pandora' => 'include/graphs/flot/',
|
||||
'jquery.flot.axislabels' => 'include/graphs/flot/',
|
||||
'pandora.flot' => 'include/graphs/flot/',
|
||||
'chart' => 'include/graphs/chartjs/',
|
||||
'chartjs-plugin-datalabels.min' => 'include/graphs/chartjs/',
|
||||
];
|
||||
|
||||
foreach ($js_files as $name => $path) {
|
||||
$output .= ui_require_javascript_file($name, $path, true, true);
|
||||
}
|
||||
|
||||
$output .= include_javascript_d3(true, true);
|
||||
|
||||
$output .= '</head>';
|
||||
$output .= '<body style="width:794px; margin: 0px; background-color:'.$params['backgroundColor'].';">';
|
||||
$params['only_image'] = false;
|
||||
$params['menu'] = false;
|
||||
$params['disable_black'] = true;
|
||||
|
||||
$viewport = [
|
||||
'width' => 0,
|
||||
'height' => 0,
|
||||
];
|
||||
|
||||
$style = 'width:100%;';
|
||||
if (isset($params['options']['viewport']) === true) {
|
||||
$viewport = $params['options']['viewport'];
|
||||
if (empty($viewport['width']) === false) {
|
||||
$style .= 'width:'.$viewport['width'].'px;';
|
||||
}
|
||||
|
||||
if (empty($viewport['height']) === false) {
|
||||
$style .= 'height:'.$viewport['height'].'px;';
|
||||
}
|
||||
}
|
||||
|
||||
$output .= '<div id="container-chart-generator-item" style="'.$style.' margin:0px;">';
|
||||
switch ($type_graph_pdf) {
|
||||
case 'combined':
|
||||
$params['pdf'] = true;
|
||||
$result = graphic_combined_module(
|
||||
$module_list,
|
||||
$params,
|
||||
$params_combined
|
||||
);
|
||||
|
||||
$output .= $result;
|
||||
break;
|
||||
|
||||
case 'sparse':
|
||||
$params['pdf'] = true;
|
||||
$output .= grafico_modulo_sparse($params);
|
||||
break;
|
||||
|
||||
case 'pie_graph':
|
||||
$params['pdf'] = true;
|
||||
$chart = get_build_setup_charts(
|
||||
'PIE',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
$output .= $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'vbar_graph':
|
||||
$params['pdf'] = true;
|
||||
$chart = get_build_setup_charts(
|
||||
'BAR',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
$output .= $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'ring_graph':
|
||||
$params['pdf'] = true;
|
||||
$params['options']['width'] = 500;
|
||||
$params['options']['height'] = 500;
|
||||
|
||||
$chart = get_build_setup_charts(
|
||||
'DOUGHNUT',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
$output .= $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'line_graph':
|
||||
$params['pdf'] = true;
|
||||
$params['options']['width'] = '100%';
|
||||
$params['options']['height'] = 200;
|
||||
$chart = get_build_setup_charts(
|
||||
'LINE',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
$output .= $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'slicebar':
|
||||
$output .= flot_slicesbar_graph(
|
||||
$params['graph_data'],
|
||||
$params['period'],
|
||||
$params['width'],
|
||||
$params['height'],
|
||||
$params['legend'],
|
||||
$params['colors'],
|
||||
$params['fontpath'],
|
||||
$params['round_corner'],
|
||||
$params['homeurl'],
|
||||
$params['watermark'],
|
||||
$params['adapt_key'],
|
||||
$params['stat_winalse'],
|
||||
$params['id_agent'],
|
||||
$params['full_legend_daterray'],
|
||||
$params['not_interactive'],
|
||||
$params['ttl'],
|
||||
$params['sizeForTicks'],
|
||||
$params['show'],
|
||||
$params['date_to'],
|
||||
$params['server_id']
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Code...
|
||||
break;
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
$output .= '</body>';
|
||||
$output .= '</html>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the product name.
|
||||
*
|
||||
|
@ -2169,13 +2169,16 @@ function get_group_alerts(
|
||||
$strict_user=false,
|
||||
$tag=false,
|
||||
$action_filter=false,
|
||||
$alert_action=true
|
||||
$alert_action=true,
|
||||
$search_sg=false
|
||||
) {
|
||||
global $config;
|
||||
|
||||
$group_query = '';
|
||||
if (!empty($idGroup)) {
|
||||
$group_query = ' AND id_grupo = '.$idGroup;
|
||||
if ((bool) $search_sg === true) {
|
||||
$group_query .= ' OR tasg.id_group = '.$idGroup;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($filter)) {
|
||||
|
@ -82,7 +82,7 @@ function parseOtherParameter($other, $otherType, $rawDecode)
|
||||
case 'url_encode':
|
||||
$returnVar = [
|
||||
'type' => 'string',
|
||||
'data' => urldecode($other),
|
||||
'data' => $rawDecode ? rawurldecode($other) : urldecode($other),
|
||||
];
|
||||
break;
|
||||
|
||||
|
@ -1003,7 +1003,7 @@ if (is_ajax()) {
|
||||
$dialogButtons = [];
|
||||
|
||||
$dialogButtons[] = html_print_button(
|
||||
__('Update manager'),
|
||||
__('Warp update'),
|
||||
'update_manager',
|
||||
false,
|
||||
'location.href="'.ui_get_full_url('/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=history', false, false, false).'"',
|
||||
|
@ -251,6 +251,11 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent,
|
||||
unset($new_module['id_agente_modulo']);
|
||||
unset($new_module['id_agente']);
|
||||
|
||||
// Set debug content.
|
||||
if (empty($new_module['debug_content']) === false) {
|
||||
$new_module['debug_content'] = str_replace("'", '"', $new_module['debug_content']);
|
||||
}
|
||||
|
||||
$id_new_module = modules_create_agent_module(
|
||||
$id_destiny_agent,
|
||||
$new_module['nombre'],
|
||||
|
@ -1066,7 +1066,7 @@ function notification_filter()
|
||||
break;
|
||||
|
||||
case 'UPDATEMANAGER':
|
||||
$type_name = 'UPDATE MANAGER';
|
||||
$type_name = 'WARP UPDATE';
|
||||
break;
|
||||
|
||||
case 'ALLOWOVERRIDE':
|
||||
|
@ -1011,12 +1011,12 @@ function reports_get_report_types($template=false, $not_editor=false)
|
||||
|
||||
$types['vuls_attack_complexity'] = [
|
||||
'optgroup' => __('Vulnerabilities'),
|
||||
'name' => __('Attack complexity graph donut'),
|
||||
'name' => __('Attack complexity doughnut chart'),
|
||||
];
|
||||
|
||||
$types['vuls_by_packages'] = [
|
||||
'optgroup' => __('Vulnerabilities'),
|
||||
'name' => __('By packages in graph pie'),
|
||||
'name' => __('By packages in pie chart'),
|
||||
];
|
||||
|
||||
$types['vuls_by_agent'] = [
|
||||
|
@ -1978,15 +1978,21 @@ function ui_print_help_icon(
|
||||
*
|
||||
* @return boolean True if the file was added. False if the file doesn't exist.
|
||||
*/
|
||||
function ui_require_css_file($name, $path='include/styles/', $echo_tag=false)
|
||||
function ui_require_css_file($name, $path='include/styles/', $echo_tag=false, $return=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$filename = $path.$name.'.css';
|
||||
|
||||
if ($echo_tag === true) {
|
||||
echo '<link type="text/css" rel="stylesheet" href="'.ui_get_full_url($filename, false, false, false).'">';
|
||||
return null;
|
||||
$filename .= '?v='.$config['current_package'];
|
||||
$tag_name = '<link type="text/css" rel="stylesheet" href="'.ui_get_full_url($filename, false, false, false).'">';
|
||||
if ($return === false) {
|
||||
echo $tag_name;
|
||||
return null;
|
||||
} else {
|
||||
return $tag_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (! isset($config['css'])) {
|
||||
@ -2035,15 +2041,20 @@ function ui_require_css_file($name, $path='include/styles/', $echo_tag=false)
|
||||
*
|
||||
* @return boolean True if the file was added. False if the file doesn't exist.
|
||||
*/
|
||||
function ui_require_javascript_file($name, $path='include/javascript/', $echo_tag=false)
|
||||
function ui_require_javascript_file($name, $path='include/javascript/', $echo_tag=false, $return=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$filename = $path.$name.'.js';
|
||||
|
||||
if ($echo_tag) {
|
||||
echo '<script type="text/javascript" src="'.ui_get_full_url($filename, false, false, false).'"></script>';
|
||||
return null;
|
||||
if ($echo_tag === true) {
|
||||
$filename .= '?v='.$config['current_package'];
|
||||
$tag_name = '<script type="text/javascript" src="'.ui_get_full_url($filename, false, false, false).'"></script>';
|
||||
if ($return === false) {
|
||||
echo $tag_name;
|
||||
return null;
|
||||
} else {
|
||||
return $tag_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (! isset($config['js'])) {
|
||||
|
@ -1004,6 +1004,13 @@ function get_build_setup_charts($type, $options, $data)
|
||||
}
|
||||
}
|
||||
|
||||
// Set display grid true or false.
|
||||
if (isset($options['grid']) === true) {
|
||||
$scales = $chart->options()->getScales();
|
||||
$scales->getX()->grid()->setDrawOnChartArea($options['grid']);
|
||||
$scales->getY()->grid()->setDrawOnChartArea($options['grid']);
|
||||
}
|
||||
|
||||
// Radius is null maximum possible.
|
||||
if (isset($options['radius']) === true
|
||||
&& empty($options['radius']) === false
|
||||
|
@ -11,14 +11,14 @@
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
function include_javascript_d3($return=false)
|
||||
function include_javascript_d3($return=false, $force=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
static $is_include_javascript = false;
|
||||
|
||||
$output = '';
|
||||
if (!$is_include_javascript) {
|
||||
if (!$is_include_javascript || $force === true) {
|
||||
$is_include_javascript = true;
|
||||
|
||||
$output .= '<script type="text/javascript" src="';
|
||||
|
@ -756,9 +756,8 @@ function flot_slicesbar_graph(
|
||||
global $config;
|
||||
|
||||
if ($ttl == 2) {
|
||||
$tokem_config = uniqid('slicebar');
|
||||
$params = [
|
||||
'tokem_config' => $tokem_config,
|
||||
'graph_data' => $graph_data,
|
||||
'period' => $period,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
@ -781,9 +780,6 @@ function flot_slicesbar_graph(
|
||||
'server_id' => $server_id,
|
||||
];
|
||||
|
||||
update_check_config_token($tokem_config, json_encode($graph_data));
|
||||
$_SESSION['slicebar'] = $tokem_config;
|
||||
$_SESSION['slicebar_value'] = json_encode($graph_data);
|
||||
$graph = '<img src="data:image/png;base64,';
|
||||
$graph .= generator_chart_to_pdf('slicebar', $params);
|
||||
$graph .= '" />';
|
||||
|
@ -581,6 +581,12 @@ class EventsListWidget extends Widget
|
||||
$customFilter = \events_get_event_filter($this->values['customFilter']);
|
||||
if ($customFilter !== false) {
|
||||
$filter = $customFilter;
|
||||
if (in_array('0', $this->values['groupId'])) {
|
||||
$filter['id_group_filter'] = 0;
|
||||
} else {
|
||||
$filter['id_group_filter'] = (!empty($this->values['groupId'][0])) ? $this->values['groupId'] : 0;
|
||||
}
|
||||
|
||||
$filter['tag_with'] = base64_encode(
|
||||
io_safe_output($filter['tag_with'])
|
||||
);
|
||||
|
@ -12866,6 +12866,12 @@ tr.shown td.details-control {
|
||||
top: -92px;
|
||||
}
|
||||
|
||||
.basic-options-disabled tr > td,
|
||||
.basic-options-disabled tr > td > div > label {
|
||||
color: gray;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#cluetip-inner > #example {
|
||||
position: absolute;
|
||||
margin-left: 5px;
|
||||
|
@ -132,6 +132,11 @@
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#filter-agent-security div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
@media (max-width: 1500px) {
|
||||
.col-md-3 {
|
||||
width: 40%;
|
||||
|
@ -131,7 +131,7 @@
|
||||
<div style='padding-bottom: 50px'>
|
||||
<?php
|
||||
$version = '7.0NG.774';
|
||||
$build = '231201';
|
||||
$build = '231205';
|
||||
$banner = "v$version Build $build";
|
||||
error_reporting(0);
|
||||
|
||||
|
@ -66,7 +66,8 @@ function printFormFilterAlert(
|
||||
$action_filter=false,
|
||||
$return=false,
|
||||
$strict_user=false,
|
||||
$access='AR'
|
||||
$access='AR',
|
||||
$search_sg=0
|
||||
) {
|
||||
global $config;
|
||||
include_once $config['homedir'].'/include/functions_tags.php';
|
||||
@ -160,7 +161,12 @@ function printFormFilterAlert(
|
||||
$callbackTag
|
||||
);
|
||||
|
||||
$table->data[1][0] = html_print_label_input_block(
|
||||
$table->data[3][0] = html_print_label_input_block(
|
||||
__('Also search in secondary groups'),
|
||||
html_print_checkbox_switch_extended('search_sg', 0, 0, false, '', '', true)
|
||||
);
|
||||
|
||||
$table->data[2][0] = html_print_label_input_block(
|
||||
__('Free text for search').ui_print_help_tip(
|
||||
__('Filter by agent name, module name, template name or action name'),
|
||||
true
|
||||
@ -168,7 +174,7 @@ function printFormFilterAlert(
|
||||
html_print_input_text('free_search', $free_search, '', 20, 40, true)
|
||||
);
|
||||
|
||||
$table->data[1][1] = html_print_label_input_block(
|
||||
$table->data[2][1] = html_print_label_input_block(
|
||||
__('Standby'),
|
||||
html_print_select(
|
||||
$alert_standby,
|
||||
@ -187,7 +193,7 @@ function printFormFilterAlert(
|
||||
);
|
||||
|
||||
$alert_action = alerts_get_alert_actions_filter();
|
||||
$table->data[1][2] = html_print_label_input_block(
|
||||
$table->data[2][2] = html_print_label_input_block(
|
||||
__('Action'),
|
||||
html_print_select(
|
||||
$alert_action,
|
||||
|
@ -58,7 +58,7 @@ $filter_standby = get_parameter('standby', 'all');
|
||||
$id_group = (int) get_parameter('ag_group', 0);
|
||||
// 0 is the All group (selects all groups)
|
||||
$free_search = get_parameter('free_search', '');
|
||||
|
||||
$search_sg = get_parameter('search_sg', 0);
|
||||
$user_tag_array = tags_get_user_tags($config['id_user'], 'AR', true);
|
||||
|
||||
if ($user_tag_array) {
|
||||
@ -578,6 +578,14 @@ $(document).ready ( function () {
|
||||
});
|
||||
});
|
||||
|
||||
$('#checkbox-search_sg').click(function(){
|
||||
if ($('#checkbox-search_sg').val() == 0) {
|
||||
$('#checkbox-search_sg').val(1);
|
||||
}else {
|
||||
$('#checkbox-search_sg').val(0);
|
||||
}
|
||||
});
|
||||
|
||||
$('table.alert-status-filter #ag_group').change (function () {
|
||||
var strict_user = $("#text-strict_user_hidden").val();
|
||||
var is_meta = $("#text-is_meta_hidden").val();
|
||||
|
@ -1890,6 +1890,13 @@ if (enterprise_hook(
|
||||
'eventos',
|
||||
'execute_event_responses',
|
||||
]
|
||||
) === false && enterprise_hook(
|
||||
'enterprise_acl',
|
||||
[
|
||||
$config['id_user'],
|
||||
'eventos',
|
||||
'operation/events/events',
|
||||
]
|
||||
) === false
|
||||
) {
|
||||
$readonly = true;
|
||||
|
@ -774,7 +774,7 @@ if ($access_console_node === true) {
|
||||
|
||||
// Check if was displayed inside other menu.
|
||||
if ($extension['operation_menu']['fatherId'] == '') {
|
||||
if ($extension_menu['name'] == 'Update manager') {
|
||||
if ($extension_menu['name'] == 'Warp update') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
%define debug_package %{nil}
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.774
|
||||
%define release 231201
|
||||
%define release 231205
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -6,7 +6,7 @@
|
||||
%define debug_package %{nil}
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.774
|
||||
%define release 231201
|
||||
%define release 231205
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.774
|
||||
%define release 231201
|
||||
%define release 231205
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 7.0NG.774-231201
|
||||
Version: 7.0NG.774-231205
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.774-231201"
|
||||
pandora_version="7.0NG.774-231205"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.774";
|
||||
my $pandora_build = "231201";
|
||||
my $pandora_build = "231205";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.774";
|
||||
my $pandora_build = "231201";
|
||||
my $pandora_build = "231205";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -181,6 +181,7 @@ our @EXPORT = qw(
|
||||
check_cron_value
|
||||
check_cron_element
|
||||
cron_check
|
||||
p_pretty_json
|
||||
);
|
||||
|
||||
# ID of the different servers
|
||||
@ -2977,6 +2978,18 @@ sub get_server_name {
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Pretty print json.
|
||||
################################################################################
|
||||
sub p_pretty_json {
|
||||
my ($data) = @_;
|
||||
|
||||
# Initialize JSON manager.
|
||||
my $j = JSON->new->utf8(1)->pretty(1)->indent(1);
|
||||
my $output = $j->encode($data);
|
||||
|
||||
return $output;
|
||||
}
|
||||
1;
|
||||
__END__
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
%define debug_package %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.774
|
||||
%define release 231201
|
||||
%define release 231205
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.774
|
||||
%define release 231201
|
||||
%define release 231205
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -9,7 +9,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.774"
|
||||
PI_BUILD="231201"
|
||||
PI_BUILD="231205"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
@ -38,7 +38,7 @@ use PandoraFMS::Config;
|
||||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.774 Build 231201";
|
||||
my $version = "7.0NG.774 Build 231205";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
@ -142,10 +142,18 @@ sub pandora_purgedb ($$$) {
|
||||
# Delete manually disabled agents after some period
|
||||
if (defined ($conf->{'_delete_disabled_agents'}) && $conf->{'_delete_disabled_agents'} > 0) {
|
||||
log_message('PURGE', "Deleting old disabled agents (More than " . $conf->{'_delete_disabled_agents'} . " days).");
|
||||
db_do ($dbh, "DELETE FROM tagente
|
||||
WHERE UNIX_TIMESTAMP(ultimo_contacto) + ? < UNIX_TIMESTAMP(NOW())
|
||||
AND disabled = 1
|
||||
AND modo != 2", $conf->{'_delete_disabled_agents'} * 8600);
|
||||
my @agents_to_delete = get_db_rows (
|
||||
$dbh,
|
||||
"SELECT id_agente FROM tagente
|
||||
WHERE UNIX_TIMESTAMP(ultimo_contacto) + ? < UNIX_TIMESTAMP(NOW())
|
||||
AND disabled = 1
|
||||
AND modo != 2",
|
||||
$conf->{'_delete_disabled_agents'} * 8600
|
||||
);
|
||||
|
||||
foreach my $agent_to_delete (@agents_to_delete) {
|
||||
pandora_delete_agent($dbh, $agent_to_delete->{'id_agente'}, $conf);
|
||||
}
|
||||
}
|
||||
|
||||
# Delete old data
|
||||
@ -322,14 +330,22 @@ sub pandora_purgedb ($$$) {
|
||||
AND id_rc NOT IN (SELECT id_report_content FROM treport_content_sla_combined)");
|
||||
}
|
||||
|
||||
|
||||
# Delete disabled autodisable agents after some period
|
||||
log_message ('PURGE', 'Delete autodisabled agents where last contact is bigger than ' . $conf->{'_days_autodisable_deletion'} . ' days.');
|
||||
db_do ($dbh, "DELETE FROM tagente
|
||||
WHERE UNIX_TIMESTAMP(ultimo_contacto) + ? < UNIX_TIMESTAMP(NOW())
|
||||
AND disabled=1
|
||||
AND modo=2", $conf->{'_days_autodisable_deletion'}*8600);
|
||||
|
||||
# Delete disabled autodisable agents after some period
|
||||
if (defined ($conf->{'_days_autodisable_deletion'}) && $conf->{'_days_autodisable_deletion'} > 0) {
|
||||
log_message ('PURGE', 'Delete autodisabled agents where last contact is bigger than ' . $conf->{'_days_autodisable_deletion'} . ' days.');
|
||||
my @agents_autodisable_to_delete = get_db_rows (
|
||||
$dbh,
|
||||
"SELECT id_agente FROM tagente
|
||||
WHERE UNIX_TIMESTAMP(ultimo_contacto) + ? < UNIX_TIMESTAMP(NOW())
|
||||
AND disabled = 1
|
||||
AND modo = 2",
|
||||
$conf->{'_days_autodisable_deletion'} * 8600
|
||||
);
|
||||
|
||||
foreach my $agent_autodisable_to_delete (@agents_autodisable_to_delete) {
|
||||
pandora_delete_agent($dbh, $agent_autodisable_to_delete->{'id_agente'}, $conf);
|
||||
}
|
||||
}
|
||||
|
||||
# Delete old netflow data
|
||||
if (!defined($conf->{'_netflow_max_lifetime'})){
|
||||
@ -442,7 +458,7 @@ sub pandora_compactdb {
|
||||
|
||||
my $last_compact_offset = pandora_get_config_value($dbh, "last_compact_offset");
|
||||
|
||||
unless ($last_compact_offset) {
|
||||
if ($last_compact_offset eq "") {
|
||||
db_do($dbh, "INSERT INTO tconfig (token, value) VALUES ('last_compact_offset', '0')");
|
||||
$last_compact_offset = 0;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
||||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.774 Build 231201";
|
||||
my $version = "7.0NG.774 Build 231205";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user