Merge remote-tracking branch 'origin/develop' into ent-11471-integracion-pandora-integria

Conflicts:
	pandora_console/include/functions_menu.php
This commit is contained in:
daniel 2023-09-08 13:11:52 +02:00
commit ce0468b37e
54 changed files with 1999 additions and 245 deletions

View File

@ -78,16 +78,16 @@ cd unix && ./pandora_agent_installer --install
}
install_autodiscover () {
local arch=$1
wget http://firefly.pandorafms.com/projects/autodiscover-linux.zip
unzip autodiscover-linux.zip
chmod +x $arch/autodiscover
mv -f $arch/autodiscover /etc/pandora/plugins/autodiscover
}
# install_autodiscover () {
# local arch=$1
# wget http://firefly.pandorafms.com/projects/autodiscover-linux.zip
# unzip autodiscover-linux.zip
# chmod +x $arch/autodiscover
# mv -f $arch/autodiscover /etc/pandora/plugins/autodiscover
# }
## Main
echo "Starting PandoraFMS Agent deployment ver. $S_VERSION"
echo "Starting PandoraFMS Agent binary deployment ver. $S_VERSION"
execute_cmd "[ $PANDORA_SERVER_IP ]" 'Check Server IP Address' 'Please define env variable PANDORA_SERVER_IP'
@ -104,8 +104,6 @@ OS=$([[ $(grep '^ID_LIKE=' /etc/os-release) ]] && grep ^ID_LIKE= /etc/os-release
[[ $OS =~ 'rhel' ]] && OS_RELEASE=$OS
[[ $OS =~ 'fedora' ]] && OS_RELEASE=$OS
[[ $OS =~ 'debian' ]] && OS_RELEASE=$OS
#[[ $OS == 'rhel fedora' ]] && OS_RELEASE=$OS
#[[ $OS == 'centos rhel fedora' ]] && OS_RELEASE=$OS
# initialice logfile
execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE"
@ -126,6 +124,30 @@ check_repo_connection
execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed'
# Arch check
arch=$(uname -m)
case $arch in
x86_64)
echo -e "${cyan}Arch: $arch ${reset} "
;;
x86)
echo -e "${yellow}Skiping installation arch: $arch not suported by binary agent please consider to install source agent${reset}"
exit -1
;;
armv7l)
echo -e "${yellow}Skiping installation arch: $arch not suported by binary agent please consider to install source agent${reset}"
exit -1
;;
*)
echo -e "${yellow}Skiping installation arch: $arch not suported by binary agent please consider to install source agent${reset}"
exit -1
;;
esac
# Creating working directory
rm -rf $HOME/pandora_deploy_tmp/ &>> $LOGFILE
mkdir $HOME/pandora_deploy_tmp &>> $LOGFILE
@ -148,6 +170,10 @@ if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then
# Check rh version
if [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '8' ] ; then
package_manager_cmd=dnf
execute_cmd "$package_manager_cmd install -y libnsl" "Installing dependencies"
elif [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '9' ] ; then
package_manager_cmd=dnf
execute_cmd "$package_manager_cmd install -y libnsl libxcrypt-compat" "Installing dependencies"
elif [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '7' ] ; then
package_manager_cmd=yum
@ -158,24 +184,23 @@ if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then
echo -e "${cyan}Installing agent dependencies...${reset}" ${green}OK${reset}
# Insatall pandora agent
$package_manager_cmd install -y http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm &>> $LOGFILE
echo -en "${cyan}Installing Pandora FMS agent...${reset}"
check_cmd_status 'Error installing Pandora FMS agent'
[[ $PANDORA_AGENT_SSL ]] && execute_cmd "$package_manager_cmd install -y perl-IO-Socket-SSL" "Installing SSL libraries for encrypted connection"
[ "$PANDORA_AGENT_PACKAGE_EL" ] || PANDORA_AGENT_PACKAGE_EL="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm "
execute_cmd "$package_manager_cmd install -y ${PANDORA_AGENT_PACKAGE_EL}" 'Installing Pandora FMS agent package'
#[[ $PANDORA_AGENT_SSL ]] && execute_cmd "$package_manager_cmd install -y perl-IO-Socket-SSL" "Installing SSL libraries for encrypted connection"
fi
if [[ $OS_RELEASE == 'debian' ]]; then
[ "$PANDORA_AGENT_PACKAGE_UBUNTU" ] || PANDORA_AGENT_PACKAGE_UBUNTU='https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG_x86_64.tar.gz'
execute_cmd "apt update" 'Updating repos'
execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Installing agent dependencies'
execute_cmd 'wget http://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz' 'Downloading Pandora FMS agent package'
execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Installing agent dependencies'
execute_cmd "curl --output pandorafms_agent_linux-7.0NG.tar.gz ${PANDORA_AGENT_PACKAGE_UBUNTU}" 'Downloading Pandora FMS agent package'
execute_cmd 'install_tarball pandorafms_agent_linux-7.0NG.tar.gz' 'Installing Pandora FMS agent'
[[ $PANDORA_AGENT_SSL ]] && execute_cmd 'apt install -y libio-socket-ssl-perl' "Installing SSL libraries for encrypted connection"
#[[ $PANDORA_AGENT_SSL ]] && execute_cmd 'apt install -y libio-socket-ssl-perl' "Installing SSL libraries for encrypted connection"
cd $HOME/pandora_deploy_tmp
fi
# Configuring Agente
[[ $PANDORA_SERVER_IP ]] && sed -i "s/^server_ip.*$/server_ip $PANDORA_SERVER_IP/g" $PANDORA_AGENT_CONF
[[ $PANDORA_REMOTE_CONFIG ]] && sed -i "s/^remote_config.*$/remote_config $PANDORA_REMOTE_CONFIG/g" $PANDORA_AGENT_CONF
[[ $PANDORA_GROUP ]] && sed -i "s/^group.*$/group $PANDORA_GROUP/g" $PANDORA_AGENT_CONF
@ -187,27 +212,6 @@ fi
[[ $PANDORA_AGENT_SSL ]] && sed -i "s/^#server_ssl.*$/server_ssl $PANDORA_AGENT_SSL/g" $PANDORA_AGENT_CONF
#installing autodiscover
arch=$(uname -m)
case $arch in
x86_64)
execute_cmd 'install_autodiscover x86_64' "installing service autodiscover on $arch" 'Error unable to install autodiscovery'
;;
x86)
execute_cmd 'install_autodiscover x84' "installing service autodiscover on $arch" 'Error unable to install autodiscovery'
;;
armv7l)
echo -e "${cyan}Skiping autodiscover installation arch $arch not suported${reset}"
;;
*)
echo -e "${yellow}Skiping autodiscover installation arch $arch not suported${reset}"
;;
esac
#Starting pandora agent daemon.
execute_cmd '/etc/init.d/pandora_agent_daemon restart' 'Starting Pandora Agent'

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.773.3-230906
Version: 7.0NG.773.3-230908
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.773.3-230906"
pandora_version="7.0NG.773.3-230908"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1031,7 +1031,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.773.3';
use constant AGENT_BUILD => '230906';
use constant AGENT_BUILD => '230908';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230906
%define release 230908
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230906
%define release 230908
Summary: Pandora FMS Linux agent, binary version
Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230906
%define release 230908
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.773.3"
PI_BUILD="230906"
PI_BUILD="230908"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230906}
{230908}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.773.3 Build 230906")
#define PANDORA_VERSION ("7.0NG.773.3 Build 230908")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.773.3(Build 230906))"
VALUE "ProductVersion", "(7.0NG.773.3(Build 230908))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.773.3-230906
Version: 7.0NG.773.3-230908
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.773.3-230906"
pandora_version="7.0NG.773.3-230908"
package_pear=0
package_pandora=1

View File

@ -1459,13 +1459,13 @@ if ($update_module === true || $create_module === true) {
$plugin_pass = io_input_password(
(string) get_parameter('snmp3_auth_pass')
);
$plugin_parameter = (string) get_parameter('snmp3_auth_method');
$plugin_parameter = (string) get_parameter('snmp3_auth_method', 'MD5');
$custom_string_1 = (string) get_parameter('snmp3_privacy_method');
$custom_string_1 = (string) get_parameter('snmp3_privacy_method', 'DES');
$custom_string_2 = io_input_password(
(string) get_parameter('snmp3_privacy_pass')
);
$custom_string_3 = (string) get_parameter('snmp3_security_level');
$custom_string_3 = (string) get_parameter('snmp3_security_level', 'noAuthNoPriv');
} else if ($id_module_type >= 34 && $id_module_type <= 37) {
$tcp_send = (string) get_parameter('command_text');
$custom_string_1 = (string) get_parameter(

View File

@ -459,10 +459,10 @@ if ($id_agent_module) {
$snmp_version = 1;
$snmp3_auth_user = '';
$snmp3_auth_pass = '';
$snmp3_auth_method = '';
$snmp3_privacy_method = '';
$snmp3_auth_method = 'MD5';
$snmp3_privacy_method = 'DES';
$snmp3_privacy_pass = '';
$snmp3_security_level = '';
$snmp3_security_level = 'noAuthNoPriv';
// For Remote CMD.
$command_text = '';

View File

@ -405,7 +405,22 @@ push_table_simple($data, 'field_snmpv3_row1');
$data = [];
$data[0] = __('Privacy method');
$data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true, false, false, '', $disabledBecauseInPolicy);
$data[1] = html_print_select(
[
'DES' => __('DES'),
'AES' => __('AES'),
],
'snmp3_privacy_method',
$snmp3_privacy_method,
'',
'',
'',
true,
false,
false,
'',
$disabledBecauseInPolicy
);
$data[2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
$data[3] = html_print_input_password(
'snmp3_privacy_pass',

View File

@ -114,7 +114,7 @@ if (is_ajax()) {
if (!empty($field_description)) {
// If the value is 5, this because severity in snmp alerts is not permit to show.
if (($i > 5) && ($command['id'] == 3)) {
if (($i > 5) && ($command['id'] === 3)) {
$fdesc = $field_description.' <br><span class="normal xx-small">'.sprintf(
__('Field %s'),
($i - 1)
@ -135,7 +135,7 @@ if (is_ajax()) {
}
} else {
// If the macro hasn't description and doesnt appear in command, set with empty description to dont show it.
if (($i > 5) && ($command['id'] == 3)) {
if (($i > 5) && ($command['id'] === 3)) {
if (substr_count($command['command'], '_field'.($i - 1).'_') > 0) {
$fdesc = sprintf(__('Field %s'), ($i - 1));
} else {

View File

@ -1272,36 +1272,58 @@ $class = 'databox filters';
}
?>
<?php
if (is_metaconsole() === true) {
?>
<tr id="row_servers_all" class="datos">
<td class="bolder"><?php echo __('Server'); ?></td>
<td >
<?php
if ($meta) {
?>
html_print_select(
$servers,
'combo_server_all',
$server_name,
'',
__('All nodes'),
'all'
);
?>
</td>
</tr>
<?php
}
?>
<?php
if ($meta) {
?>
<tr id="row_multiple_servers" class="datos">
<td class="bolder"><?php echo __('Server'); ?></td>
<td >
<?php
$server_ids = [];
$server_ids[0] = __('Local metaconsole');
$get_servers = metaconsole_get_servers();
foreach ($get_servers as $key => $server) {
$server_ids[$server['id']] = $server['server_name'];
}
<?php
$server_ids = [];
$server_ids[0] = __('Local metaconsole');
$get_servers = metaconsole_get_servers();
foreach ($get_servers as $key => $server) {
$server_ids[$server['id']] = $server['server_name'];
}
html_print_select(
$server_ids,
'server_multiple[]',
$server_multiple,
'',
'',
0,
false,
true
);
?>
html_print_select(
$server_ids,
'server_multiple[]',
$server_multiple,
'',
'',
0,
false,
true
);
?>
</td>
</tr>
<?php
}
?>
}
?>
<tr id="row_label" class="datos">
<td class="bolder">
@ -6545,6 +6567,7 @@ function chooseType() {
$("#row_alert_actions").hide();
$("#row_servers").hide();
$("#row_servers_all_opt").hide();
$("#row_servers_all").hide();
$("#row_multiple_servers").hide();
$("#row_sort").hide();
$("#row_date").hide();
@ -7109,7 +7132,7 @@ function chooseType() {
case 'group_report':
$("#row_group").show();
$("#row_servers_all_opt").show();
$("#row_servers_all").show();
$("#row_description").show();
$("#row_historical_db_check").hide();
break;

View File

@ -1986,7 +1986,7 @@ switch ($action) {
break;
case 'group_report':
$values['server_name'] = get_parameter('combo_server');
$values['server_name'] = get_parameter('combo_server_all');
$good_format = true;
break;
@ -2862,7 +2862,7 @@ switch ($action) {
break;
case 'group_report':
$values['server_name'] = get_parameter('combo_server');
$values['server_name'] = get_parameter('combo_server_all');
$good_format = true;
break;

View File

@ -2312,7 +2312,7 @@ $(document).ready (function () {
// The row provided has a predefined class. We delete it.
$('#table_macros-field' + i)
.removeAttr('class');
if(old_value && i != 4){
if(old_value){
$("[name=field" + i + "_value]").val(old_value).trigger('change');
}
$('#table_macros-field').show();

View File

@ -912,7 +912,7 @@ class DiscoveryTaskList extends HTML
'class' => 'main_menu_icon invert_filter',
]
).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.NetScan (legacy)');
$data[6] .= __('Discovery.NetScan');
} else {
// APP or external script recon task.
$data[6] = html_print_image(
@ -920,7 +920,7 @@ class DiscoveryTaskList extends HTML
true,
['class' => 'main_menu_icon invert_filter']
).'&nbsp;&nbsp;';
$data[6] .= $recon_script_name.' (legacy)';
$data[6] .= $recon_script_name;
}
break;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -1486,27 +1486,53 @@ if (check_login()) {
metaconsole_connect($server);
}
if ($params['histogram'] === true) {
$params['id_agent_module'] = $params['agent_module_id'];
$params['dinamic_proc'] = 1;
if ($params['enable_projected_period'] === '1') {
$params_graphic = [
'period' => $params['period'],
'date' => strtotime(date('Y-m-d H:i:s')),
'only_image' => false,
'homeurl' => ui_get_full_url(false, false, false, false).'/',
'ttl' => false,
'height' => $config['graph_image_height'],
'landscape' => $content['landscape'],
'return_img_base_64' => true,
];
$params_combined = [
'projection' => $params['period_projected'],
];
$return['chart'] = graphic_combined_module(
[$params['agent_module_id']],
$params_graphic,
$params_combined
);
$output .= '<div class="stat_win_histogram">';
if ($params['compare'] === 'separated') {
$output .= $return['chart'];
$output .= '</div>';
} else {
if ($params['histogram'] === true) {
$params['id_agent_module'] = $params['agent_module_id'];
$params['dinamic_proc'] = 1;
$output .= '<div class="stat_win_histogram">';
if ($params['compare'] === 'separated') {
$graph = \reporting_module_histogram_graph(
['datetime' => ($params['begin_date'] - $params['period'])],
$params
);
$output .= $graph['chart'];
}
$graph = \reporting_module_histogram_graph(
['datetime' => ($params['begin_date'] - $params['period'])],
['datetime' => $params['begin_date']],
$params
);
$output .= $graph['chart'];
$output .= '</div>';
} else {
$output .= grafico_modulo_sparse($params);
}
$graph = \reporting_module_histogram_graph(
['datetime' => $params['begin_date']],
$params
);
$output .= $graph['chart'];
$output .= '</div>';
} else {
$output .= grafico_modulo_sparse($params);
}
if (is_metaconsole() === true && empty($server_id) === false) {

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC230906';
$build_version = 'PC230908';
$pandora_version = 'v7.0NG.773.3';
// Do not overwrite default timezone set if defined.

View File

@ -1576,10 +1576,16 @@ function graphic_combined_module(
$server_name = metaconsole_get_server_by_id($modules[0]['server']);
}
if (isset($params_combined['custom_period']) !== false && $params_combined['custom_period'] !== false) {
$period = $params_combined['custom_period'];
} else {
$period = $params['period'];
}
if ($params_combined['projection']) {
$output_projection = forecast_projection_graph(
$module_list[0],
$params['period'],
$period,
$params_combined['projection'],
false,
false,

View File

@ -7284,6 +7284,8 @@ function html_print_select_date_range(
$date_init = date('Y/m/d', strtotime($date_end.' -1 days'));
}
$date_init = date('Y/m/d', strtotime($date_init));
if ($time_init === '') {
$time_init = date('H:i:s');
}

View File

@ -143,6 +143,10 @@ function menu_print_menu(&$menu)
if (empty($new_msg) === false) {
$sec2 = 'operation/messages/message_edit&new_msg='.$new_msg;
}
} else if ($sec2 === 'enterprise/godmode/servers/credential_boxes_satellite'
|| $sec2 === 'enterprise/godmode/servers/manage_credential_boxes'
) {
$sec2 = 'enterprise/godmode/servers/list_satellite';
} else if ($sec2 === 'operation/ITSM/itsm') {
$sec2 = (string) get_parameter('sec2');
$operation = (string) get_parameter('operation', '');

View File

@ -159,7 +159,10 @@ function reporting_make_reporting_data(
$force_width_chart=null,
$force_height_chart=null,
$pdf=false,
$from_template=false
$from_template=false,
$filter_type='',
$custom_date_end='',
$custom_period=false
) {
global $config;
@ -194,8 +197,7 @@ function reporting_make_reporting_data(
if (empty($contents)) {
return reporting_check_structure_report($report);
}
};
$metaconsole_on = is_metaconsole();
$index_content = 0;
@ -562,7 +564,10 @@ function reporting_make_reporting_data(
$type,
$force_width_chart,
$force_height_chart,
$pdf
$pdf,
$filter_type,
$custom_date_end,
$custom_period
);
break;
@ -6804,7 +6809,10 @@ function reporting_projection_graph(
$type='dinamic',
$force_width_chart=null,
$force_height_chart=null,
$pdf=false
$pdf=false,
$filter_type='',
$custom_date_end='',
$custom_period=false
) {
global $config;
@ -6870,6 +6878,7 @@ function reporting_projection_graph(
$return['agent_name_db'] = $agent_name_db;
$return['agent_name'] = $agent_name;
$return['module_name'] = $module_name;
$return['datetime'] = $report['datetime'];
set_time_limit(500);
@ -6890,8 +6899,24 @@ function reporting_projection_graph(
'return_img_base_64' => true,
];
$top_n_value = $content['top_n_value'];
if ($filter_type === 'this_week') {
$current_date = date('Y/m/d H:i:s');
$monday = date('Y/m/d H:i:s', strtotime('last monday'));
$sunday = date('Y/m/d H:i:s', strtotime($monday.' +6 days'));
$top_n_value = (strtotime($sunday) - strtotime($current_date));
} else if ($filter_type === 'this_month') {
$current_date = date('Y/m/d H:i:s');
$last_of_month = date('Y/m/d', strtotime('last day of this month'));
$top_n_value = (strtotime($last_of_month) - strtotime($current_date));
} else if ($filter_type === 'chose_range') {
$current_date = date('Y/m/d H:i:s');
$top_n_value = (strtotime($custom_date_end) - strtotime($current_date));
}
$params_combined = [
'projection' => $content['top_n_value'],
'projection' => $top_n_value,
'custom_period' => $custom_period,
];
if ($pdf === true) {

View File

@ -26,6 +26,7 @@
* GNU General Public License for more details.
* ============================================================================
*/
use PandoraFMS\Enterprise\Metaconsole\Node;
require_once $config['homedir'].'/include/functions.php';
require_once $config['homedir'].'/include/functions_db.php';
@ -119,10 +120,15 @@ function reporting_html_header(
}
function html_do_report_info($report)
function html_do_report_info($report, $custom_date_end=false, $custom_period=false)
{
global $config;
if ($custom_period !== false && $custom_date_end !== false) {
$report['datetime'] = strtotime($custom_date_end);
$report['period'] = $custom_period;
}
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$background_color = '#222';
} else {
@ -170,10 +176,10 @@ function html_do_report_info($report)
*
* @return array
*/
function reporting_html_print_report($report, $mini=false, $report_info=1)
function reporting_html_print_report($report, $mini=false, $report_info=1, $custom_date_end=false, $custom_period=false)
{
if ($report_info == 1) {
html_do_report_info($report);
html_do_report_info($report, $custom_date_end, $custom_period);
}
foreach ($report['contents'] as $key => $item) {
@ -226,6 +232,12 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
$label = '';
}
if ($custom_date_end !== false) {
$to = strtotime($custom_date_end);
} else {
$to = $item['date']['to'];
}
reporting_html_header(
$table,
$mini,
@ -234,7 +246,7 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
$item['date']['period'],
$item['date']['date'],
$item['date']['from'],
$item['date']['to'],
$to,
$label
);
@ -2582,16 +2594,66 @@ function reporting_html_group_report($table, $item, $pdf=0)
$table->colspan['group_report']['cell'] = 3;
$table->cellstyle['group_report']['cell'] = 'text-align: center;';
$metaconsole_connected = false;
if (is_metaconsole() === true) {
if (is_metaconsole() === true && $item['server_name'] != '0') {
$connection = metaconsole_get_connection($item['server_name']);
if (metaconsole_connect($connection) == NOERR) {
$metaconsole_connected = true;
}
}
$all_group_id = [];
$group_events = [];
$group_os = [];
if ($item['subtitle'] === 'All') {
if (is_metaconsole() === true && $item['server_name'] === 'all' || $item['server_name'] === '0') {
$nodes = metaconsole_get_connections();
foreach ($nodes as $node) {
try {
$nd = new Node($node['id']);
$nd->connect();
$all_group_id_node = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo');
$group_events_node = db_get_all_rows_sql(
'SELECT COUNT(te.id_evento) as count_events, ta.alias
FROM tevento as te
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente
GROUP BY te.id_agente'
);
$group_os_node = db_get_all_rows_sql(
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
FROM tconfig_os as os
INNER JOIN tagente as ta ON ta.id_os = os.id_os GROUP by os.name'
);
$all_group_id = array_merge($all_group_id, $all_group_id_node);
$group_events = array_merge($group_events, $group_events_node);
$group_os = array_merge($group_os, $group_os_node);
} catch (\Exception $e) {
$nd->disconnect();
$modules_regex_node = [];
} finally {
$nd->disconnect();
}
}
} else {
$all_group_id = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo');
$group_events = db_get_all_rows_sql(
'SELECT COUNT(te.id_evento) as count_events, ta.alias
FROM tevento as te
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente
GROUP BY te.id_agente'
);
$group_os = db_get_all_rows_sql(
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
FROM tconfig_os as os
INNER JOIN tagente as ta ON ta.id_os = os.id_os GROUP by os.name'
);
}
$group_id = [];
$all_group_id = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo');
foreach ($all_group_id as $group) {
$group_id[] = $group['id_grupo'];
@ -2599,61 +2661,113 @@ function reporting_html_group_report($table, $item, $pdf=0)
$description = __('Data view of all groups');
$icon = '';
$group_events = db_get_all_rows_sql(
'SELECT COUNT(te.id_evento) as count_events, ta.alias
FROM tevento as te
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente
GROUP BY te.id_agente'
);
$group_os = db_get_all_rows_sql(
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
FROM tconfig_os as os
INNER JOIN tagente as ta ON ta.id_os = os.id_os GROUP by os.name'
);
} else {
$group_id = db_get_value('id_grupo', 'tgrupo', 'nombre', $item['subtitle']);
$description = db_get_value('description', 'tgrupo', 'id_grupo', $group_id);
$icon_url = db_get_value('icon', 'tgrupo', 'id_grupo', $group_id);
$icon = html_print_image(
'images/'.$icon_url,
true,
[
'title' => $item['subtitle'],
'class' => 'main_menu_icon invert_filter',
]
);
$childrens = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo WHERE parent = '.$group_id);
$total_agents = db_get_all_rows_sql('SELECT COUNT(id_agente) as total FROM tagente where id_grupo = '.$group_id);
if (is_metaconsole() === true && $item['server_name'] === 'all' || $item['server_name'] === '0') {
$nodes = metaconsole_get_connections();
foreach ($nodes as $node) {
try {
$nd = new Node($node['id']);
$nd->connect();
if ($childrens !== false && (int) $total_agents[0]['total'] !== $item['data']['group_stats']['total_agents']) {
$array_group_id = [];
$array_group_id[] = $group_id;
foreach ($childrens as $group) {
$array_group_id[] = $group['id_grupo'];
$group_id_node = db_get_value('id_grupo', 'tgrupo', 'nombre', $item['subtitle']);
$description = db_get_value('description', 'tgrupo', 'id_grupo', $group_id_node);
$icon_url = db_get_value('icon', 'tgrupo', 'id_grupo', $group_id_node);
$icon = html_print_image(
'images/'.$icon_url,
true,
[
'title' => $item['subtitle'],
'class' => 'main_menu_icon invert_filter',
]
);
$childrens = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo WHERE parent = '.$group_id_node);
$total_agents = db_get_all_rows_sql('SELECT COUNT(id_agente) as total FROM tagente where id_grupo = '.$group_id_node);
if ($childrens !== false && (int) $total_agents[0]['total'] !== $item['data']['group_stats']['total_agents']) {
$array_group_id = [];
$array_group_id[] = $group_id_node;
foreach ($childrens as $group) {
$array_group_id[] = $group['id_grupo'];
}
$group_id_node = $array_group_id;
$explode_group_id = implode(',', $group_id_node);
} else {
$explode_group_id = $group_id_node;
}
$group_events_node = db_get_all_rows_sql(
'SELECT COUNT(te.id_evento) as count_events, ta.alias
FROM tevento as te
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente WHERE te.id_grupo IN ('.$explode_group_id.')
GROUP BY te.id_agente'
);
$group_os_node = db_get_all_rows_sql(
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
FROM tconfig_os as os
INNER JOIN tagente as ta ON ta.id_os = os.id_os
WHERE ta.id_grupo IN ('.$explode_group_id.') GROUP by os.name'
);
if (is_array($group_events_node) === true) {
$group_events = array_merge($group_events, $group_events_node);
}
if (is_array($group_os_node) === true) {
$group_os = array_merge($group_os, $group_os_node);
}
} catch (\Exception $e) {
$nd->disconnect();
} finally {
$nd->disconnect();
}
}
} else {
$description = db_get_value('description', 'tgrupo', 'id_grupo', $group_id);
$icon_url = db_get_value('icon', 'tgrupo', 'id_grupo', $group_id);
$icon = html_print_image(
'images/'.$icon_url,
true,
[
'title' => $item['subtitle'],
'class' => 'main_menu_icon invert_filter',
]
);
$childrens = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo WHERE parent = '.$group_id);
$total_agents = db_get_all_rows_sql('SELECT COUNT(id_agente) as total FROM tagente where id_grupo = '.$group_id);
if ($childrens !== false && (int) $total_agents[0]['total'] !== $item['data']['group_stats']['total_agents']) {
$array_group_id = [];
$array_group_id[] = $group_id;
foreach ($childrens as $group) {
$array_group_id[] = $group['id_grupo'];
}
$group_id = $array_group_id;
$explode_group_id = implode(',', $group_id);
} else {
$explode_group_id = $group_id;
}
$group_id = $array_group_id;
$explode_group_id = implode(',', $group_id);
} else {
$explode_group_id = $group_id;
$group_events = db_get_all_rows_sql(
'SELECT COUNT(te.id_evento) as count_events, ta.alias
FROM tevento as te
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente WHERE te.id_grupo IN ('.$explode_group_id.')
GROUP BY te.id_agente'
);
$group_os = db_get_all_rows_sql(
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
FROM tconfig_os as os
INNER JOIN tagente as ta ON ta.id_os = os.id_os
WHERE ta.id_grupo IN ('.$explode_group_id.') GROUP by os.name'
);
}
$group_events = db_get_all_rows_sql(
'SELECT COUNT(te.id_evento) as count_events, ta.alias
FROM tevento as te
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente WHERE te.id_grupo IN ('.$explode_group_id.')
GROUP BY te.id_agente'
);
$group_os = db_get_all_rows_sql(
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
FROM tconfig_os as os
INNER JOIN tagente as ta ON ta.id_os = os.id_os
WHERE ta.id_grupo IN ('.$explode_group_id.') GROUP by os.name'
);
}
if ($metaconsole_connected === true) {
@ -2764,8 +2878,10 @@ function reporting_html_group_report($table, $item, $pdf=0)
$options = [];
$labels = [];
foreach ($group_os as $value) {
$data[$value['name_os']] = $value['count_os'];
$labels[] = io_safe_output($value['name_os']);
$data[$value['name_os']] += $value['count_os'];
if (array_search($value['name_os'], $labels) === false) {
$labels[] = io_safe_output($value['name_os']);
}
}
$options = [

View File

@ -3913,6 +3913,11 @@ function ui_print_datatable(array $parameters)
$parameters['toggle_collapsed'] = true;
}
$parameters['startDisabled'] = false;
if (isset($parameters['start_disabled']) && $parameters['start_disabled'] === true) {
$parameters['startDisabled'] = true;
}
$columns_tmp = [];
foreach ($parameters['columns'] as $k_column => $v_column) {
if (isset($parameters['columns'][$k_column]['text']) === true) {
@ -4126,7 +4131,7 @@ function ui_print_datatable(array $parameters)
// Base table.
$table = '<table id="'.$table_id.'" ';
$table .= 'class="'.$parameters['class'].'"';
$table .= 'class="invisible '.$parameters['class'].'"';
$table .= 'style="box-sizing: border-box;'.$parameters['style'].'">';
$table .= '<thead><tr class="datatables_thead_tr">';
@ -4200,13 +4205,19 @@ function ui_print_datatable(array $parameters)
$info_msg_arr['message'] = $emptyTable;
$info_msg_arr['div_class'] = 'info_box_container invisible_important datatable-msg-info-'.$table_id;
$spinner = '<div id="'.$table_id.'-spinner" class="spinner-fixed"><span></span><span></span><span></span><span></span></div>';
$info_msg_arr_filter = [];
$info_msg_arr_filter['message'] = __('Please apply a filter to display the data.');
$info_msg_arr_filter['div_class'] = 'info_box_container invisible_important datatable-msg-info-filter-'.$table_id;
$spinner = '<div id="'.$table_id.'-spinner" class="invisible spinner-fixed"><span></span><span></span><span></span><span></span></div>';
// TODO This widget should take a return: ui_print_info_message($info_msg_arr, '', true)
$info_msg = '<div>'.ui_print_info_message($info_msg_arr).'</div>';
$info_msg_filter = '<div>'.ui_print_info_message($info_msg_arr_filter, true).'</div>';
$err_msg = '<div id="error-'.$table_id.'"></div>';
$output = $info_msg.$err_msg.$filter.$extra.$spinner.$table.$js;
$output = $info_msg.$info_msg_filter.$err_msg.$filter.$extra.$spinner.$table.$js;
if (is_ajax() === false) {
ui_require_css_file('datatables.min', 'include/styles/js/');
ui_require_css_file('tables');

View File

@ -126,6 +126,11 @@ if (typeof dt.ajax_data !== "undefined") {
ajaxData = dt.ajax_data;
}
var startDisabled = false;
if (dt.startDisabled === true) {
startDisabled = true;
}
$(document).ready(function() {
function checkPages() {
if (dt_table.page.info().pages > 1) {
@ -335,7 +340,25 @@ $(document).ready(function() {
}
$.extend(settings_datatable, ajaxOrData);
var dt_table = $(`#${dt.table_id}`).DataTable(settings_datatable);
var dt_table;
if (startDisabled === true) {
$(`.datatable-msg-info-filter-${dt.id}`)
.removeClass("invisible_important")
.show();
$(`div#${dt.id}-spinner`).hide();
$(`#${dt.table_id}`).hide();
$(`#button-form_${dt.table_id}_search_bt`).click(function() {
$(`.datatable-msg-info-filter-${dt.id}`).hide();
$(`#${dt.table_id}`).show();
dt_table = $(`#${dt.table_id}`).DataTable(settings_datatable);
});
} else {
dt_table = $(`#${dt.table_id}`).DataTable(settings_datatable);
}
$(`#button-${dt.form_id}_search_bt`).click(function() {
dt_table.draw().page(0);

View File

@ -1613,3 +1613,12 @@ function type_change() {
break;
}
}
// Show/Hide period for projection on agent module graph.
function show_projection_period() {
if ($("#projection_switch").is(":checked")) {
$("#div_projection_period").show();
} else {
$("#div_projection_period").hide();
}
}

View File

@ -416,6 +416,10 @@ class Widget
$className .= '\WuxWidget';
break;
case 'inventory':
$className .= '\InventoryWidget';
break;
case 'os_quick_report':
$className .= '\OsQuickReportWidget';
break;

File diff suppressed because it is too large Load Diff

View File

@ -269,6 +269,14 @@ class SingleGraphWidget extends Widget
$values['showLegend'] = $decoder['showLegend'];
}
if (isset($decoder['projection_switch']) === true) {
$values['projection_switch'] = $decoder['projection_switch'];
}
if (isset($decoder['period_projection']) === true) {
$values['period_projection'] = $decoder['period_projection'];
}
return $values;
}
@ -357,6 +365,33 @@ class SingleGraphWidget extends Widget
],
];
// Projection.
$inputs[] = [
'label' => __('Projection Graph'),
'arguments' => [
'name' => 'projection_switch',
'id' => 'projection_switch',
'type' => 'switch',
'value' => $values['projection_switch'],
'onclick' => 'show_projection_period()',
],
];
// Period Projection.
$display_projection = ($values['projection_switch'] === true) ? '' : 'display:none';
$inputs[] = [
'label' => __('Period Projection'),
'id' => 'div_projection_period',
'style' => $display_projection,
'arguments' => [
'name' => 'period_projection',
'type' => 'interval',
'value' => $values['period_projection'],
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
],
];
return $inputs;
}
@ -376,6 +411,8 @@ class SingleGraphWidget extends Widget
$values['moduleId'] = \get_parameter('moduleId', 0);
$values['period'] = \get_parameter('period', 0);
$values['showLegend'] = \get_parameter_switch('showLegend');
$values['projection_switch'] = (boolean) get_parameter_switch('projection_switch');
$values['period_projection'] = \get_parameter('period_projection', 0);
return $values;
}
@ -405,23 +442,46 @@ class SingleGraphWidget extends Widget
$trickHight = 40;
}
$params = [
'agent_module_id' => $this->values['moduleId'],
'width' => '100%',
'height' => ((int) $size['height'] - $trickHight),
'period' => $this->values['period'],
'title' => $module_name,
'unit' => $units_name,
'homeurl' => $config['homeurl'],
'backgroundColor' => 'transparent',
'show_legend' => $this->values['showLegend'],
'show_title' => $module_name,
'menu' => false,
'dashboard' => true,
];
$output = '<div class="container-center widget-mrgn-0px">';
$output .= \grafico_modulo_sparse($params);
if ($this->values['projection_switch'] === true) {
$params_graphic = [
'period' => $this->values['period'],
'date' => strtotime(date('Y-m-d H:i:s')),
'only_image' => false,
'homeurl' => ui_get_full_url(false, false, false, false).'/',
'height' => ((int) $size['height'] - $trickHight),
'landscape' => $content['landscape'],
'return_img_base_64' => true,
];
$params_combined = [
'projection' => $this->values['period_projection'],
];
$return['chart'] = graphic_combined_module(
[$this->values['moduleId']],
$params_graphic,
$params_combined
);
$output .= $return['chart'];
} else {
$params = [
'agent_module_id' => $this->values['moduleId'],
'width' => '100%',
'height' => ((int) $size['height'] - $trickHight),
'period' => $this->values['period'],
'title' => $module_name,
'unit' => $units_name,
'homeurl' => $config['homeurl'],
'backgroundColor' => 'transparent',
'show_legend' => $this->values['showLegend'],
'show_title' => $module_name,
'menu' => false,
'dashboard' => true,
];
$output .= \grafico_modulo_sparse($params);
}
$output .= '</div>';
return $output;
}

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'>
<?php
$version = '7.0NG.773.3';
$build = '230906';
$build = '230908';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -407,7 +407,7 @@ if ($agent_view_page === true) {
[
'id' => 'alerts_status_datatable',
'class' => 'info_table',
'style' => 'width: 99%;',
'style' => 'width: 100%;',
'columns' => $columns,
'column_names' => $column_names,
'no_sortable_columns' => $no_sortable_columns,
@ -439,6 +439,7 @@ if ($agent_view_page === true) {
$strict_user
),
],
'start_disabled' => true,
]
);
}

View File

@ -197,6 +197,8 @@ ui_print_message_dialog(
$time_compare_overlapped = get_parameter('time_compare_overlapped', 0);
$unknown_graph = get_parameter_checkbox('unknown_graph', 1);
$histogram = (bool) get_parameter('histogram', 0);
$enable_projected_period = get_parameter('enable_projected_period', 0);
$period_projected = get_parameter('period_projected', 300);
// FORM TABLE.
$table = html_get_predefined_table('transparent', 2);
@ -406,12 +408,35 @@ ui_print_message_dialog(
true
);
$table->data[6][3] = html_print_checkbox_switch(
'fullscale',
'fullscalee',
1,
(bool) $fullscale,
true,
false
);
$table->data[7][0] = __('Projection graph');
$table->data[7][0] .= ui_print_help_tip(
__('Projection graph take as begin date the current time'),
true
);
$table->data[7][1] = html_print_checkbox_switch(
'enable_projected_period',
1,
(bool) $enable_projected_period,
true
);
$table->data[7][2] = __('Projection period');
$table->data[7][3] = '<div class="small-input-select2">'.html_print_extended_select_for_time(
'period_projected',
$period_projected,
'',
'',
0,
7,
true
).'</div>';
} else {
$table->data[0][0] = __('Begin date');
$table->data[0][1] = html_print_input_text(
@ -514,27 +539,29 @@ ui_print_message_dialog(
);
$params = [
'agent_module_id' => $id,
'period' => $period,
'show_events' => $draw_events,
'title' => $label,
'unit_name' => $unit,
'show_alerts' => $draw_alerts,
'date' => $date,
'unit' => $unit,
'baseline' => $baseline,
'homeurl' => $urlImage,
'adapt_key' => 'adapter_'.$graph_type,
'compare' => $time_compare,
'show_unknown' => $unknown_graph,
'percentil' => (($show_percentil) ? $config['percentil'] : null),
'type_graph' => $config['type_module_charts'],
'fullscale' => $fullscale,
'zoom' => $zoom,
'height' => 300,
'type_mode_graph' => $type_mode_graph,
'histogram' => $histogram,
'begin_date' => strtotime($start_date.' '.$start_time),
'agent_module_id' => $id,
'period' => $period,
'show_events' => $draw_events,
'title' => $label,
'unit_name' => $unit,
'show_alerts' => $draw_alerts,
'date' => $date,
'unit' => $unit,
'baseline' => $baseline,
'homeurl' => $urlImage,
'adapt_key' => 'adapter_'.$graph_type,
'compare' => $time_compare,
'show_unknown' => $unknown_graph,
'percentil' => (($show_percentil) ? $config['percentil'] : null),
'type_graph' => $config['type_module_charts'],
'fullscale' => $fullscale,
'zoom' => $zoom,
'height' => 300,
'type_mode_graph' => $type_mode_graph,
'histogram' => $histogram,
'begin_date' => strtotime($start_date.' '.$start_time),
'enable_projected_period' => $enable_projected_period,
'period_projected' => $period_projected,
];
// Graph.

View File

@ -154,7 +154,7 @@ if ($ag_freestring !== '' || $moduletype !== '' || $datatype !== ''
// The execution has not been done manually.
$userRequest = (bool) get_parameter('uptbutton');
if ($userRequest === false) {
if ($userRequest === true) {
$autosearch = true;
}
@ -2354,7 +2354,7 @@ if (empty($result) === false) {
$tablePagination = ui_pagination($count_modules, false, $offset, 0, true, 'offset', false);
}
} else {
ui_print_info_message(['no_close' => true, 'message' => __('Sorry no search parameters')]);
ui_print_info_message(['no_close' => true, 'message' => __('Please apply a filter to display the data')]);
}
if (is_metaconsole() !== true) {

View File

@ -70,6 +70,8 @@ if (is_ajax()) {
$id_group = (int) get_parameter('id_group');
$pendingdelete = (bool) get_parameter('pendingdelete');
$get_node_agent = (bool) get_parameter('get_node_agent', false);
$get_agent_inventory_modules = (bool) get_parameter('get_agent_inventory_modules', false);
$get_agent_inventory_dates = (bool) get_parameter('get_agent_inventory_dates', false);
$refresh_contact = get_parameter('refresh_contact', 0);
@ -1329,6 +1331,102 @@ if (is_ajax()) {
}
}
if ($get_agent_inventory_modules) {
$inventory_id_agent = get_parameter('id_agent');
$id_node = (int) get_parameter('id_node');
$sql = 'SELECT DISTINCT(`name`)
FROM tmodule_inventory, tagent_module_inventory
WHERE tmodule_inventory.id_module_inventory = tagent_module_inventory.id_module_inventory';
if ($inventory_id_agent > 0) {
$sql .= ' AND id_agente = '.$inventory_id_agent;
}
$fields = [];
// Get results from all nodes if id_node equals to 0.
if ($id_node === 0 && is_metaconsole() === true) {
$result = [];
$nodes_connection = metaconsole_get_connections();
foreach ($nodes_connection as $key => $server) {
$id_node = $server['id'];
try {
if (is_metaconsole() === true) {
$node = new Node($id_node);
$node->connect();
}
$node_result = db_get_all_rows_sql($sql);
if ($node_result === false) {
continue;
}
$result = array_merge(
$result,
$node_result
);
if (is_metaconsole() === true) {
$node->disconnect();
}
} catch (Exception $e) {
if ($node !== null) {
$node->disconnect();
}
return;
}
}
} else {
try {
if (is_metaconsole() === true) {
$node = new Node($id_node);
$node->connect();
}
$result = db_get_all_rows_sql($sql);
if (is_metaconsole() === true) {
$node->disconnect();
}
} catch (Exception $e) {
if ($node !== null) {
$node->disconnect();
}
return;
}
}
if ($result === false) {
$result = [];
}
echo json_encode($result);
return;
}
if ($get_agent_inventory_dates) {
$inventory_module = get_parameter('module', 0);
$inventory_id_agent = (int) get_parameter('id_agent', 0);
$inventory_id_group = (int) get_parameter('id_group', 0);
$dates = inventory_get_dates(
$inventory_module,
$inventory_id_agent,
$inventory_id_group
);
echo json_encode($dates);
return;
}
return;
}

View File

@ -60,12 +60,29 @@ $datetime_end = strtotime($date_end.' '.$time_end);
$custom_date = get_parameter('custom_date', 0);
$date = get_parameter('date', SECONDS_1DAY);
$date_text = get_parameter('date_text', SECONDS_1DAY);
if ($custom_date === '1') {
if ($datetime_init >= $datetime_end) {
$datetime_init = $date_init_less;
}
$period = ($datetime_end - $datetime_init);
$custom_date_end = '';
$filter_type = '';
$custom_period = false;
if ($custom_date === '1') {
if ($date === 'chose_range') {
$date_init = get_parameter('date_init', 0);
$date_init = explode(' ', $date_init);
$date_init = $date_init[0];
$date_init .= ' '.get_parameter('time_init', '00:00:00');
$custom_date_end = get_parameter('date_end', 0);
$custom_date_end .= ' '.get_parameter('time_end', '00:00:00');
$date_end = date('Y/m/d H:i:s');
$period = (strtotime($date_end) - strtotime($date_init));
$custom_period = (strtotime($custom_date_end) - strtotime($date_init));
$filter_type = 'chose_range';
} else {
if ($datetime_init >= $datetime_end) {
$datetime_init = $date_init_less;
}
$period = ($datetime_end - $datetime_init);
}
} else if ($custom_date === '2') {
$date_units = get_parameter('date_units');
$date_end = date('Y/m/d H:i:s');
@ -73,16 +90,18 @@ if ($custom_date === '1') {
$period = (strtotime($date_end) - strtotime($date_start));
} else if (in_array($date, ['this_week', 'this_month', 'past_week', 'past_month'])) {
if ($date === 'this_week') {
$monday = date('Y/m/d', strtotime('last monday'));
$sunday = date('Y/m/d', strtotime($monday.' +6 days'));
$period = (strtotime($sunday) - strtotime($monday));
$date_init = $monday;
$date_end = $sunday;
// Last monday.
$date_init = date('Y/m/d H:i:s', strtotime('last monday'));
// $date_end = date('Y/m/d H:i:s', strtotime($date_init.' +6 days'));
$date_end = date('Y/m/d H:i:s');
$period = (strtotime($date_end) - strtotime($date_init));
$filter_type = 'this_week';
} else if ($date === 'this_month') {
$date_end = date('Y/m/d', strtotime('last day of this month'));
// $date_end = date('Y/m/d', strtotime('last day of this month'));
$date_end = date('Y/m/d H:i:s');
$first_of_month = date('Y/m/d', strtotime('first day of this month'));
$period = (strtotime($date_end) - strtotime($first_of_month));
$filter_type = 'this_month';
} else if ($date === 'past_month') {
$date_end = date('Y/m/d', strtotime('last day of previous month'));
$first_of_month = date('Y/m/d', strtotime('first day of previous month'));
@ -265,10 +284,8 @@ ui_print_standard_header(
// ------------------------ INIT FORM -----------------------------------
$table2 = new stdClass();
$table2->id = 'controls_table';
$table2->size[2] = '50%';
$table2->size[3] = '50%';
$table2->style[0] = 'text-align:center';
$table2->style[1] = 'text-align:center';
$table2->size[2] = '20%';
$table2->style[3] = 'position:absolute; left: auto';
$table2->styleTable = 'border:none';
if (defined('METACONSOLE')) {
@ -353,13 +370,20 @@ $report = reporting_make_reporting_data(
$date_end,
$time,
$period,
'dinamic'
'dinamic',
null,
null,
false,
false,
$filter_type,
$custom_date_end,
$custom_period
);
for ($i = 0; $i < count($report['contents']); $i++) {
$report['contents'][$i]['description'] = str_replace('&#x0d;&#x0a;', '<br/>', $report['contents'][$i]['description']);
}
reporting_html_print_report($report, false, $config['custom_report_info']);
reporting_html_print_report($report, false, $config['custom_report_info'], $custom_date_end, $custom_period);
echo '<div id="loading" class="center">';

View File

@ -73,9 +73,10 @@ if ($config['pure']) {
}
// Control from managent polices.
$type = get_parameter('type', false);
$type = get_parameter('moduletype', false);
$page = get_parameter('page', false);
if (empty($page) && $type !== 'networkserver') {
if (empty($page) && $type !== 'networkserver' && $moduletype !== 2) {
// Header.
ui_print_standard_header(
__('SNMP Browser'),

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.773.3
%define release 230906
%define release 230908
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.773.3
%define release 230906
%define release 230908
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.773.3
%define release 230906
%define release 230908
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.773.3-230906
Version: 7.0NG.773.3-230908
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.773.3-230906"
pandora_version="7.0NG.773.3-230908"
package_cpan=0
package_pandora=1

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.773.3";
my $pandora_build = "230906";
my $pandora_build = "230908";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.773.3";
my $pandora_build = "230906";
my $pandora_build = "230908";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_server
%define version 7.0NG.773.3
%define release 230906
%define release 230908
Summary: Pandora FMS Server
Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_server
%define version 7.0NG.773.3
%define release 230906
%define release 230908
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.773.3"
PI_BUILD="230906"
PI_BUILD="230908"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.773.3 Build 230906";
my $version = "7.0NG.773.3 Build 230908";
# Pandora server configuration
my %conf;
@ -359,7 +359,12 @@ sub pandora_purgedb ($$$) {
log_message ('!', "Cannot execute " . $conf->{'_netflow_nfexpire'} . ", skipping.");
}
else {
`yes 2>/dev/null | $conf->{'_netflow_nfexpire'} -r "$conf->{'_netflow_path'}" -t $conf->{'_netflow_max_lifetime'}d`;
# Update stats file with max lifetime.
`yes 2>/dev/null | $conf->{'_netflow_nfexpire'} -u "$conf->{'_netflow_path'}" -t $conf->{'_netflow_max_lifetime'}d -w 100`;
# Rescan directory.
`yes 2>/dev/null | $conf->{'_netflow_nfexpire'} -r "$conf->{'_netflow_path'}"`;
# Expire files
`yes 2>/dev/null | $conf->{'_netflow_nfexpire'} -e "$conf->{'_netflow_path'}"`;
}
}
else {

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.773.3 Build 230906";
my $version = "7.0NG.773.3 Build 230908";
# save program name for logging
my $progname = basename($0);