Merge remote-tracking branch 'origin/develop' into ent-11471-integracion-pandora-integria
This commit is contained in:
commit
fce86cb2ac
|
@ -166,7 +166,7 @@ module_description User CPU Usage (%)
|
|||
module_min_warning 70
|
||||
module_max_warning 90
|
||||
module_min_critical 91
|
||||
module_max_critical 100
|
||||
module_max_critical 0
|
||||
module_unit %
|
||||
module_end
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ module_description CPU Load (%)
|
|||
module_min_warning 80
|
||||
module_max_warning 90
|
||||
module_min_critical 91
|
||||
module_max_critical 100
|
||||
module_max_critical 0
|
||||
module_end
|
||||
|
||||
# Number processes
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.773.3-230904
|
||||
Version: 7.0NG.773.3-230906
|
||||
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.773.3-230904"
|
||||
pandora_version="7.0NG.773.3-230906"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -187,7 +187,7 @@ module_description User CPU Usage (%)
|
|||
module_min_warning 70
|
||||
module_max_warning 90
|
||||
module_min_critical 91
|
||||
module_max_critical 100
|
||||
module_max_critical 0
|
||||
module_end
|
||||
|
||||
#Get load average
|
||||
|
|
|
@ -219,7 +219,7 @@ module_description User CPU Usage (%)
|
|||
module_min_warning 70
|
||||
module_max_warning 90
|
||||
module_min_critical 91
|
||||
module_max_critical 100
|
||||
module_max_critical 0
|
||||
module_unit %
|
||||
module_group System
|
||||
module_end
|
||||
|
|
|
@ -1031,7 +1031,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.773.3';
|
||||
use constant AGENT_BUILD => '230904';
|
||||
use constant AGENT_BUILD => '230906';
|
||||
|
||||
# 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.773.3
|
||||
%define release 230904
|
||||
%define release 230906
|
||||
|
||||
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.773.3
|
||||
%define release 230904
|
||||
%define release 230906
|
||||
|
||||
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.773.3
|
||||
%define release 230904
|
||||
%define release 230906
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.773.3"
|
||||
PI_BUILD="230904"
|
||||
PI_BUILD="230906"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -165,7 +165,7 @@ module_description User CPU Usage (%)
|
|||
module_min_warning 70
|
||||
module_max_warning 90
|
||||
module_min_critical 91
|
||||
module_max_critical 100
|
||||
module_max_critical 0
|
||||
module_unit %
|
||||
module_group System
|
||||
module_end
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{230904}
|
||||
{230906}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -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 230904")
|
||||
#define PANDORA_VERSION ("7.0NG.773.3 Build 230906")
|
||||
|
||||
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.773.3(Build 230904))"
|
||||
VALUE "ProductVersion", "(7.0NG.773.3(Build 230906))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.773.3-230904
|
||||
Version: 7.0NG.773.3-230906
|
||||
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.773.3-230904"
|
||||
pandora_version="7.0NG.773.3-230906"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `ttrap` ADD COLUMN `utimestamp` INT UNSIGNED NOT NULL DEFAULT 0;
|
||||
|
||||
UPDATE ttrap SET utimestamp=UNIX_TIMESTAMP(timestamp);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tgraph_analytics_filter` (
|
||||
`id` INT NOT NULL auto_increment,
|
||||
`filter_name` VARCHAR(45) NULL,
|
||||
|
@ -55,4 +59,26 @@ UPDATE tagente_modulo SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
|
|||
UPDATE tpolicy_modules SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
|
||||
UPDATE tnetwork_component SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
|
||||
|
||||
ALTER TABLE `tsesion_filter_log_viewer`
|
||||
CHANGE COLUMN `date_range` `custom_date` INT NULL DEFAULT NULL ,
|
||||
CHANGE COLUMN `start_date_defined` `date` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
CHANGE COLUMN `start_date_time` `date_text` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
CHANGE COLUMN `start_date_date` `date_units` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
CHANGE COLUMN `start_date_date_range` `date_init` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
CHANGE COLUMN `start_date_time_range` `time_init` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
CHANGE COLUMN `end_date_date_range` `date_end` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
CHANGE COLUMN `end_date_time_range` `time_end` VARCHAR(45) NULL DEFAULT NULL ;
|
||||
|
||||
ALTER TABLE `tsesion_filter`
|
||||
CHANGE COLUMN `period` `date_text` VARCHAR(45) NULL DEFAULT NULL AFTER `user`;
|
||||
|
||||
ALTER TABLE `tsesion_filter`
|
||||
ADD COLUMN `custom_date` INT NULL AFTER `user`,
|
||||
ADD COLUMN `date` VARCHAR(45) NULL AFTER `custom_date`,
|
||||
ADD COLUMN `date_units` VARCHAR(45) NULL AFTER `date_text`,
|
||||
ADD COLUMN `date_init` VARCHAR(45) NULL AFTER `date_units`,
|
||||
ADD COLUMN `time_init` VARCHAR(45) NULL AFTER `date_init`,
|
||||
ADD COLUMN `date_end` VARCHAR(45) NULL AFTER `time_init`,
|
||||
ADD COLUMN `time_end` VARCHAR(45) NULL AFTER `date_end`;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -759,6 +759,31 @@ if (enterprise_installed() === true) {
|
|||
);
|
||||
}
|
||||
|
||||
$days_week = [
|
||||
0 => __('Sunday'),
|
||||
1 => __('Monday'),
|
||||
2 => __('Tuesday'),
|
||||
3 => __('Wednesday'),
|
||||
4 => __('Thursday'),
|
||||
5 => __('Friday'),
|
||||
6 => __('Saturday'),
|
||||
];
|
||||
|
||||
$table_styles->data[$row][] = html_print_label_input_block(
|
||||
__('Datepicker first day of week'),
|
||||
html_print_select(
|
||||
$days_week,
|
||||
'datepicker_first_day',
|
||||
$config['datepicker_first_day'],
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
$row++;
|
||||
|
||||
// Title Header.
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
|
@ -58,7 +58,14 @@ if ($save_log_filter) {
|
|||
$values = [];
|
||||
$values['id_name'] = get_parameter('id_name');
|
||||
$values['text'] = get_parameter('text', '');
|
||||
$values['period'] = get_parameter('period', '');
|
||||
$values['custom_date'] = get_parameter('custom_date');
|
||||
$values['date'] = get_parameter('date');
|
||||
$values['date_text'] = get_parameter('date_text');
|
||||
$values['date_units'] = get_parameter('date_units');
|
||||
$values['date_init'] = get_parameter('date_init');
|
||||
$values['time_init'] = get_parameter('time_init');
|
||||
$values['date_end'] = get_parameter('date_end');
|
||||
$values['time_end'] = get_parameter('time_end');
|
||||
$values['ip'] = get_parameter('ip', '');
|
||||
$values['type'] = get_parameter('type', -1);
|
||||
$values['user'] = get_parameter('user', -1);
|
||||
|
@ -91,7 +98,14 @@ if ($update_log_filter) {
|
|||
$values = [];
|
||||
$id = get_parameter('id');
|
||||
$values['text'] = get_parameter('text', '');
|
||||
$values['period'] = get_parameter('period', '');
|
||||
$values['custom_date'] = get_parameter('custom_date');
|
||||
$values['date'] = get_parameter('date');
|
||||
$values['date_text'] = get_parameter('date_text');
|
||||
$values['date_units'] = get_parameter('date_units');
|
||||
$values['date_init'] = get_parameter('date_init');
|
||||
$values['time_init'] = get_parameter('time_init');
|
||||
$values['date_end'] = get_parameter('date_end');
|
||||
$values['time_end'] = get_parameter('time_end');
|
||||
$values['ip'] = get_parameter('ip', '');
|
||||
$values['type'] = get_parameter('type', -1);
|
||||
$values['user'] = get_parameter('user', -1);
|
||||
|
@ -211,18 +225,42 @@ function load_filter_values() {
|
|||
$.each(data,function(i,value){
|
||||
if (i == 'text'){
|
||||
$("#text-filter_text").val(value);
|
||||
}
|
||||
if (i == 'period'){
|
||||
$("#filter_period").val(value).change();
|
||||
}
|
||||
if (i == 'ip'){
|
||||
} else if (i == 'ip'){
|
||||
$("#text-filter_ip").val(value);
|
||||
}
|
||||
if (i == 'type'){
|
||||
} else if (i == 'type'){
|
||||
$("#filter_type").val(value).change();
|
||||
}
|
||||
if (i == 'user'){
|
||||
} else if (i == 'user'){
|
||||
$("#filter_user").val(value).change();
|
||||
} else if (i == 'custom_date'){
|
||||
$('#hidden-custom_date').val(value).change();
|
||||
if ($('#hidden-custom_date').val()==='0'){
|
||||
$('#date_default').show();
|
||||
$('#date_range').hide();
|
||||
$('#date_extend').hide();
|
||||
$('#date').val('".SECONDS_1DAY."').trigger('change');
|
||||
} else if ($('#hidden-custom_date').val()==='1'){
|
||||
$('#date_range').show();
|
||||
$('#date_default').hide();
|
||||
$('#date_extend').hide();
|
||||
} else {
|
||||
$('#date_range').hide();
|
||||
$('#date_default').hide();
|
||||
$('#date_extend').show();
|
||||
}
|
||||
} else if (i == 'date'){
|
||||
$('#date').val(value).change();
|
||||
} else if (i == 'date_end'){
|
||||
$('#text-date_end').val(value);
|
||||
} else if (i == 'date_init'){
|
||||
$('#text-date_init').val(value);
|
||||
} else if (i == 'date_text'){
|
||||
$('#text-date_text').val(value);
|
||||
} else if (i == 'date_units'){
|
||||
$('#date_units').val(value).change();
|
||||
} else if (i == 'time_end'){
|
||||
$('#text-time_end').val(value);
|
||||
} else if (i == 'time_init'){
|
||||
$('#text-time_init').val(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -408,7 +446,14 @@ function save_new_filter() {
|
|||
"save_log_filter" : 1,
|
||||
"id_name" : $("#text-id_name").val(),
|
||||
"text" : $("#text-filter_text").val(),
|
||||
"period" : $("#filter_period :selected").val(),
|
||||
"custom_date": $('#hidden-custom_date').val(),
|
||||
"date": $('#date option:selected').val(),
|
||||
"date_text": $('#text-date_text').val(),
|
||||
"date_units": $('#date_units option:selected').val(),
|
||||
"date_init": $('#text-date_init').val(),
|
||||
"time_init": $('#text-time_init').val(),
|
||||
"date_end": $('#text-date_end').val(),
|
||||
"time_end": $('#text-time_end').val(),
|
||||
"ip" : $('#text-filter_ip').val(),
|
||||
"type" : $('#filter_type :selected').val(),
|
||||
"user" : $('#filter_user :selected').val(),
|
||||
|
@ -444,7 +489,14 @@ function save_update_filter() {
|
|||
"update_log_filter" : 1,
|
||||
"id" : $("#overwrite_filter :selected").val(),
|
||||
"text" : $("#text-filter_text").val(),
|
||||
"period" : $("#filter_period :selected").val(),
|
||||
"custom_date": $('#hidden-custom_date').val(),
|
||||
"date": $('#date option:selected').val(),
|
||||
"date_text": $('#text-date_text').val(),
|
||||
"date_units": $('#date_units option:selected').val(),
|
||||
"date_init": $('#text-date_init').val(),
|
||||
"time_init": $('#text-time_init').val(),
|
||||
"date_end": $('#text-date_end').val(),
|
||||
"time_end": $('#text-time_end').val(),
|
||||
"ip" : $('#text-filter_ip').val(),
|
||||
"type" : $('#filter_type :selected').val(),
|
||||
"user" : $('#filter_user :selected').val(),
|
||||
|
|
|
@ -201,23 +201,8 @@ class AuditLog extends HTML
|
|||
'name' => 'filter_text',
|
||||
],
|
||||
[
|
||||
'label' => __('Max. hours old'),
|
||||
'type' => 'select',
|
||||
'class' => 'w20px',
|
||||
'select2_enable' => true,
|
||||
'sort' => false,
|
||||
'selected' => 168,
|
||||
'fields' => [
|
||||
24 => __('1 day'),
|
||||
168 => __('7 days'),
|
||||
360 => __('15 days'),
|
||||
744 => __('1 month'),
|
||||
2160 => __('3 months'),
|
||||
4320 => __('6 months'),
|
||||
8760 => __('1 Year'),
|
||||
],
|
||||
'id' => 'filter_period',
|
||||
'name' => 'filter_period',
|
||||
'label' => __('Date'),
|
||||
'type' => 'date_range',
|
||||
],
|
||||
[
|
||||
'label' => __('IP'),
|
||||
|
@ -312,10 +297,35 @@ class AuditLog extends HTML
|
|||
$filter .= sprintf(" AND ip_origen LIKE '%%%s%%'", $this->filterIp);
|
||||
}
|
||||
|
||||
if (empty($this->filterPeriod) === false) {
|
||||
$filter .= sprintf(' AND fecha >= DATE_ADD(NOW(), INTERVAL -%d HOUR)', $this->filterPeriod);
|
||||
// Calculate range dates.
|
||||
$custom_date = $filters['custom_date'];
|
||||
if ($custom_date === '1') {
|
||||
$date_from = ($filters['date_init'].' '.$filters['time_init']);
|
||||
$date_to = ($filters['date_end'].' '.$filters['time_end']);
|
||||
} else if ($custom_date === '2') {
|
||||
$period = ($filters['date_text'] * $filters['date_units']);
|
||||
$date_to = date('Y-m-d H:i:s');
|
||||
$date_from = date('Y-m-d H:i:s', (strtotime($date_to) - $period));
|
||||
} else if (in_array($filters['date'], ['this_week', 'this_month', 'past_week', 'past_month'])) {
|
||||
if ($filters['date'] === 'this_week') {
|
||||
$date_from = date('Y-m-d 00:00:00', strtotime('last monday'));
|
||||
$date_to = date('Y-m-d 23:59:59', strtotime($date_from.' +6 days'));
|
||||
} else if ($filters['date'] === 'this_month') {
|
||||
$date_from = date('Y-m-d 23:59:59', strtotime('first day of this month'));
|
||||
$date_to = date('Y-m-d 00:00:00', strtotime('last day of this month'));
|
||||
} else if ($filters['date'] === 'past_month') {
|
||||
$date_from = date('Y-m-d 00:00:00', strtotime('first day of previous month'));
|
||||
$date_to = date('Y-m-d 23:59:59', strtotime('last day of previous month'));
|
||||
} else if ($filters['date'] === 'past_week') {
|
||||
$date_from = date('Y-m-d 00:00:00', strtotime('monday', strtotime('last week')));
|
||||
$date_to = date('Y-m-d 23:59:59', strtotime('sunday', strtotime('last week')));
|
||||
}
|
||||
} else {
|
||||
$date_to = date('Y-m-d H:i:s');
|
||||
$date_from = date('Y-m-d H:i:s', (strtotime($date_to) - $filters['date']));
|
||||
}
|
||||
|
||||
$filter .= sprintf(' AND fecha BETWEEN "%s" AND "%s"', $date_from, $date_to);
|
||||
$count = (int) db_get_value_sql(sprintf('SELECT COUNT(*) as "total" FROM tsesion WHERE %s', $filter));
|
||||
|
||||
if ($length !== '-1') {
|
||||
|
|
|
@ -549,6 +549,11 @@ class SnmpConsole extends HTML
|
|||
$order = get_datatable_order(true);
|
||||
$filters = get_parameter('filter', []);
|
||||
|
||||
// Build ranges.
|
||||
$now_timestamp = time();
|
||||
$interval_seconds = ($filters['filter_hours_ago'] * 3600);
|
||||
$ago_timestamp = ($now_timestamp - $interval_seconds);
|
||||
|
||||
// Build ranges.
|
||||
$now = new DateTime();
|
||||
$ago = new DateTime();
|
||||
|
@ -688,7 +693,7 @@ class SnmpConsole extends HTML
|
|||
if ($date_from_trap != '') {
|
||||
if ($time_from_trap != '') {
|
||||
$whereSubquery .= '
|
||||
AND (UNIX_TIMESTAMP(timestamp) > UNIX_TIMESTAMP("'.$date_from_trap.' '.$time_from_trap.'"))
|
||||
AND (utimestamp > '.$ago_timestamp.')
|
||||
';
|
||||
} else {
|
||||
$whereSubquery .= '
|
||||
|
@ -700,7 +705,7 @@ class SnmpConsole extends HTML
|
|||
if ($date_to_trap != '') {
|
||||
if ($time_to_trap) {
|
||||
$whereSubquery .= '
|
||||
AND (UNIX_TIMESTAMP(timestamp) < UNIX_TIMESTAMP("'.$date_to_trap.' '.$time_to_trap.'"))
|
||||
AND (utimestamp < '.$now_timestamp.')
|
||||
';
|
||||
} else {
|
||||
$whereSubquery .= '
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC230904';
|
||||
$build_version = 'PC230906';
|
||||
$pandora_version = 'v7.0NG.773.3';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -1137,6 +1137,10 @@ function config_update_config()
|
|||
$error_update[] = __('Custom title header');
|
||||
}
|
||||
|
||||
if (config_update_value('datepicker_first_day', (string) get_parameter('datepicker_first_day'), true) === false) {
|
||||
$error_update[] = __('Datepicker first day');
|
||||
}
|
||||
|
||||
if (config_update_value('custom_subtitle_header', (string) get_parameter('custom_subtitle_header'), true) === false) {
|
||||
$error_update[] = __('Custom subtitle header');
|
||||
}
|
||||
|
@ -2744,6 +2748,10 @@ function config_process_config()
|
|||
config_update_value('custom_title_header', __('Pandora FMS'));
|
||||
}
|
||||
|
||||
if (!isset($config['datepicker_first_day'])) {
|
||||
config_update_value('datepicker_first_day', '0');
|
||||
}
|
||||
|
||||
if (!isset($config['custom_subtitle_header'])) {
|
||||
config_update_value('custom_subtitle_header', __('the Flexible Monitoring System'));
|
||||
}
|
||||
|
|
|
@ -125,9 +125,22 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
|
|||
if (isset($_FILES['file']) === true && empty($_FILES['file']['name']) === false) {
|
||||
$filename = $_FILES['file']['name'];
|
||||
$real_directory = filemanager_safe_directory($destination_directory);
|
||||
$umask = io_safe_output((string) get_parameter('umask'));
|
||||
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
|
||||
if (strpos($real_directory, $default_real_directory) !== 0) {
|
||||
$umask = io_safe_output((string) get_parameter('umask'));
|
||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||
$check_extension = true;
|
||||
if ($parse_sec2_query[1] === 'operation/snmpconsole/snmp_mib_uploader') {
|
||||
if ((strtolower($extension) !== 'mib' && strtolower($extension) !== 'zip')) {
|
||||
$check_extension = false;
|
||||
} else {
|
||||
$check_extension = true;
|
||||
}
|
||||
}
|
||||
|
||||
// (strtolower($extension) !== 'mib' && strtolower($extension) !== 'zip')
|
||||
if (strpos($real_directory, $default_real_directory) !== 0 || $check_extension === false) {
|
||||
// Perform security check to determine whether received upload
|
||||
// directory is part of the default path for caller uploader and
|
||||
// user is not trying to access an external path (avoid
|
||||
|
@ -177,14 +190,31 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
|
|||
|
||||
// Upload zip.
|
||||
if ($upload_zip === true) {
|
||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||
if (isset($_FILES['file']) === true
|
||||
&& empty($_FILES['file']['name']) === false
|
||||
) {
|
||||
$filename = $_FILES['file']['name'];
|
||||
$filepath = $_FILES['file']['tmp_name'];
|
||||
$real_directory = filemanager_safe_directory($destination_directory);
|
||||
$secure = true;
|
||||
if ($parse_sec2_query[1] === 'operation/snmpconsole/snmp_mib_uploader') {
|
||||
// Security control structure.
|
||||
$zip = new \ZipArchive;
|
||||
if ($zip->open($filepath) === true) {
|
||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
$unzip_filename = $zip->getNameIndex($i);
|
||||
$extension = pathinfo($unzip_filename, PATHINFO_EXTENSION);
|
||||
if (strtolower($extension) !== 'mib') {
|
||||
$secure = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($real_directory, $default_real_directory) !== 0) {
|
||||
if (strpos($real_directory, $default_real_directory) !== 0 || $secure === false) {
|
||||
// Perform security check to determine whether received upload
|
||||
// directory is part of the default path for caller uploader
|
||||
// and user is not trying to access an external path (avoid
|
||||
|
|
|
@ -7246,6 +7246,298 @@ function html_print_code_picker(
|
|||
}
|
||||
|
||||
|
||||
function html_print_select_date_range(
|
||||
$name,
|
||||
$return,
|
||||
$selected=SECONDS_1DAY,
|
||||
$date_init='',
|
||||
$time_init='',
|
||||
$date_end='',
|
||||
$time_end='',
|
||||
$date_text=SECONDS_1DAY,
|
||||
$class='w100p'
|
||||
) {
|
||||
global $config;
|
||||
|
||||
if ($selected === 'custom') {
|
||||
$display_extend = '';
|
||||
$display_range = 'style="display:none"';
|
||||
$display_default = 'style="display:none"';
|
||||
$custom_date = 2;
|
||||
} else if ($selected === 'chose_range') {
|
||||
$display_range = '';
|
||||
$display_default = 'style="display:none"';
|
||||
$display_extend = 'style="display:none"';
|
||||
$custom_date = 1;
|
||||
} else {
|
||||
$display_default = '';
|
||||
$display_range = 'style="display:none"';
|
||||
$display_extend = 'style="display:none"';
|
||||
$custom_date = 0;
|
||||
}
|
||||
|
||||
if ($date_end === '') {
|
||||
$date_end = date('Y/m/d');
|
||||
}
|
||||
|
||||
if ($date_init === '') {
|
||||
$date_init = date('Y/m/d', strtotime($date_end.' -1 days'));
|
||||
}
|
||||
|
||||
if ($time_init === '') {
|
||||
$time_init = date('H:i:s');
|
||||
}
|
||||
|
||||
if ($time_end === '') {
|
||||
$time_end = date('H:i:s');
|
||||
}
|
||||
|
||||
$fields[SECONDS_1DAY] = __('Last 24hr');
|
||||
$fields['this_week'] = __('This week');
|
||||
$fields['this_month'] = __('This month');
|
||||
$fields['past_week'] = __('Past week');
|
||||
$fields['past_month'] = __('Past month');
|
||||
$fields[SECONDS_1WEEK] = __('Last 7 days');
|
||||
$fields[SECONDS_15DAYS] = __('Last 15 days');
|
||||
$fields[SECONDS_1MONTH] = __('Last 30 days');
|
||||
$fields['custom'] = __('Custom');
|
||||
$fields['chose_range'] = __('Chose start/end date period');
|
||||
|
||||
$output = html_print_input_hidden('custom_date', $custom_date, true);
|
||||
$output .= '<div id="'.$name.'_default" class="wauto inline_flex" '.$display_default.'>';
|
||||
$output .= html_print_select(
|
||||
$fields,
|
||||
$name,
|
||||
$selected,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
$class
|
||||
);
|
||||
$output .= '</div>';
|
||||
$output .= '<div id="'.$name.'_range" class="inline_flex" '.$display_range.'>';
|
||||
$table = new stdClass();
|
||||
$table->class = 'table-adv-filter';
|
||||
$table->data[0][0] .= '<div><div><div><span class="font-title-font">'.__('From').':</span></div>';
|
||||
$table->data[0][0] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' ';
|
||||
$table->data[0][0] .= html_print_input_text('time_init', $time_init, '', 10, 7, true).' ';
|
||||
$table->data[0][0] .= '</div>';
|
||||
$table->data[0][0] .= '<div><div><span class="font-title-font">'.__('to').':</span></div>';
|
||||
$table->data[0][0] .= html_print_input_text('date_end', $date_end, '', 12, 10, true).' ';
|
||||
$table->data[0][0] .= '<div id="'.$name.'_manual" class="w100p inline_line">';
|
||||
$table->data[0][0] .= html_print_input_text('time_end', $time_end, '', 10, 7, true).' ';
|
||||
$table->data[0][0] .= ' <a href="javascript:">'.html_print_image(
|
||||
'images/logs@svg.svg',
|
||||
true,
|
||||
[
|
||||
'id' => 'back_default',
|
||||
'class' => ' main_menu_icon invert_filter',
|
||||
'alt' => __('List'),
|
||||
'title' => __('List'),
|
||||
'style' => 'width: 18px;',
|
||||
]
|
||||
).'</a>';
|
||||
$table->data[0][0] .= '</div></div>';
|
||||
$output .= html_print_table($table, true);
|
||||
$output .= '</div>';
|
||||
|
||||
$units = [
|
||||
1 => __('seconds'),
|
||||
SECONDS_1MINUTE => __('minutes'),
|
||||
SECONDS_1HOUR => __('hours'),
|
||||
SECONDS_1DAY => __('days'),
|
||||
SECONDS_1WEEK => __('weeks'),
|
||||
SECONDS_1MONTH => __('months'),
|
||||
SECONDS_1YEAR => __('years'),
|
||||
];
|
||||
$output .= '<div id="'.$name.'_extend" class="w100p inline_flex" '.$display_extend.'>';
|
||||
$output .= html_print_input_text($name.'_text', $date_text, '', false, 255, true);
|
||||
$output .= html_print_select(
|
||||
$units,
|
||||
$name.'_units',
|
||||
'1',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
' margin-left: 5px; width: 140px;',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$output .= ' <a href="javascript:">'.html_print_image(
|
||||
'images/logs@svg.svg',
|
||||
true,
|
||||
[
|
||||
'id' => 'back_default_extend',
|
||||
'class' => $name.'_toggler main_menu_icon invert_filter',
|
||||
'alt' => __('List'),
|
||||
'title' => __('List'),
|
||||
'style' => 'width: 18px;margin-bottom: -5px; padding-top: 10px;',
|
||||
]
|
||||
).'</a>';
|
||||
$output .= '</div>';
|
||||
ui_include_time_picker();
|
||||
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
|
||||
$output .= "<script type='text/javascript'>
|
||||
$(document).ready (function () {
|
||||
$('#".$name."').change(function(){
|
||||
if ($(this).val() === 'chose_range') {
|
||||
$('#".$name."_range').show();
|
||||
$('#".$name."_default').hide();
|
||||
$('#".$name."_extend').hide();
|
||||
$('#hidden-custom_date').val('1');
|
||||
} else if ($(this).val() === 'custom') {
|
||||
$('#".$name."_range').hide();
|
||||
$('#".$name."_default').hide();
|
||||
$('#".$name."_extend').show();
|
||||
$('#hidden-custom_date').val('2');
|
||||
}
|
||||
});
|
||||
|
||||
$('#back_default, #back_default_extend').click(function(){
|
||||
display_default();
|
||||
});
|
||||
|
||||
// To get position must to be showed, hide elements return 0 on offset function.
|
||||
$('#".$name."_range').show();
|
||||
$('#".$name."_default').hide();
|
||||
$('#".$name."_extend').hide();
|
||||
position_top_init = $('#text-date_init').offset().top + $('#text-date_init').outerHeight();
|
||||
position_top_end = $('#text-date_end').offset().top + $('#text-date_end').outerHeight();
|
||||
$('#".$name."_range').hide();
|
||||
$('#".$name."_extend').hide();
|
||||
$('#".$name."_default').show();
|
||||
});
|
||||
|
||||
var position_top_init = 0;
|
||||
var position_top_end = 0;
|
||||
|
||||
function display_default(){
|
||||
$('#".$name."_default').show();
|
||||
$('#".$name."_range').hide();
|
||||
$('#".$name."_extend').hide();
|
||||
$('#".$name."').val('".SECONDS_1DAY."').trigger('change');
|
||||
$('#hidden-custom_date').val('0');
|
||||
}
|
||||
|
||||
$('#text-date').datepicker({
|
||||
dateFormat: '".DATE_FORMAT_JS."',
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
showAnim: 'slideDown'
|
||||
});
|
||||
|
||||
$('[id^=text-time_init]').timepicker({
|
||||
showSecond: true,
|
||||
timeFormat: '".TIME_FORMAT_JS."',
|
||||
timeOnlyTitle: '".__('Choose time')."',
|
||||
timeText: '".__('Time')."',
|
||||
hourText: '".__('Hour')."',
|
||||
minuteText: '".__('Minute')."',
|
||||
secondText: '".__('Second')."',
|
||||
currentText: '".__('Now')."',
|
||||
closeText: '".__('Close')."'
|
||||
});
|
||||
|
||||
$('[id^=text-date_init]').datepicker ({
|
||||
dateFormat: '".DATE_FORMAT_JS."',
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
showAnim: 'slideDown',
|
||||
firstDay: ".$config['datepicker_first_day'].",
|
||||
beforeShowDay: function (date) {
|
||||
show_datepicker = 'date_init';
|
||||
var date_now = date.getTime();
|
||||
var date_ini_split = $('[id^=text-date_init]').val().split('/');
|
||||
var date_ini = new Date(date_ini_split[1]+'/'+date_ini_split[2]+'/'+date_ini_split[0]).getTime();
|
||||
var date_end_split = $('[id^=text-date_end]').val().split('/');
|
||||
var date_end = new Date(date_end_split[1]+'/'+date_end_split[2]+'/'+date_end_split[0]).getTime();
|
||||
if (date_now > date_ini && date_now < date_end) {
|
||||
return [true, 'ui-date-range-in', 'prueba'];
|
||||
} else if (date_now == date_ini || date_now == date_end){
|
||||
return [true, 'ui-datepicker-current-day', ''];
|
||||
}
|
||||
return [true, '', ''];
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=text-date_end]').datepicker ({
|
||||
dateFormat: '".DATE_FORMAT_JS."',
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
showAnim: 'slideDown',
|
||||
firstDay: ".$config['datepicker_first_day'].",
|
||||
beforeShowDay: function (date) {
|
||||
show_datepicker = 'date_end';
|
||||
var date_now = date.getTime();
|
||||
var date_ini_split = $('[id^=text-date_init]').val().split('/');
|
||||
var date_ini = new Date(date_ini_split[1]+'/'+date_ini_split[2]+'/'+date_ini_split[0]).getTime();
|
||||
var date_end_split = $('[id^=text-date_end]').val().split('/');
|
||||
var date_end = new Date(date_end_split[1]+'/'+date_end_split[2]+'/'+date_end_split[0]).getTime();
|
||||
if (date_now > date_ini && date_now < date_end) {
|
||||
return [true, 'ui-date-range-in', 'prueba'];
|
||||
} else if (date_now == date_ini || date_now == date_end){
|
||||
return [true, 'ui-datepicker-current-day', ''];
|
||||
}
|
||||
return [true, '', ''];
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=text-time_end]').timepicker({
|
||||
showSecond: true,
|
||||
timeFormat: '".TIME_FORMAT_JS."',
|
||||
timeOnlyTitle: '".__('Choose time')."',
|
||||
timeText: '".__('Time')."',
|
||||
hourText: '".__('Hour')."',
|
||||
minuteText: '".__('Minute')."',
|
||||
secondText: '".__('Second')."',
|
||||
currentText: '".__('Now')."',
|
||||
closeText: '".__('Close')."'
|
||||
});
|
||||
|
||||
$(window).scroll(function(e){
|
||||
if ($('#date option:selected').val() == 'chose_range'){
|
||||
if ($('#ui-datepicker-div').html() !== '') {
|
||||
if ($(this).scrollTop() > 0){
|
||||
var css_datepicker = $('#ui-datepicker-div').attr('style').replace('absolute','fixed');
|
||||
if (!css_datepicker.includes('px !important')) {
|
||||
if (show_datepicker == 'date_end'){
|
||||
css_datepicker += '; top: '+position_top_end+'px !important';
|
||||
} else {
|
||||
css_datepicker += '; top: '+position_top_init+'px !important';
|
||||
}
|
||||
}
|
||||
$('#ui-datepicker-div').attr('style', css_datepicker);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>";
|
||||
|
||||
if ($return === true) {
|
||||
return $output;
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function html_print_wizard_diagnosis(
|
||||
$title,
|
||||
$id_button,
|
||||
|
@ -7284,4 +7576,5 @@ function html_print_wizard_diagnosis(
|
|||
} else {
|
||||
echo $output;
|
||||
}
|
||||
|
||||
}
|
|
@ -31,6 +31,7 @@ function inventory_get_data(
|
|||
$agents_ids,
|
||||
$inventory_module_name,
|
||||
$utimestamp,
|
||||
$period,
|
||||
$inventory_search_string='',
|
||||
$export_csv=false,
|
||||
$return_mode=false,
|
||||
|
@ -97,7 +98,7 @@ function inventory_get_data(
|
|||
|
||||
// Prepare pagination.
|
||||
$url = sprintf(
|
||||
'?sec=estado&sec2=operation/inventory/inventory&agent_id=%s&agent=%s&id_group=%s&export=%s&module_inventory_general_view=%s&search_string=%s&utimestamp=%s&order_by_agent=%s&submit_filter=%d',
|
||||
'?sec=estado&sec2=operation/inventory/inventory&agent_id=%s&agent=%s&id_group=%s&export=%s&module_inventory_general_view=%s&search_string=%s&utimestamp=%s&period=%s&order_by_agent=%s&submit_filter=%d',
|
||||
$pagination_url_parameters['inventory_id_agent'],
|
||||
$pagination_url_parameters['inventory_agent'],
|
||||
$pagination_url_parameters['inventory_id_group'],
|
||||
|
@ -105,6 +106,7 @@ function inventory_get_data(
|
|||
$inventory_module_name,
|
||||
$inventory_search_string,
|
||||
$utimestamp,
|
||||
$period,
|
||||
$order_by_agent,
|
||||
1
|
||||
);
|
||||
|
@ -328,7 +330,7 @@ function inventory_get_data(
|
|||
$timestamp = db_get_value_sql(
|
||||
"SELECT timestamp
|
||||
FROM tagente_datos_inventory
|
||||
WHERE utimestamp = $utimestamp"
|
||||
WHERE utimestamp BETWEEN '".($utimestamp - $period)."' AND '".$utimestamp."'"
|
||||
);
|
||||
} else {
|
||||
$timestamp = db_get_value_sql(
|
||||
|
@ -892,6 +894,14 @@ function get_data_basic_info_sql($params, $count=false)
|
|||
);
|
||||
}
|
||||
|
||||
if ($params['utimestamp'] > 0 && $count === false) {
|
||||
$where .= sprintf(
|
||||
' AND utimestamp BETWEEN %d AND %d',
|
||||
($params['utimestamp'] - $params['period']),
|
||||
$params['utimestamp']
|
||||
);
|
||||
}
|
||||
|
||||
if ($params['order'] > 0) {
|
||||
$str_split = explode(' ', $params['order']);
|
||||
switch ($str_split[0]) {
|
||||
|
|
|
@ -4022,7 +4022,11 @@ function ui_print_datatable(array $parameters)
|
|||
$filter .= '<ul class="datatable_filter content filter_table no_border">';
|
||||
|
||||
foreach ($parameters['form']['inputs'] as $input) {
|
||||
$filter .= html_print_input(($input + ['return' => true]), 'li');
|
||||
if ($input['type'] === 'date_range') {
|
||||
$filter .= '<li><label>'.$input['label'].'</label>'.html_print_select_date_range('date', true).'</li>';
|
||||
} else {
|
||||
$filter .= html_print_input(($input + ['return' => true]), 'li');
|
||||
}
|
||||
}
|
||||
|
||||
$filter .= '</ul>';
|
||||
|
|
|
@ -46,6 +46,18 @@ $hash = get_parameter('hash');
|
|||
$file_raw = get_parameter('file');
|
||||
|
||||
$file = base64_decode(urldecode($file_raw));
|
||||
$secure_extension = true;
|
||||
$extension = pathinfo($file, PATHINFO_EXTENSION);
|
||||
if ($extension === 'php' || $extension === 'js') {
|
||||
$secure_extension = false;
|
||||
}
|
||||
|
||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||
$dirname = dirname($file);
|
||||
|
||||
$path_traversal = strpos($file, '../');
|
||||
|
||||
// Avoid possible inifite loop with referer.
|
||||
if (isset($_SERVER['HTTP_ORIGIN']) === false || (isset($_SERVER['HTTP_ORIGIN']) === true && $_SERVER['HTTP_REFERER'] === $_SERVER['HTTP_ORIGIN'].$_SERVER['REQUEST_URI'])) {
|
||||
$refererPath = ui_get_full_url('index.php');
|
||||
|
@ -53,12 +65,13 @@ if (isset($_SERVER['HTTP_ORIGIN']) === false || (isset($_SERVER['HTTP_ORIGIN'])
|
|||
$refererPath = $_SERVER['HTTP_REFERER'];
|
||||
}
|
||||
|
||||
if (empty($file) === true || empty($hash) === true || $hash !== md5($file_raw.$config['server_unique_identifier']) || isset($_SERVER['HTTP_REFERER']) === false) {
|
||||
if (empty($file) === true || empty($hash) === true || $hash !== md5($file_raw.$config['server_unique_identifier'])
|
||||
|| isset($_SERVER['HTTP_REFERER']) === false || $path_traversal !== false || $secure_extension === false
|
||||
) {
|
||||
$errorMessage = __('Security error. Please contact the administrator.');
|
||||
} else {
|
||||
$downloadable_file = '';
|
||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||
|
||||
// Metaconsole have a route distinct than node.
|
||||
$main_file_manager = (is_metaconsole() === true) ? 'advanced/metasetup' : 'godmode/setup/file_manager';
|
||||
$main_collections = (is_metaconsole() === true) ? 'advanced/collections' : 'enterprise/godmode/agentes/collections';
|
||||
|
@ -70,7 +83,9 @@ if (empty($file) === true || empty($hash) === true || $hash !== md5($file_raw.$c
|
|||
break;
|
||||
|
||||
case 'extensions/files_repo':
|
||||
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/files_repo/'.$file;
|
||||
$attachment_path = io_safe_output($config['attachment_store']);
|
||||
$downloadable_file = $attachment_path.'/files_repo/'.$file;
|
||||
// $downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/files_repo/'.$file;
|
||||
break;
|
||||
|
||||
case 'godmode/servers/plugin':
|
||||
|
@ -81,6 +96,9 @@ if (empty($file) === true || empty($hash) === true || $hash !== md5($file_raw.$c
|
|||
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/collection/'.$file;
|
||||
break;
|
||||
|
||||
case 'godmode/setup/file_manager':
|
||||
$downloadable_file = ($dirname === 'image') ? $_SERVER['DOCUMENT_ROOT'].'/pandora_console/'.$file : '';
|
||||
|
||||
default:
|
||||
// Wrong action.
|
||||
$downloadable_file = '';
|
||||
|
|
|
@ -943,17 +943,25 @@ function pandoraFlotSlicebar(
|
|||
|
||||
// Format functions
|
||||
function xFormatter(v) {
|
||||
// var ct = new Date();
|
||||
var ct = new timezoneJS.Date();
|
||||
ct.setTimezone(phpTimezone);
|
||||
var ct;
|
||||
if (typeof timezoneJS === "undefined") {
|
||||
ct = new Date();
|
||||
} else {
|
||||
ct = new timezoneJS.Date();
|
||||
ct.setTimezone(phpTimezone);
|
||||
}
|
||||
|
||||
var currentTime = ct.getTime();
|
||||
|
||||
var diffDates = (currentTime - 1000 * datelimit) / 1000;
|
||||
|
||||
// var d = new Date(1000 * (v + datelimit));
|
||||
var d = new timezoneJS.Date(1000 * (v + datelimit));
|
||||
d.setTimezone(phpTimezone);
|
||||
var d;
|
||||
if (typeof timezoneJS === "undefined") {
|
||||
d = new Date(1000 * (v + datelimit));
|
||||
} else {
|
||||
d = new timezoneJS.Date(1000 * (v + datelimit));
|
||||
d.setTimezone(phpTimezone);
|
||||
}
|
||||
|
||||
var monthNames = [
|
||||
"Jan",
|
||||
|
|
|
@ -83,7 +83,7 @@ function d3_relationship_graph($elements, $matrix, $width=700, $return=false, $h
|
|||
}
|
||||
|
||||
|
||||
function d3_tree_map_graph($data, $width=700, $height=700, $return=false)
|
||||
function d3_tree_map_graph($data, $width=700, $height=700, $return=false, $id_container='tree_map', $child_links=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
@ -91,7 +91,7 @@ function d3_tree_map_graph($data, $width=700, $height=700, $return=false)
|
|||
$data = json_encode($data);
|
||||
}
|
||||
|
||||
$output = "<div id=\"tree_map\" style='overflow: hidden;'></div>";
|
||||
$output = '<div id="'.$id_container."\" style='overflow: hidden;'></div>";
|
||||
$output .= include_javascript_d3(true);
|
||||
$output .= '<style type="text/css">
|
||||
.cell>rect {
|
||||
|
@ -139,8 +139,18 @@ function d3_tree_map_graph($data, $width=700, $height=700, $return=false)
|
|||
}
|
||||
</style>';
|
||||
$output .= "<script language=\"javascript\" type=\"text/javascript\">
|
||||
treeMap('#tree_map', $data, '$width', '$height');
|
||||
treeMap('#$id_container', $data, '$width', '$height', $child_links);
|
||||
</script>";
|
||||
if ($child_links === true) {
|
||||
$output .= html_print_input_image(
|
||||
'resize_parent',
|
||||
'/images/normal_screen.png',
|
||||
1,
|
||||
'background-color: white !important; padding: 4px !important;',
|
||||
true,
|
||||
['class' => 'resize_button invisible']
|
||||
);
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
echo $output;
|
||||
|
|
|
@ -402,18 +402,24 @@ function chordDiagram(recipient, elements, matrix, width, height) {
|
|||
// }
|
||||
// ]
|
||||
// };
|
||||
function treeMap(recipient, data, width, height) {
|
||||
function treeMap(recipient, data, width, height, childLinks = false) {
|
||||
//var isIE = BrowserDetect.browser == 'Explorer';
|
||||
var isIE = true;
|
||||
var chartWidth = width;
|
||||
var chartHeight = height;
|
||||
var consoleStyle = document.getElementById("hidden-selected_style_theme")
|
||||
.value;
|
||||
$("#tooltip").css(
|
||||
const uniqueId = generateUniqueId();
|
||||
if (document.getElementById("hidden-selected_style_theme") !== null) {
|
||||
var consoleStyle = document.getElementById("hidden-selected_style_theme")
|
||||
.value;
|
||||
} else {
|
||||
var consoleStyle = "";
|
||||
}
|
||||
|
||||
$("#tooltip_" + uniqueId).css(
|
||||
"color",
|
||||
consoleStyle === "pandora_black" ? "rgb(240, 240, 240)" : "rgb(0, 0, 0)"
|
||||
);
|
||||
$("#tooltip").css(
|
||||
$("#tooltip_" + uniqueId).css(
|
||||
"background-color",
|
||||
consoleStyle === "pandora_black" ? "rgb(0, 0, 0)" : "rgb(240, 240, 240)"
|
||||
);
|
||||
|
@ -431,6 +437,9 @@ function treeMap(recipient, data, width, height) {
|
|||
var transitionDuration = 500;
|
||||
var root;
|
||||
var node;
|
||||
var resize_button = $(recipient)
|
||||
.parent()
|
||||
.find(".resize_button");
|
||||
|
||||
var treemap = d3.layout
|
||||
.treemap()
|
||||
|
@ -468,6 +477,7 @@ function treeMap(recipient, data, width, height) {
|
|||
.attr("class", "cell parent")
|
||||
.on("click", function(d) {
|
||||
zoom(d);
|
||||
resize_button.show();
|
||||
})
|
||||
.append("svg")
|
||||
.attr("class", "clip")
|
||||
|
@ -476,6 +486,9 @@ function treeMap(recipient, data, width, height) {
|
|||
})
|
||||
.attr("height", headerHeight);
|
||||
parentEnterTransition
|
||||
.filter(function(d) {
|
||||
if (d.name) return d;
|
||||
})
|
||||
.append("rect")
|
||||
.attr("width", function(d) {
|
||||
return Math.max(0.01, d.dx);
|
||||
|
@ -483,6 +496,9 @@ function treeMap(recipient, data, width, height) {
|
|||
.attr("height", headerHeight)
|
||||
.style("fill", headerColor);
|
||||
parentEnterTransition
|
||||
.filter(function(d) {
|
||||
if (d.name) return d;
|
||||
})
|
||||
.append("text")
|
||||
.attr("class", "label")
|
||||
.attr("fill", "white")
|
||||
|
@ -490,6 +506,7 @@ function treeMap(recipient, data, width, height) {
|
|||
.attr("width", function(d) {
|
||||
return Math.max(0.01, d.dx);
|
||||
})
|
||||
.attr("style", "transition: all 0.5s ease-out;")
|
||||
.attr("height", headerHeight)
|
||||
.text(function(d) {
|
||||
return d.name;
|
||||
|
@ -521,6 +538,10 @@ function treeMap(recipient, data, width, height) {
|
|||
// remove transition
|
||||
parentCells.exit().remove();
|
||||
|
||||
$(resize_button).on("click", function() {
|
||||
zoom(root);
|
||||
$(this).hide();
|
||||
});
|
||||
// create children cells
|
||||
var childrenCells = chart
|
||||
.selectAll("g.cell.child")
|
||||
|
@ -534,19 +555,27 @@ function treeMap(recipient, data, width, height) {
|
|||
.append("g")
|
||||
.attr("class", "cell child")
|
||||
.on("click", function(d) {
|
||||
zoom(node === d.parent ? root : d.parent);
|
||||
if (childLinks) {
|
||||
if (node === d.parent) {
|
||||
window.location.href = d.link;
|
||||
} else {
|
||||
resize_button.show();
|
||||
zoom(d.parent);
|
||||
}
|
||||
} else {
|
||||
zoom(node === d.parent ? root : d.parent);
|
||||
}
|
||||
})
|
||||
.on("mouseover", over_user)
|
||||
.on("mouseout", out_user)
|
||||
.on("mousemove", move_tooltip)
|
||||
.append("svg")
|
||||
.attr("class", "clip");
|
||||
|
||||
$(recipient).on("mouseover", over_user);
|
||||
$(recipient).on("mouseout", out_user);
|
||||
$(recipient).on("mousemove", move_tooltip);
|
||||
childEnterTransition
|
||||
.append("rect")
|
||||
.classed("background", true)
|
||||
.style("fill", function(d) {
|
||||
return color(d.name);
|
||||
return d.color ? d.color : color(d.name);
|
||||
});
|
||||
|
||||
childEnterTransition
|
||||
|
@ -608,6 +637,30 @@ function treeMap(recipient, data, width, height) {
|
|||
|
||||
zoom(node);
|
||||
|
||||
function calculateSizeText() {
|
||||
$(recipient + " .parent .clip .label").each((key, node) => {
|
||||
const textElement = node;
|
||||
const containerWidth = parseFloat(
|
||||
$(textElement)
|
||||
.parent()
|
||||
.attr("width")
|
||||
);
|
||||
const originalFontSize = 12;
|
||||
|
||||
textElement.style.fontSize = "16px";
|
||||
const computedTextLength = textElement.getComputedTextLength();
|
||||
const textWidth = computedTextLength + 8;
|
||||
textElement.style.fontSize = originalFontSize + "px";
|
||||
|
||||
const scaleFactor = containerWidth / textWidth;
|
||||
let scaledFontSize = parseFloat(originalFontSize) * scaleFactor;
|
||||
|
||||
scaledFontSize = scaledFontSize > 12 ? 12 : scaledFontSize;
|
||||
|
||||
textElement.style.fontSize = scaledFontSize + "px";
|
||||
});
|
||||
}
|
||||
|
||||
function size(d) {
|
||||
return d.size;
|
||||
}
|
||||
|
@ -728,6 +781,9 @@ function treeMap(recipient, data, width, height) {
|
|||
if (d3.event) {
|
||||
d3.event.stopPropagation();
|
||||
}
|
||||
setTimeout(() => {
|
||||
calculateSizeText();
|
||||
}, transitionDuration);
|
||||
}
|
||||
|
||||
function position() {
|
||||
|
@ -746,11 +802,10 @@ function treeMap(recipient, data, width, height) {
|
|||
}
|
||||
|
||||
function move_tooltip(d) {
|
||||
x = d3.event.pageX + 10;
|
||||
y = d3.event.pageY + 10;
|
||||
|
||||
$("#tooltip").css("left", x + "px");
|
||||
$("#tooltip").css("top", y + "px");
|
||||
x = d.offsetX + 40;
|
||||
y = d.offsetY + 40;
|
||||
$("#tooltip_" + uniqueId).css("left", x + "px");
|
||||
$("#tooltip_" + uniqueId).css("top", y + "px");
|
||||
}
|
||||
|
||||
function over_user(d) {
|
||||
|
@ -772,17 +827,17 @@ function treeMap(recipient, data, width, height) {
|
|||
}
|
||||
|
||||
function create_tooltip(d, x, y) {
|
||||
if ($("#tooltip").length == 0) {
|
||||
if ($("#tooltip_" + uniqueId).length == 0) {
|
||||
$(recipient).append(
|
||||
$("<div></div>")
|
||||
.attr("id", "tooltip")
|
||||
.html(d.tooltip_content)
|
||||
.attr("id", "tooltip_" + uniqueId)
|
||||
.html(d.target.__data__.tooltip_content)
|
||||
);
|
||||
} else {
|
||||
$("#tooltip").html(d.tooltip_content);
|
||||
$("#tooltip_" + uniqueId).html(d.target.__data__.tooltip_content);
|
||||
}
|
||||
|
||||
$("#tooltip").attr(
|
||||
$("#tooltip_" + uniqueId).attr(
|
||||
"style",
|
||||
"background: #fff;" +
|
||||
"color: #111;" +
|
||||
|
@ -805,14 +860,22 @@ function treeMap(recipient, data, width, height) {
|
|||
}
|
||||
|
||||
function show_tooltip(d) {
|
||||
x = d3.event.pageX + 10;
|
||||
y = d3.event.pageY + 10;
|
||||
|
||||
create_tooltip(d, x, y);
|
||||
x = d.offsetX + 10;
|
||||
y = d.offsetY + 10;
|
||||
if (d.target.__data__) {
|
||||
create_tooltip(d, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
function hide_tooltip() {
|
||||
$("#tooltip").hide();
|
||||
$("#tooltip_" + uniqueId).hide();
|
||||
}
|
||||
|
||||
function generateUniqueId() {
|
||||
const timestamp = new Date().getTime();
|
||||
const randomNum = Math.floor(Math.random() * 10000);
|
||||
const uniqueId = `${timestamp}-${randomNum}`;
|
||||
return uniqueId;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -300,6 +300,10 @@ class Widget
|
|||
$className .= '\GroupsStatusWidget';
|
||||
break;
|
||||
|
||||
case 'groups_status_map':
|
||||
$className .= '\GroupsStatusMapWidget';
|
||||
break;
|
||||
|
||||
case 'maps_made_by_user':
|
||||
$className .= '\MapsMadeByUser';
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,460 @@
|
|||
<?php
|
||||
/**
|
||||
* Widget Group status map Pandora FMS Console
|
||||
*
|
||||
* @category Console Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage Widget Group status
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
namespace PandoraFMS\Dashboard;
|
||||
|
||||
/**
|
||||
* Group status map Widgets.
|
||||
*/
|
||||
class GroupsStatusMapWidget extends Widget
|
||||
{
|
||||
|
||||
/**
|
||||
* Name widget.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Title widget.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Page widget;
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $page;
|
||||
|
||||
/**
|
||||
* Class name widget.
|
||||
*
|
||||
* @var [type]
|
||||
*/
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* Values options for each widget.
|
||||
*
|
||||
* @var [type]
|
||||
*/
|
||||
protected $values;
|
||||
|
||||
/**
|
||||
* Configuration required.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $configurationRequired;
|
||||
|
||||
/**
|
||||
* Error load widget.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $loadError;
|
||||
|
||||
/**
|
||||
* Width.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $width;
|
||||
|
||||
/**
|
||||
* Heigth.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $height;
|
||||
|
||||
/**
|
||||
* Grid Width.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $gridWidth;
|
||||
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param integer $cellId Cell ID.
|
||||
* @param integer $dashboardId Dashboard ID.
|
||||
* @param integer $widgetId Widget ID.
|
||||
* @param integer|null $width New width.
|
||||
* @param integer|null $height New height.
|
||||
* @param integer|null $gridWidth Grid width.
|
||||
*/
|
||||
public function __construct(
|
||||
int $cellId,
|
||||
int $dashboardId=0,
|
||||
int $widgetId=0,
|
||||
?int $width=0,
|
||||
?int $height=0,
|
||||
?int $gridWidth=0
|
||||
) {
|
||||
global $config;
|
||||
|
||||
// WARNING: Do not edit. This chunk must be in the constructor.
|
||||
parent::__construct(
|
||||
$cellId,
|
||||
$dashboardId,
|
||||
$widgetId
|
||||
);
|
||||
|
||||
// Width.
|
||||
$this->width = $width;
|
||||
|
||||
// Height.
|
||||
$this->height = $height;
|
||||
|
||||
// Grid Width.
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
||||
// Page.
|
||||
$this->page = basename(__FILE__);
|
||||
|
||||
// ClassName.
|
||||
$class = new \ReflectionClass($this);
|
||||
$this->className = $class->getShortName();
|
||||
|
||||
// Title.
|
||||
$this->title = __('Group status map');
|
||||
|
||||
// Name.
|
||||
if (empty($this->name) === true) {
|
||||
$this->name = 'groups_status_map';
|
||||
}
|
||||
|
||||
$this->overflow_scrollbars = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['groups']) === true) {
|
||||
$values['groupId'] = $decoder['groups'];
|
||||
}
|
||||
|
||||
if (isset($decoder['groupId']) === true) {
|
||||
$values['groupId'] = $decoder['groupId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['groupRecursion']) === true) {
|
||||
$values['groupRecursion'] = $decoder['groupRecursion'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
* @return array Of inputs.
|
||||
*
|
||||
* @throws Exception On error.
|
||||
*/
|
||||
public function getFormInputs(): array
|
||||
{
|
||||
$values = $this->values;
|
||||
|
||||
// Retrieve global - common inputs.
|
||||
$inputs = parent::getFormInputs();
|
||||
$values['groupId'] = explode(',', $values['groupId']);
|
||||
// Restrict access to group.
|
||||
$inputs[] = [
|
||||
'label' => __('Groups'),
|
||||
'arguments' => [
|
||||
'type' => 'select_groups',
|
||||
'name' => 'groupId',
|
||||
'returnAllGroup' => true,
|
||||
'privilege' => 'AR',
|
||||
'multiple' => true,
|
||||
'selected' => $values['groupId'],
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Group recursion'),
|
||||
'arguments' => [
|
||||
'name' => 'groupRecursion',
|
||||
'id' => 'groupRecursion',
|
||||
'type' => 'switch',
|
||||
'value' => $values['groupRecursion'],
|
||||
],
|
||||
];
|
||||
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Post for widget.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPost():array
|
||||
{
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::getPost();
|
||||
|
||||
$values['groupId'] = \get_parameter('groupId', 0);
|
||||
$values['groupRecursion'] = \get_parameter_switch('groupRecursion', 0);
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw widget.
|
||||
*
|
||||
* @return string;
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$size = parent::getSize();
|
||||
include_once $config['homedir'].'/include/graphs/functions_d3.php';
|
||||
include_once $config['homedir'].'/include/functions_reporting.php';
|
||||
include_once $config['homedir'].'/include/functions_graph.php';
|
||||
$groups_array = (empty($this->values['groupId']) === false) ? explode(',', $this->values['groupId']) : [];
|
||||
|
||||
if ((bool) $this->values['groupRecursion'] === true && in_array('0', $groups_array) === false) {
|
||||
foreach ($groups_array as $key => $group) {
|
||||
$children = groups_get_children($group, false, 'AR', false);
|
||||
foreach ($children as $key => $child) {
|
||||
$groups_array[] = $child['id_grupo'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$where = '';
|
||||
if (in_array('0', $groups_array) === false && count($groups_array) > 0) {
|
||||
$where = ' WHERE g.id_grupo IN ('.implode(',', $groups_array).') ';
|
||||
}
|
||||
|
||||
$servers = metaconsole_get_servers();
|
||||
$rows = [];
|
||||
if (isset($servers) === true && is_array($servers) === true
|
||||
) {
|
||||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect($server) == NOERR) {
|
||||
$sql = 'SELECT g.id_grupo, g.nombre, estado, count(*) AS total_modules
|
||||
FROM tagente a
|
||||
LEFT JOIN tgrupo g ON g.id_grupo = a.id_grupo
|
||||
LEFT JOIN tagente_modulo m ON a.id_agente = m.id_agente
|
||||
LEFT JOIN tagente_estado es ON es.id_agente_modulo = m.id_agente_modulo
|
||||
'.$where.'
|
||||
GROUP BY a.id_grupo, estado';
|
||||
$result = db_process_sql($sql);
|
||||
if ($result !== false) {
|
||||
foreach ($result as $key => $group) {
|
||||
$not_exist = true;
|
||||
foreach ($rows as $key2 => $row) {
|
||||
if ($group['id_grupo'] === $row['id_grupo']
|
||||
&& $group['estado'] === $row['estado']
|
||||
) {
|
||||
$rows[$key2]['total_modules'] += $group['total_modules'];
|
||||
$not_exist = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($not_exist === true) {
|
||||
$rows[] = $group;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$where = '';
|
||||
if (in_array('0', $groups_array) === false && count($groups_array) > 0) {
|
||||
$where = ' WHERE g.id_grupo IN ('.implode(',', $groups_array).') ';
|
||||
}
|
||||
|
||||
$sql = 'SELECT g.id_grupo, g.nombre, estado, count(*) AS total_modules
|
||||
FROM tagente a
|
||||
LEFT JOIN tgrupo g ON g.id_grupo = a.id_grupo
|
||||
LEFT JOIN tagente_modulo m ON a.id_agente = m.id_agente
|
||||
LEFT JOIN tagente_estado es ON es.id_agente_modulo = m.id_agente_modulo
|
||||
'.$where.'
|
||||
GROUP BY a.id_grupo, estado';
|
||||
|
||||
$rows = db_process_sql($sql);
|
||||
}
|
||||
|
||||
if ($rows === false || (is_array($rows) === true && count($rows) === 0)) {
|
||||
$output = ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No data found.'),
|
||||
]
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
|
||||
$level1 = [
|
||||
'name' => __('Module status map'),
|
||||
'children' => [],
|
||||
];
|
||||
|
||||
$names = [];
|
||||
foreach ($rows as $key => $row) {
|
||||
$color = '';
|
||||
$name_status = '';
|
||||
switch ($row['estado']) {
|
||||
case '1':
|
||||
$color = '#e63c52';
|
||||
$name_status = __('Critical');
|
||||
break;
|
||||
|
||||
case '2':
|
||||
$color = '#FFB900';
|
||||
$name_status = __('Warning');
|
||||
break;
|
||||
|
||||
case '0':
|
||||
$color = '#82b92e';
|
||||
$name_status = __('Normal');
|
||||
break;
|
||||
|
||||
case '3':
|
||||
$color = '#B2B2B2';
|
||||
$name_status = __('Unknown');
|
||||
break;
|
||||
|
||||
case '4':
|
||||
$color = '#4a83f3';
|
||||
$name_status = __('No data');
|
||||
$row['estado'] = 6;
|
||||
break;
|
||||
|
||||
default:
|
||||
$row['estado'] = 6;
|
||||
$color = '#B2B2B2';
|
||||
$name_status = __('Unknown');
|
||||
continue;
|
||||
}
|
||||
|
||||
$level1['children'][$row['id_grupo']][] = [
|
||||
'id' => uniqid(),
|
||||
'name' => $row['estado'],
|
||||
'value' => $row['total_modules'],
|
||||
'color' => $color,
|
||||
'tooltip_content' => $row['total_modules'].__(' Modules(%s)', $name_status),
|
||||
'link' => 'index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group='.$row['id_grupo'].'&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status='.$row['estado'].'&sort_field=&sort=none&pure=',
|
||||
];
|
||||
$names[$row['id_grupo']] = $row['nombre'];
|
||||
}
|
||||
|
||||
$level2 = [
|
||||
'children' => [],
|
||||
];
|
||||
foreach ($level1['children'] as $id_grupo => $group) {
|
||||
$level2['children'][] = [
|
||||
'id' => uniqid(),
|
||||
'name' => io_safe_output($names[$id_grupo]),
|
||||
'children' => $group,
|
||||
];
|
||||
}
|
||||
|
||||
$id_container = 'tree_map_'.uniqid();
|
||||
$output = d3_tree_map_graph($level2, $size['width'], $size['height'], true, $id_container, true);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get description.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public static function getDescription()
|
||||
{
|
||||
return __('Group status map');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Name.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public static function getName()
|
||||
{
|
||||
return 'groups_status_map';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get size Modal Configuration.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSizeModalConfiguration(): array
|
||||
{
|
||||
$size = [
|
||||
'width' => 400,
|
||||
'height' => 330,
|
||||
];
|
||||
|
||||
return $size;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -937,3 +937,13 @@ div.basic-chart-title span {
|
|||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input.resize_button {
|
||||
position: absolute;
|
||||
background-color: white !important;
|
||||
padding: 4px !important;
|
||||
border-radius: 20px;
|
||||
width: 28px;
|
||||
bottom: 3%;
|
||||
right: 6%;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -107,24 +107,51 @@
|
|||
height: 30px;
|
||||
width: 90px;
|
||||
}
|
||||
.ui-widget-header .ui-icon {
|
||||
background-image: url(../images/ui-icons_444444_256x240.png);
|
||||
|
||||
.ui-datepicker-prev {
|
||||
margin-top: 5px;
|
||||
background: url(../../../images/arrow_left_green.png) no-repeat 0 0 !important;
|
||||
}
|
||||
.ui-icon,
|
||||
.ui-widget-content .ui-icon {
|
||||
background-image: url(../images/ui-icons_444444_256x240.png);
|
||||
|
||||
.ui-datepicker-next {
|
||||
margin-top: 5px;
|
||||
background: url(../../../images/arrow_right_green.png) no-repeat 0 0 !important;
|
||||
}
|
||||
|
||||
.ui-widget-content {
|
||||
background: #fff;
|
||||
}
|
||||
.ui-state-default,
|
||||
.ui-widget-content .ui-state-default,
|
||||
.ui-widget-header .ui-state-default {
|
||||
margin-top: 3px;
|
||||
border-bottom: 0;
|
||||
background: transparent;
|
||||
font-weight: normal;
|
||||
color: #555555;
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
border: 2px solid #ccc;
|
||||
}
|
||||
.ui-datepicker td,
|
||||
a.ui-state-default,
|
||||
.ui-datepicker td a {
|
||||
width: 30px !important;
|
||||
height: 30px !important;
|
||||
}
|
||||
a.ui-state-default:hover {
|
||||
background-color: #82b92e;
|
||||
}
|
||||
a.ui-state-default > span {
|
||||
text-align: center;
|
||||
margin-top: 2px;
|
||||
}
|
||||
a.ui-state-default > span:hover {
|
||||
font-weight: bold !important;
|
||||
}
|
||||
.ui-datepicker-current-day > a {
|
||||
background-color: #82b92e !important;
|
||||
font-weight: bold !important;
|
||||
border: 2px solid #000 !important;
|
||||
}
|
||||
.ui-corner-all,
|
||||
.ui-corner-top,
|
||||
|
@ -153,13 +180,44 @@
|
|||
#ui-datepicker-div {
|
||||
border-color: #b1b1b1;
|
||||
background: #ffffff;
|
||||
border-radius: 15px;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
width: 350px !important;
|
||||
border: 2px solid var(--primary-color);
|
||||
}
|
||||
.ui-datepicker .ui-datepicker-header {
|
||||
position: relative;
|
||||
padding: 0.2em 0;
|
||||
border-radius: 15px 15px 0px 0px;
|
||||
}
|
||||
.ui-datepicker-title,
|
||||
.ui-datepicker-month,
|
||||
.ui-datepicker-year {
|
||||
height: 30px;
|
||||
}
|
||||
.ui-datepicker-month,
|
||||
.ui-datepicker-year {
|
||||
width: 100px !important;
|
||||
}
|
||||
.ui-datepicker-month {
|
||||
margin-left: -10px !important;
|
||||
margin-right: 25px !important;
|
||||
}
|
||||
.ui-widget-header {
|
||||
background: #b1b1b1;
|
||||
background: white;
|
||||
color: #ffffff;
|
||||
}
|
||||
.ui-datepicker-calendar th {
|
||||
background-color: #3f3f3f;
|
||||
background-color: #fff;
|
||||
padding-left: 15px;
|
||||
text-align: initial;
|
||||
}
|
||||
.ui-datepicker-calendar th span {
|
||||
color: #000;
|
||||
}
|
||||
.ui-widget-header {
|
||||
height: 20px !important;
|
||||
}
|
||||
.ui-dialog .ui-widget-header {
|
||||
margin: 3px 3px 0px 3px;
|
||||
|
@ -175,7 +233,10 @@
|
|||
margin: 0px 15px 0px 15px;
|
||||
}
|
||||
.ui-timepicker-div .ui-datepicker-title {
|
||||
color: white;
|
||||
color: black;
|
||||
}
|
||||
.ui-timepicker-div dl {
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
.ui-datepicker-buttonpane button {
|
||||
border-color: #b1b1b1;
|
||||
|
@ -200,7 +261,6 @@
|
|||
border: 0px;
|
||||
}
|
||||
|
||||
.ui-state-hover .ui-icon,
|
||||
.ui-state-focus .ui-icon,
|
||||
.ui-button:hover .ui-icon,
|
||||
.ui-button:focus .ui-icon {
|
||||
|
@ -233,35 +293,6 @@ a.ui-button:active,
|
|||
border: none;
|
||||
}
|
||||
|
||||
.ui-state-hover:before,
|
||||
.ui-widget-content .ui-state-hover:before,
|
||||
.ui-widget-header .ui-state-hover:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 25%;
|
||||
bottom: -10%;
|
||||
height: 1px;
|
||||
width: 50%;
|
||||
border-bottom: 4px solid #82b92e;
|
||||
}
|
||||
|
||||
.ui-priority-secondary:hover {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: -5px;
|
||||
width: 100%;
|
||||
border-bottom: 5px solid #82b92e;
|
||||
}
|
||||
|
||||
.ui-priority-primary:hover {
|
||||
content: "";
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
bottom: -5px;
|
||||
width: 100%;
|
||||
border-bottom: 5px solid #82b92e;
|
||||
}
|
||||
|
||||
.ui-state-active,
|
||||
.ui-widget-content .ui-state-active,
|
||||
.ui-widget-header .ui-state-active {
|
||||
|
@ -314,3 +345,21 @@ input[type="submit"].ui-button-dialog {
|
|||
height: 30px;
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
.ui-priority-primary,
|
||||
.ui-priority-secondary {
|
||||
background-color: #fff !important;
|
||||
color: var(--primary-color) !important;
|
||||
border: 2px solid var(--primary-color) !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.ui-timepicker-div > dl dt,
|
||||
.ui-timepicker-div > dl dd {
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.ui-timepicker-div > dl dt,
|
||||
.ui_tpicker_time {
|
||||
margin-left: 10px !important;
|
||||
}
|
||||
|
|
|
@ -12562,3 +12562,7 @@ tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input {
|
|||
flex-wrap: nowrap;
|
||||
justify-content: flex-start !important;
|
||||
}
|
||||
|
||||
.ui-date-range-in > a {
|
||||
background-color: #81b92e3b !important;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
<div style='padding-bottom: 50px'>
|
||||
<?php
|
||||
$version = '7.0NG.773.3';
|
||||
$build = '230904';
|
||||
$build = '230906';
|
||||
$banner = "v$version Build $build";
|
||||
error_reporting(0);
|
||||
|
||||
|
|
|
@ -32,6 +32,55 @@ use PandoraFMS\Enterprise\Metaconsole\Node;
|
|||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
require_once $config['homedir'].'/include/functions_inventory.php';
|
||||
|
||||
// Get different date to search the report.
|
||||
$utimestamp = (int) get_parameter('date_end', 0);
|
||||
$datetime_end = strtotime($utimestamp.' '.$time_end);
|
||||
|
||||
// Calculate new inteval for all reports.
|
||||
$custom_date = get_parameter('custom_date', 0);
|
||||
$date = get_parameter('date', SECONDS_1DAY);
|
||||
$date_text = get_parameter('date_text', SECONDS_1DAY);
|
||||
$date_init_less = (strtotime(date('Y-m-j')) - SECONDS_1DAY);
|
||||
$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
|
||||
$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
|
||||
if ($custom_date === '1') {
|
||||
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');
|
||||
$utimestamp = date('Y/m/d H:i:s');
|
||||
$date_start = date('Y/m/d H:i:s', (strtotime($utimestamp) - ($date_text * $date_units)));
|
||||
$period = (strtotime($utimestamp) - 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;
|
||||
$utimestamp = $sunday;
|
||||
} else if ($date === 'this_month') {
|
||||
$utimestamp = date('Y/m/d', strtotime('last day of this month'));
|
||||
$first_of_month = date('Y/m/d', strtotime('first day of this month'));
|
||||
$period = (strtotime($utimestamp) - strtotime($first_of_month));
|
||||
} else if ($date === 'past_month') {
|
||||
$utimestamp = date('Y/m/d', strtotime('last day of previous month'));
|
||||
$first_of_month = date('Y/m/d', strtotime('first day of previous month'));
|
||||
$period = (strtotime($utimestamp) - strtotime($first_of_month));
|
||||
} else if ($date === 'past_week') {
|
||||
$utimestamp = date('Y-m-d', strtotime('sunday', strtotime('last week')));
|
||||
$first_of_week = date('Y-m-d', strtotime('monday', strtotime('last week')));
|
||||
$period = (strtotime($utimestamp) - strtotime($first_of_week));
|
||||
}
|
||||
} else {
|
||||
$utimestamp = date('Y/m/d H:i:s');
|
||||
$date_start = date('Y/m/d H:i:s', (strtotime($utimestamp) - $date));
|
||||
$period = (strtotime($utimestamp) - strtotime($date_start));
|
||||
}
|
||||
|
||||
if (is_ajax() === true) {
|
||||
$get_csv_url = (bool) get_parameter('get_csv_url');
|
||||
$get_data_basic_info = (bool) get_parameter('get_data_basic_info');
|
||||
|
@ -43,7 +92,6 @@ if (is_ajax() === true) {
|
|||
// 0 is All groups
|
||||
$inventory_search_string = (string) get_parameter('search_string');
|
||||
$export = (string) get_parameter('export');
|
||||
$utimestamp = (int) get_parameter('utimestamp', 0);
|
||||
$inventory_agent = (string) get_parameter('agent', '');
|
||||
$order_by_agent = (boolean) get_parameter('order_by_agent', 0);
|
||||
|
||||
|
@ -98,6 +146,7 @@ if (is_ajax() === true) {
|
|||
$agents_ids,
|
||||
$inventory_module,
|
||||
$utimestamp,
|
||||
$period,
|
||||
$inventory_search_string,
|
||||
$export,
|
||||
false,
|
||||
|
@ -122,12 +171,14 @@ if (is_ajax() === true) {
|
|||
$id_group = (int) get_parameter('id_group', 0);
|
||||
|
||||
$params = [
|
||||
'search' => $filter['value'],
|
||||
'start' => $start,
|
||||
'length' => $length,
|
||||
'order' => $order,
|
||||
'id_agent' => $id_agent,
|
||||
'id_group' => $id_group,
|
||||
'search' => $filter['value'],
|
||||
'start' => $start,
|
||||
'length' => $length,
|
||||
'order' => $order,
|
||||
'id_agent' => $id_agent,
|
||||
'id_group' => $id_group,
|
||||
'utimestamp' => strtotime($utimestamp),
|
||||
'period' => $period,
|
||||
];
|
||||
|
||||
$data = get_data_basic_info_sql($params);
|
||||
|
@ -677,26 +728,17 @@ $table->data[1][1] = html_print_label_input_block(
|
|||
|
||||
// Date filter. In Metaconsole has not reason for show.
|
||||
if (is_metaconsole() === false) {
|
||||
$dates = inventory_get_dates(
|
||||
$inventory_module,
|
||||
$inventory_id_agent,
|
||||
$inventory_id_group
|
||||
);
|
||||
$table->data[1][2] = html_print_label_input_block(
|
||||
__('Date'),
|
||||
html_print_select(
|
||||
$dates,
|
||||
$table->data[1][2] .= html_print_label_input_block(
|
||||
__('Date').':<br>',
|
||||
html_print_select_date_range(
|
||||
'utimestamp',
|
||||
$utimestamp,
|
||||
'',
|
||||
__('Last'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
get_parameter('utimestamp', SECONDS_1DAY),
|
||||
$date_init,
|
||||
$time_init,
|
||||
date('Y/m/d'),
|
||||
date('H:i:s'),
|
||||
$date_text
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -1303,6 +1345,9 @@ if ($inventory_module !== 'basic') {
|
|||
ui_require_jquery_file('pandora.controls');
|
||||
ui_require_jquery_file('ajaxqueue');
|
||||
ui_require_jquery_file('bgiframe');
|
||||
/*
|
||||
ui_include_time_picker();
|
||||
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');*/
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -1341,6 +1386,51 @@ ui_require_jquery_file('bgiframe');
|
|||
div.firstChild.src = src;
|
||||
});
|
||||
});
|
||||
/*
|
||||
$("#text-date").datepicker({
|
||||
dateFormat: "<?php echo DATE_FORMAT_JS; ?>",
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
showAnim: "slideDown"
|
||||
});
|
||||
|
||||
$('[id^=text-time_init]').timepicker({
|
||||
showSecond: true,
|
||||
timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
|
||||
timeOnlyTitle: '<?php echo __('Choose time'); ?>',
|
||||
timeText: '<?php echo __('Time'); ?>',
|
||||
hourText: '<?php echo __('Hour'); ?>',
|
||||
minuteText: '<?php echo __('Minute'); ?>',
|
||||
secondText: '<?php echo __('Second'); ?>',
|
||||
currentText: '<?php echo __('Now'); ?>',
|
||||
closeText: '<?php echo __('Close'); ?>'
|
||||
});
|
||||
|
||||
$('[id^=text-date_init]').datepicker ({
|
||||
dateFormat: "<?php echo DATE_FORMAT_JS; ?>",
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
showAnim: "slideDown"
|
||||
});
|
||||
|
||||
$('[id^=text-date_end]').datepicker ({
|
||||
dateFormat: "<?php echo DATE_FORMAT_JS; ?>",
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
showAnim: "slideDown"
|
||||
});
|
||||
|
||||
$('[id^=text-time_end]').timepicker({
|
||||
showSecond: true,
|
||||
timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
|
||||
timeOnlyTitle: '<?php echo __('Choose time'); ?>',
|
||||
timeText: '<?php echo __('Time'); ?>',
|
||||
hourText: '<?php echo __('Hour'); ?>',
|
||||
minuteText: '<?php echo __('Minute'); ?>',
|
||||
secondText: '<?php echo __('Second'); ?>',
|
||||
currentText: '<?php echo __('Now'); ?>',
|
||||
closeText: '<?php echo __('Close'); ?>'
|
||||
});*/
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -109,20 +109,39 @@ $interval_length = get_parameter('interval_length', NETFLOW_RES_MEDD);
|
|||
$address_resolution = (int) get_parameter('address_resolution', ($config['netflow_get_ip_hostname'] ?? ''));
|
||||
$filter_selected = (int) get_parameter('filter_selected', 0);
|
||||
|
||||
// Read time values.
|
||||
$date = get_parameter_post('date', date(DATE_FORMAT, get_system_time()));
|
||||
$time = get_parameter_post('time', date(TIME_FORMAT, get_system_time()));
|
||||
$end_date = strtotime($date.' '.$time);
|
||||
$is_period = (bool) get_parameter('is_period', false);
|
||||
$period = (int) get_parameter('period', SECONDS_1DAY);
|
||||
$time_lower = get_parameter('time_lower', date(TIME_FORMAT, ($end_date - $period)));
|
||||
$date_lower = get_parameter('date_lower', date(DATE_FORMAT, ($end_date - $period)));
|
||||
$start_date = ($is_period) ? ($end_date - $period) : strtotime($date_lower.' '.$time_lower);
|
||||
if (!$is_period) {
|
||||
$period = ($end_date - $start_date);
|
||||
// Calculate range dates.
|
||||
$custom_date = get_parameter('custom_date', '0');
|
||||
$date = get_parameter('date', SECONDS_1DAY);
|
||||
if ($custom_date === '1') {
|
||||
$date_init = get_parameter('date_init');
|
||||
$time_init = get_parameter('time_init');
|
||||
$date_end = get_parameter('date_end');
|
||||
$time_end = get_parameter('time_end');
|
||||
$date_from = strtotime($date_init.' '.$time_init);
|
||||
$date_to = strtotime($date_end.' '.$time_end);
|
||||
} else if ($custom_date === '2') {
|
||||
$date_text = get_parameter('date_text');
|
||||
$date_units = get_parameter('date_units');
|
||||
$period = ($date_text * $date_units);
|
||||
$date_to = strtotime(date('Y-m-d H:i:s'));
|
||||
$date_from = (strtotime($date_to) - $period);
|
||||
} else if (in_array($date, ['this_week', 'this_month', 'past_week', 'past_month'])) {
|
||||
if ($date === 'this_week') {
|
||||
$date_from = strtotime('last monday');
|
||||
$date_to = strtotime($date_from.' +6 days');
|
||||
} else if ($date === 'this_month') {
|
||||
$date_from = strtotime('first day of this month');
|
||||
$date_to = strtotime('last day of this month');
|
||||
} else if ($date === 'past_month') {
|
||||
$date_from = strtotime('first day of previous month');
|
||||
$date_to = strtotime('last day of previous month');
|
||||
} else if ($date === 'past_week') {
|
||||
$date_from = strtotime('monday', strtotime('last week'));
|
||||
$date_to = strtotime('sunday', strtotime('last week'));
|
||||
}
|
||||
} else {
|
||||
$time_lower = date(TIME_FORMAT, $start_date);
|
||||
$date_lower = date(DATE_FORMAT, $start_date);
|
||||
$date_to = strtotime(date('Y-m-d H:i:s'));
|
||||
$date_from = ($date_to - $date);
|
||||
}
|
||||
|
||||
// Read buttons.
|
||||
|
@ -459,82 +478,11 @@ if (empty($nodeListInput) === false) {
|
|||
}
|
||||
|
||||
$filterTable->data[0][0] = html_print_label_input_block(
|
||||
__('Interval'),
|
||||
html_print_extended_select_for_time(
|
||||
'period',
|
||||
$period,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
true
|
||||
),
|
||||
[ 'div_id' => 'period_container' ]
|
||||
);
|
||||
|
||||
$filterTable->data[0][0] .= html_print_label_input_block(
|
||||
__('Start date'),
|
||||
html_print_div(
|
||||
[
|
||||
'class' => '',
|
||||
'content' => html_print_input_text(
|
||||
'date_lower',
|
||||
$date_lower,
|
||||
false,
|
||||
13,
|
||||
10,
|
||||
true
|
||||
).html_print_image(
|
||||
'images/calendar_view_day.png',
|
||||
true,
|
||||
[
|
||||
'alt' => 'calendar',
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
).html_print_input_text(
|
||||
'time_lower',
|
||||
$time_lower,
|
||||
false,
|
||||
10,
|
||||
8,
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
),
|
||||
[ 'div_id' => 'end_date_container' ]
|
||||
__('Date'),
|
||||
html_print_select_date_range('date', true)
|
||||
);
|
||||
|
||||
$filterTable->data[0][1] = html_print_label_input_block(
|
||||
__('End date'),
|
||||
html_print_div(
|
||||
[
|
||||
'class' => '',
|
||||
'content' => html_print_input_text(
|
||||
'date',
|
||||
$date,
|
||||
false,
|
||||
13,
|
||||
10,
|
||||
true
|
||||
).html_print_image(
|
||||
'images/calendar_view_day.png',
|
||||
true,
|
||||
['alt' => 'calendar']
|
||||
).html_print_input_text(
|
||||
'time',
|
||||
$time,
|
||||
false,
|
||||
10,
|
||||
8,
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$filterTable->data[0][2] = html_print_label_input_block(
|
||||
__('Resolution'),
|
||||
html_print_select(
|
||||
netflow_resolution_select_params(),
|
||||
|
@ -552,15 +500,37 @@ $filterTable->data[0][2] = html_print_label_input_block(
|
|||
)
|
||||
);
|
||||
|
||||
$filterTable->data[1][] = html_print_label_input_block(
|
||||
__('Defined period'),
|
||||
html_print_checkbox_switch(
|
||||
'is_period',
|
||||
1,
|
||||
($is_period === true) ? 1 : 0,
|
||||
true,
|
||||
false,
|
||||
'nf_view_click_period(event)'
|
||||
$filterTable->data[0][2] = html_print_label_input_block(
|
||||
__('Max values'),
|
||||
html_print_div(
|
||||
[
|
||||
'class' => '',
|
||||
'content' => html_print_select(
|
||||
$max_values,
|
||||
'max_aggregates',
|
||||
$max_aggregates,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
).html_print_anchor(
|
||||
[
|
||||
'id' => 'max_values',
|
||||
'href' => '#',
|
||||
'onClick' => 'edit_max_value()',
|
||||
'content' => html_print_image(
|
||||
'images/edit.svg',
|
||||
true,
|
||||
[
|
||||
'id' => 'pencil',
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
),
|
||||
],
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -594,39 +564,7 @@ $filterTable->data[1][] = html_print_label_input_block(
|
|||
)
|
||||
);
|
||||
|
||||
$filterTable->data[2][] = html_print_label_input_block(
|
||||
__('Max values'),
|
||||
html_print_div(
|
||||
[
|
||||
'class' => '',
|
||||
'content' => html_print_select(
|
||||
$max_values,
|
||||
'max_aggregates',
|
||||
$max_aggregates,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
).html_print_anchor(
|
||||
[
|
||||
'id' => 'max_values',
|
||||
'href' => '#',
|
||||
'onClick' => 'edit_max_value()',
|
||||
'content' => html_print_image(
|
||||
'images/edit.svg',
|
||||
true,
|
||||
[
|
||||
'id' => 'pencil',
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
),
|
||||
],
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$filterTable->colspan[3][0] = 3;
|
||||
$filterTable->data[3][0] = html_print_label_input_block(
|
||||
|
@ -696,15 +634,15 @@ if (empty($draw) === false) {
|
|||
$config['style']
|
||||
);
|
||||
|
||||
$netflowContainerClass = ($chart_type === 'netflow_data' || $chart_type === 'netflow_summary' || $chart_type === 'netflow_top_N') ? '' : 'white_box';
|
||||
$netflowContainerClass = ($chart_type === 'netflow_data' || $chart_type === 'netflow_summary' || $chart_type === 'netflow_top_N') ? '' : 'white_box relative';
|
||||
|
||||
// Draw the netflow chart.
|
||||
html_print_div(
|
||||
[
|
||||
'class' => $netflowContainerClass,
|
||||
'content' => netflow_draw_item(
|
||||
$start_date,
|
||||
$end_date,
|
||||
$date_from,
|
||||
$date_to,
|
||||
$interval_length,
|
||||
$chart_type,
|
||||
$filter,
|
||||
|
|
|
@ -57,20 +57,48 @@ if (is_ajax() === true) {
|
|||
// Include JS timepicker.
|
||||
ui_include_time_picker();
|
||||
|
||||
// Query params and other initializations.
|
||||
$filter_id = (int) get_parameter('filter_id', 0);
|
||||
$time_greater = get_parameter('time_greater', date(TIME_FORMAT));
|
||||
$date_greater = get_parameter('date_greater', date(DATE_FORMAT));
|
||||
$utimestamp_greater = strtotime($date_greater.' '.$time_greater);
|
||||
$is_period = (bool) get_parameter('is_period', false);
|
||||
$period = (int) get_parameter('period', SECONDS_1HOUR);
|
||||
$time_lower = get_parameter('time_lower', date(TIME_FORMAT, ($utimestamp_greater - $period)));
|
||||
$date_lower = get_parameter('date_lower', date(DATE_FORMAT, ($utimestamp_greater - $period)));
|
||||
$utimestamp_lower = ($is_period) ? ($utimestamp_greater - $period) : strtotime($date_lower.' '.$time_lower);
|
||||
if (!$is_period) {
|
||||
$period = ($utimestamp_greater - $utimestamp_lower);
|
||||
|
||||
// Calculate range dates.
|
||||
$custom_date = get_parameter('custom_date', '0');
|
||||
$date = get_parameter('date', SECONDS_1DAY);
|
||||
if ($custom_date === '1') {
|
||||
$date_init = get_parameter('date_init');
|
||||
$time_init = get_parameter('time_init');
|
||||
$date_end = get_parameter('date_end');
|
||||
$time_end = get_parameter('time_end');
|
||||
$date_from = strtotime($date_init.' '.$time_init);
|
||||
$date_to = strtotime($date_end.' '.$time_end);
|
||||
} else if ($custom_date === '2') {
|
||||
$date_text = get_parameter('date_text');
|
||||
$date_units = get_parameter('date_units');
|
||||
$period = ($date_text * $date_units);
|
||||
$date_to = strtotime(date('Y-m-d H:i:s'));
|
||||
$date_from = (strtotime($date_to) - $period);
|
||||
} else if (in_array($date, ['this_week', 'this_month', 'past_week', 'past_month'])) {
|
||||
if ($date === 'this_week') {
|
||||
$date_from = strtotime('last monday');
|
||||
$date_to = strtotime($date_from.' +6 days');
|
||||
} else if ($date === 'this_month') {
|
||||
$date_from = strtotime('first day of this month');
|
||||
$date_to = strtotime('last day of this month');
|
||||
} else if ($date === 'past_month') {
|
||||
$date_from = strtotime('first day of previous month');
|
||||
$date_to = strtotime('last day of previous month');
|
||||
} else if ($date === 'past_week') {
|
||||
$date_from = strtotime('monday', strtotime('last week'));
|
||||
$date_to = strtotime('sunday', strtotime('last week'));
|
||||
}
|
||||
} else {
|
||||
$date_to = strtotime(date('Y-m-d H:i:s'));
|
||||
$date_from = ($date_to - $date);
|
||||
}
|
||||
|
||||
$filter_id = (int) get_parameter('filter_id', 0);
|
||||
|
||||
// Query params and other initializations.
|
||||
$utimestamp_greater = $date_to;
|
||||
$utimestamp_lower = $date_from;
|
||||
|
||||
$top = (int) get_parameter('top', 10);
|
||||
$main_value = ((bool) get_parameter('remove_filter', 0)) ? '' : get_parameter('main_value', '');
|
||||
if (is_numeric($main_value) && !in_array($action, ['udp', 'tcp'])) {
|
||||
|
@ -89,44 +117,6 @@ if (!in_array($order_by, ['bytes', 'pkts', 'flows'])) {
|
|||
$order_by = 'bytes';
|
||||
}
|
||||
|
||||
$save = get_parameter('save_button', '');
|
||||
$update = get_parameter('update_button', '');
|
||||
|
||||
// Save user defined filter.
|
||||
if ($save != '' && check_acl($config['id_user'], 0, 'AW')) {
|
||||
// Save filter args.
|
||||
$data['filter_name'] = get_parameter('filter_name');
|
||||
$data['top'] = $top;
|
||||
$data['action'] = $action;
|
||||
$data['advanced_filter'] = $advanced_filter;
|
||||
|
||||
|
||||
$filter_id = db_process_sql_insert('tnetwork_explorer_filter', $data);
|
||||
if ($filter_id === false) {
|
||||
$filter_id = 0;
|
||||
ui_print_error_message(__('Error creating filter'));
|
||||
} else {
|
||||
ui_print_success_message(__('Filter created successfully'));
|
||||
}
|
||||
} else if ($update != '' && check_acl($config['id_user'], 0, 'AW')) {
|
||||
// Update current filter.
|
||||
// Do not update the filter name and group.
|
||||
$data['top'] = $top;
|
||||
$data['action'] = $action;
|
||||
$data['advanced_filter'] = $advanced_filter;
|
||||
|
||||
$result = db_process_sql_update(
|
||||
'tnetwork_explorer_filter',
|
||||
$data,
|
||||
['id' => $filter_id]
|
||||
);
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Filter updated successfully'),
|
||||
__('Error updating filter')
|
||||
);
|
||||
}
|
||||
|
||||
// Build the table.
|
||||
$filterTable = new stdClass();
|
||||
$filterTable->id = '';
|
||||
|
@ -136,95 +126,7 @@ $filterTable->size[0] = '33%';
|
|||
$filterTable->size[1] = '33%';
|
||||
$filterTable->size[2] = '33%';
|
||||
$filterTable->data = [];
|
||||
|
||||
$filterTable->data[0][0] = html_print_label_input_block(
|
||||
__('Interval'),
|
||||
html_print_extended_select_for_time(
|
||||
'period',
|
||||
$period,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
true
|
||||
),
|
||||
[ 'div_id' => 'period_container' ]
|
||||
);
|
||||
|
||||
$filterTable->data[0][0] .= html_print_label_input_block(
|
||||
__('Start date'),
|
||||
html_print_div(
|
||||
[
|
||||
'class' => '',
|
||||
'content' => html_print_input_text(
|
||||
'date_lower',
|
||||
$date_lower,
|
||||
false,
|
||||
13,
|
||||
10,
|
||||
true
|
||||
).html_print_image(
|
||||
'images/calendar_view_day.png',
|
||||
true,
|
||||
[
|
||||
'alt' => 'calendar',
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
).html_print_input_text(
|
||||
'time_lower',
|
||||
$time_lower,
|
||||
false,
|
||||
10,
|
||||
8,
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
),
|
||||
[ 'div_id' => 'end_date_container' ]
|
||||
);
|
||||
|
||||
$filterTable->data[0][1] = html_print_label_input_block(
|
||||
__('End date'),
|
||||
html_print_div(
|
||||
[
|
||||
'content' => html_print_input_text(
|
||||
'date',
|
||||
$date_greater,
|
||||
false,
|
||||
13,
|
||||
10,
|
||||
true
|
||||
).html_print_image(
|
||||
'images/calendar_view_day.png',
|
||||
true,
|
||||
['alt' => 'calendar']
|
||||
).html_print_input_text(
|
||||
'time',
|
||||
$time_greater,
|
||||
false,
|
||||
10,
|
||||
8,
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$filterTable->data[0][2] = html_print_label_input_block(
|
||||
__('Defined period'),
|
||||
html_print_checkbox_switch(
|
||||
'is_period',
|
||||
1,
|
||||
($is_period === true) ? 1 : 0,
|
||||
true,
|
||||
false,
|
||||
'nf_view_click_period()'
|
||||
)
|
||||
);
|
||||
|
||||
$filterTable->data[1][] = html_print_label_input_block(
|
||||
__('Results to show'),
|
||||
html_print_select(
|
||||
[
|
||||
|
@ -246,56 +148,9 @@ $filterTable->data[1][] = html_print_label_input_block(
|
|||
)
|
||||
);
|
||||
|
||||
$filterTable->data[1][] = html_print_label_input_block(
|
||||
__('Data to show'),
|
||||
html_print_select(
|
||||
network_get_report_actions(),
|
||||
'action',
|
||||
$action,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$advanced_toggle = new stdClass();
|
||||
$advanced_toggle->class = 'filter-table-adv';
|
||||
$advanced_toggle->size = [];
|
||||
$advanced_toggle->size[0] = '50%';
|
||||
$advanced_toggle->size[1] = '50%';
|
||||
$advanced_toggle->width = '100%';
|
||||
$user_groups = users_get_groups($config['id_user'], 'AR', $own_info['is_admin'], true);
|
||||
$user_groups[0] = 0;
|
||||
// Add all groups.
|
||||
$sql = 'SELECT * FROM tnetwork_explorer_filter';
|
||||
$advanced_toggle->data[0][0] = html_print_label_input_block(
|
||||
__('Load Filter'),
|
||||
html_print_select_from_sql($sql, 'filter_id', $filter_id, '', __('Select a filter'), 0, true, false, true, false, 'width:100%;')
|
||||
);
|
||||
$advanced_toggle->data[0][1] = html_print_label_input_block(
|
||||
__('Filter name'),
|
||||
html_print_input_text('filter_name', '', false, 40, 45, true, false, false, '', 'w100p')
|
||||
);
|
||||
$advanced_toggle->colspan[1][0] = 2;
|
||||
$advanced_toggle->data[1][0] = html_print_label_input_block(
|
||||
__('Filter').ui_print_help_icon('pcap_filter', true),
|
||||
html_print_textarea('advanced_filter', 4, 10, $advanced_filter, 'style="width:100%"', true)
|
||||
);
|
||||
$filterTable->colspan[2][0] = 3;
|
||||
$filterTable->data[2][0] = html_print_label_input_block(
|
||||
'',
|
||||
ui_toggle(
|
||||
html_print_table($advanced_toggle, true),
|
||||
__('Advanced'),
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
'white-box-content',
|
||||
'box-flat white_table_graph'
|
||||
)
|
||||
$filterTable->data[0][1] = html_print_label_input_block(
|
||||
__('Start date'),
|
||||
html_print_select_date_range('date', true)
|
||||
);
|
||||
|
||||
$filterInputTable = '<form method="POST">';
|
||||
|
@ -386,8 +241,6 @@ $data = netflow_get_top_summary(
|
|||
$hidden_main_link = [
|
||||
'time_greater' => $time_greater,
|
||||
'date_greater' => $date_greater,
|
||||
'is_period' => $is_period,
|
||||
'period' => $period,
|
||||
'time_lower' => $time_lower,
|
||||
'date_lower' => $date_lower,
|
||||
'top' => $top,
|
||||
|
|
|
@ -84,19 +84,43 @@ ui_include_time_picker();
|
|||
|
||||
// Query params and other initializations.
|
||||
$action = get_parameter('action', 'talkers');
|
||||
$time_greater = get_parameter('time_greater', date(TIME_FORMAT));
|
||||
$date_greater = get_parameter('date_greater', date(DATE_FORMAT));
|
||||
$utimestamp_greater = strtotime($date_greater.' '.$time_greater);
|
||||
$is_period = (bool) get_parameter('is_period', false);
|
||||
$period = (int) get_parameter('period', SECONDS_1HOUR);
|
||||
$time_lower = get_parameter('time_lower', date(TIME_FORMAT, ($utimestamp_greater - $period)));
|
||||
$date_lower = get_parameter('date_lower', date(DATE_FORMAT, ($utimestamp_greater - $period)));
|
||||
$advanced_filter = get_parameter('advanced_filter', '');
|
||||
$utimestamp_lower = ($is_period) ? ($utimestamp_greater - $period) : strtotime($date_lower.' '.$time_lower);
|
||||
if (!$is_period) {
|
||||
$period = ($utimestamp_greater - $utimestamp_lower);
|
||||
// Calculate range dates.
|
||||
$custom_date = get_parameter('custom_date', '0');
|
||||
$date = get_parameter('date', SECONDS_1DAY);
|
||||
if ($custom_date === '1') {
|
||||
$date_init = get_parameter('date_init');
|
||||
$time_init = get_parameter('time_init');
|
||||
$date_end = get_parameter('date_end');
|
||||
$time_end = get_parameter('time_end');
|
||||
$date_from = strtotime($date_init.' '.$time_init);
|
||||
$date_to = strtotime($date_end.' '.$time_end);
|
||||
} else if ($custom_date === '2') {
|
||||
$date_text = get_parameter('date_text');
|
||||
$date_units = get_parameter('date_units');
|
||||
$period = ($date_text * $date_units);
|
||||
$date_to = strtotime(date('Y-m-d H:i:s'));
|
||||
$date_from = (strtotime($date_to) - $period);
|
||||
} else if (in_array($date, ['this_week', 'this_month', 'past_week', 'past_month'])) {
|
||||
if ($date === 'this_week') {
|
||||
$date_from = strtotime('last monday');
|
||||
$date_to = strtotime($date_from.' +6 days');
|
||||
} else if ($date === 'this_month') {
|
||||
$date_from = strtotime('first day of this month');
|
||||
$date_to = strtotime('last day of this month');
|
||||
} else if ($date === 'past_month') {
|
||||
$date_from = strtotime('first day of previous month');
|
||||
$date_to = strtotime('last day of previous month');
|
||||
} else if ($date === 'past_week') {
|
||||
$date_from = strtotime('monday', strtotime('last week'));
|
||||
$date_to = strtotime('sunday', strtotime('last week'));
|
||||
}
|
||||
} else {
|
||||
$date_to = strtotime(date('Y-m-d H:i:s'));
|
||||
$date_from = ($date_to - $date);
|
||||
}
|
||||
|
||||
$advanced_filter = get_parameter('advanced_filter', '');
|
||||
|
||||
$top = (int) get_parameter('top', 10);
|
||||
|
||||
$order_by = get_parameter('order_by', 'bytes');
|
||||
|
@ -186,93 +210,11 @@ $filterTable->size[2] = '33%';
|
|||
$filterTable->data = [];
|
||||
|
||||
$filterTable->data[0][0] = html_print_label_input_block(
|
||||
__('Interval'),
|
||||
html_print_extended_select_for_time(
|
||||
'period',
|
||||
$period,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
true
|
||||
),
|
||||
[ 'div_id' => 'period_container' ]
|
||||
);
|
||||
|
||||
$filterTable->data[0][0] .= html_print_label_input_block(
|
||||
__('Start date'),
|
||||
html_print_div(
|
||||
[
|
||||
'class' => '',
|
||||
'content' => html_print_input_text(
|
||||
'date_lower',
|
||||
$date_lower,
|
||||
false,
|
||||
13,
|
||||
10,
|
||||
true
|
||||
).html_print_image(
|
||||
'images/calendar_view_day.png',
|
||||
true,
|
||||
[
|
||||
'alt' => 'calendar',
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
).html_print_input_text(
|
||||
'time_lower',
|
||||
$time_lower,
|
||||
false,
|
||||
10,
|
||||
8,
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
),
|
||||
[ 'div_id' => 'end_date_container' ]
|
||||
__('Date'),
|
||||
html_print_select_date_range('date', true)
|
||||
);
|
||||
|
||||
$filterTable->data[0][1] = html_print_label_input_block(
|
||||
__('End date'),
|
||||
html_print_div(
|
||||
[
|
||||
'content' => html_print_input_text(
|
||||
'date',
|
||||
$date_greater,
|
||||
false,
|
||||
13,
|
||||
10,
|
||||
true
|
||||
).html_print_image(
|
||||
'images/calendar_view_day.png',
|
||||
true,
|
||||
['alt' => 'calendar']
|
||||
).html_print_input_text(
|
||||
'time',
|
||||
$time_greater,
|
||||
false,
|
||||
10,
|
||||
8,
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$filterTable->data[0][2] = html_print_label_input_block(
|
||||
__('Defined period'),
|
||||
html_print_checkbox_switch(
|
||||
'is_period',
|
||||
1,
|
||||
($is_period === true) ? 1 : 0,
|
||||
true,
|
||||
false,
|
||||
'nf_view_click_period()'
|
||||
)
|
||||
);
|
||||
|
||||
$filterTable->data[1][] = html_print_label_input_block(
|
||||
__('Results to show'),
|
||||
html_print_select(
|
||||
[
|
||||
|
@ -294,7 +236,7 @@ $filterTable->data[1][] = html_print_label_input_block(
|
|||
)
|
||||
);
|
||||
|
||||
$filterTable->data[1][] = html_print_label_input_block(
|
||||
$filterTable->data[0][2] = html_print_label_input_block(
|
||||
__('Data to show'),
|
||||
html_print_select(
|
||||
network_get_report_actions(),
|
||||
|
@ -373,8 +315,8 @@ $has_data = false;
|
|||
|
||||
if ((bool) get_parameter('update_netflow') === true) {
|
||||
$map_data = netflow_build_map_data(
|
||||
$utimestamp_lower,
|
||||
$utimestamp_greater,
|
||||
$date_from,
|
||||
$date_to,
|
||||
$top,
|
||||
($action === 'talkers') ? 'srcip' : 'dstip',
|
||||
$advanced_filter
|
||||
|
|
|
@ -114,16 +114,53 @@ if ($view_graph) {
|
|||
}
|
||||
}
|
||||
|
||||
// Get different date to search the report.
|
||||
$date = (string) get_parameter('date', date(DATE_FORMAT));
|
||||
$time = (string) get_parameter('time', date(TIME_FORMAT));
|
||||
$unixdate = strtotime($date.' '.$time);
|
||||
// Calculate range dates.
|
||||
$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') {
|
||||
$date_init_less = (strtotime(date('Y-m-j')) - SECONDS_1DAY);
|
||||
$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
|
||||
$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
|
||||
$datetime_init = strtotime($date_init.' '.$time_init);
|
||||
$date_end = (string) get_parameter('date_end', date(DATE_FORMAT));
|
||||
$time_end = (string) get_parameter('time_end', date(TIME_FORMAT));
|
||||
$datetime_end = strtotime($date_end.' '.$time_end);
|
||||
|
||||
$period = (int) get_parameter('period');
|
||||
if (! $period) {
|
||||
$period = $graph['period'];
|
||||
if ($datetime_init >= $datetime_end) {
|
||||
$datetime_init = $date_init_less;
|
||||
}
|
||||
|
||||
$unixdate = $datetime_end;
|
||||
$period = ($unixdate - $datetime_init);
|
||||
} else if ($custom_date === '2') {
|
||||
$unixdate = strtotime('now');
|
||||
$date_units = get_parameter('date_units');
|
||||
$date_start = date('Y/m/d H:i:s', ($unixdate - ($date_text * $date_units)));
|
||||
$period = ($unixdate - 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 00:00:00', strtotime('Monday this week'));
|
||||
$sunday = date('Y/m/d 23:59:59', strtotime($monday.' +6 days'));
|
||||
$period = (strtotime($sunday) - strtotime($monday));
|
||||
$unixdate = strtotime($sunday);
|
||||
} else if ($date === 'this_month') {
|
||||
$unixdate = strtotime('last day of this month');
|
||||
$first_of_month = date('Y/m/d', strtotime('first day of this month'));
|
||||
$period = ($unixdate - strtotime($first_of_month));
|
||||
} else if ($date === 'past_month') {
|
||||
$unixdate = strtotime('last day of previous month');
|
||||
$first_of_month = date('Y/m/d', strtotime('first day of previous month'));
|
||||
$period = ($unixdate - strtotime($first_of_month));
|
||||
} else if ($date === 'past_week') {
|
||||
$unixdate = strtotime('sunday', strtotime('last week'));
|
||||
$first_of_week = date('Y-m-d', strtotime('monday', strtotime('last week')));
|
||||
$period = ($unixdate - strtotime($first_of_week));
|
||||
}
|
||||
} else {
|
||||
$period = $period;
|
||||
$unixdate = strtotime('now');
|
||||
$date_start = date('Y/m/d H:i:s', ($unixdate - $date));
|
||||
$period = ($unixdate - strtotime($date_start));
|
||||
}
|
||||
|
||||
$events = $graph['events'];
|
||||
|
@ -315,9 +352,9 @@ if ($view_graph) {
|
|||
$searchForm = '<form method="POST" action="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$id_graph.'">';
|
||||
$searchForm .= "<table class='filter-table-adv w100p' cellpadding='4' cellspacing='4'>";
|
||||
$searchForm .= '<tr>';
|
||||
|
||||
$searchForm .= '<td class="w30p">';
|
||||
$searchForm .= html_print_label_input_block(
|
||||
/*
|
||||
$searchForm .= '<td class="w30p">';
|
||||
$searchForm .= html_print_label_input_block(
|
||||
__('Date'),
|
||||
html_print_input_text(
|
||||
'date',
|
||||
|
@ -327,9 +364,9 @@ if ($view_graph) {
|
|||
10,
|
||||
true
|
||||
)
|
||||
);
|
||||
$searchForm .= '</td><td class="datos w30p">';
|
||||
$searchForm .= html_print_label_input_block(
|
||||
);
|
||||
$searchForm .= '</td><td class="datos w30p">';
|
||||
$searchForm .= html_print_label_input_block(
|
||||
__('Time'),
|
||||
html_print_input_text(
|
||||
'time',
|
||||
|
@ -339,33 +376,16 @@ if ($view_graph) {
|
|||
7,
|
||||
true
|
||||
)
|
||||
);
|
||||
$searchForm .= '</td>';
|
||||
$searchForm .= "<td class='datos w30p'>";
|
||||
$searchForm .= html_print_label_input_block(
|
||||
);
|
||||
$searchForm .= '</td>';
|
||||
$searchForm .= "<td class='datos w30p'>";
|
||||
$searchForm .= html_print_label_input_block(
|
||||
__('Time range'),
|
||||
html_print_extended_select_for_time(
|
||||
'period',
|
||||
(string) $period,
|
||||
'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.').'\')',
|
||||
'',
|
||||
0,
|
||||
10,
|
||||
true,
|
||||
'width:100%',
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'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.').'\')'
|
||||
)
|
||||
);
|
||||
$searchForm .= '</td>';
|
||||
$searchForm .= '</tr><tr>';
|
||||
html_print_extended_select_for_time('period', (string) $period, '', '', 0, 10, true, 'width:100%')
|
||||
);
|
||||
$searchForm .= '</td>';*/
|
||||
|
||||
$searchForm .= '<td class="w25p">'.html_print_label_input_block(__('Date'), html_print_select_date_range('date', true)).'</td>';
|
||||
$searchForm .= "<td class='datos w30p'>";
|
||||
$stackeds = [];
|
||||
$stackeds[0] = __('Graph defined');
|
||||
|
@ -559,14 +579,6 @@ if ($view_graph) {
|
|||
</script>
|
||||
|
||||
<?php
|
||||
$datetime = strtotime($date.' '.$time);
|
||||
$report['datetime'] = $datetime;
|
||||
|
||||
if ($datetime === false || $datetime == -1) {
|
||||
ui_print_error_message(__('Invalid date selected'));
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,28 +43,59 @@ if (!reporting_user_can_see_report($id_report)) {
|
|||
exit;
|
||||
}
|
||||
|
||||
// Get different date to search the report.
|
||||
$date = (string) get_parameter('date', date(DATE_FORMAT));
|
||||
$time = (string) get_parameter('time', date(TIME_FORMAT));
|
||||
|
||||
$datetime = strtotime($date.' '.$time);
|
||||
|
||||
// Calculations in order to modify init date of the report
|
||||
// Calculations in order to modify init date of the report.
|
||||
$date_init_less = (strtotime(date('Y-m-j')) - SECONDS_1DAY);
|
||||
$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
|
||||
$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
|
||||
$datetime_init = strtotime($date_init.' '.$time_init);
|
||||
$enable_init_date = get_parameter('enable_init_date', 0);
|
||||
$pure = (int) get_parameter('pure', 0);
|
||||
|
||||
$period = null;
|
||||
// Calculate new inteval for all reports
|
||||
if ($enable_init_date) {
|
||||
if ($datetime_init >= $datetime) {
|
||||
// Get different date to search the report.
|
||||
$date_end = (string) get_parameter('date_end', date(DATE_FORMAT));
|
||||
$time_end = (string) get_parameter('time_end', date(TIME_FORMAT));
|
||||
$datetime_end = strtotime($date_end.' '.$time_end);
|
||||
|
||||
// Calculate new inteval for all reports.
|
||||
$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 - $datetime_init);
|
||||
$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');
|
||||
$date_start = date('Y/m/d H:i:s', (strtotime($date_end) - ($date_text * $date_units)));
|
||||
$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;
|
||||
} else if ($date === 'this_month') {
|
||||
$date_end = date('Y/m/d', strtotime('last day of this month'));
|
||||
$first_of_month = date('Y/m/d', strtotime('first day of this month'));
|
||||
$period = (strtotime($date_end) - strtotime($first_of_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'));
|
||||
$period = (strtotime($date_end) - strtotime($first_of_month));
|
||||
} else if ($date === 'past_week') {
|
||||
$date_end = date('Y-m-d', strtotime('sunday', strtotime('last week')));
|
||||
$first_of_week = date('Y-m-d', strtotime('monday', strtotime('last week')));
|
||||
$period = (strtotime($date_end) - strtotime($first_of_week));
|
||||
}
|
||||
} else {
|
||||
$date_end = date('Y/m/d H:i:s');
|
||||
$date_start = date('Y/m/d H:i:s', (strtotime($date_end) - $date));
|
||||
$period = (strtotime($date_end) - strtotime($date_start));
|
||||
}
|
||||
|
||||
// Shchedule report email.
|
||||
|
@ -242,7 +273,7 @@ $table2->styleTable = 'border:none';
|
|||
|
||||
if (defined('METACONSOLE')) {
|
||||
$table2->width = '100%';
|
||||
$table2->class = 'databox filters';
|
||||
$table2->class = 'databox filters filter-table-adv';
|
||||
|
||||
$table2->head[0] = __('View Report');
|
||||
$table2->head_colspan[0] = 5;
|
||||
|
@ -264,14 +295,10 @@ if ($html_menu_export === ENTERPRISE_NOT_HOOK) {
|
|||
}
|
||||
|
||||
|
||||
$table2->data[0][2] = '<div><span class="font-title-font">'.__('Set initial date').'</span><br>'.html_print_checkbox_switch('enable_init_date', 1, $enable_init_date, true).'</div><br>';
|
||||
$table2->data[0][2] .= '<div style="display:'.$display_to.'" id="string_from"><div><span class="font-title-font">'.__('From').':</span></div>';
|
||||
$table2->data[0][2] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' ';
|
||||
$table2->data[0][2] .= html_print_input_text('time_init', $time_init, '', 10, 7, true).' ';
|
||||
$table2->data[0][2] .= '</div><div style="display:'.$display_item.'" id="string_items"><span class="font-title-font">'.__('Items period before').':</span></div>';
|
||||
$table2->data[0][2] .= '<div style="display:'.$display_to.'" id="string_to"><span class="font-title-font">'.__('to').':</span></div>';
|
||||
$table2->data[0][2] .= html_print_input_text('date', $date, '', 12, 10, true).' ';
|
||||
$table2->data[0][2] .= html_print_input_text('time', $time, '', 10, 7, true).' ';
|
||||
$table2->data[0][2] = html_print_label_input_block(
|
||||
__('Date').':<br>',
|
||||
html_print_select_date_range('date', true, get_parameter('date', SECONDS_1DAY), $date_init, $time_init, date('Y/m/d'), date('H:i:s'), $date_text)
|
||||
);
|
||||
$table2->data[0][3] = $html_menu_export;
|
||||
|
||||
|
||||
|
@ -313,7 +340,7 @@ ui_toggle(
|
|||
);
|
||||
// ------------------------ END FORM ------------------------------------
|
||||
if ($enable_init_date) {
|
||||
if ($datetime_init > $datetime) {
|
||||
if ($datetime_init > $datetime_end) {
|
||||
ui_print_error_message(
|
||||
__('Invalid date selected. Initial date must be before end date.')
|
||||
);
|
||||
|
@ -323,7 +350,7 @@ if ($enable_init_date) {
|
|||
$report = reporting_make_reporting_data(
|
||||
null,
|
||||
$id_report,
|
||||
$date,
|
||||
$date_end,
|
||||
$time,
|
||||
$period,
|
||||
'dinamic'
|
||||
|
@ -367,28 +394,6 @@ $(document).ready (function () {
|
|||
|
||||
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
|
||||
|
||||
$("#text-date").datepicker({
|
||||
dateFormat: "<?php echo DATE_FORMAT_JS; ?>",
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
showAnim: "slideDown"});
|
||||
|
||||
$('[id^=text-time_init]').timepicker({
|
||||
showSecond: true,
|
||||
timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
|
||||
timeOnlyTitle: '<?php echo __('Choose time'); ?>',
|
||||
timeText: '<?php echo __('Time'); ?>',
|
||||
hourText: '<?php echo __('Hour'); ?>',
|
||||
minuteText: '<?php echo __('Minute'); ?>',
|
||||
secondText: '<?php echo __('Second'); ?>',
|
||||
currentText: '<?php echo __('Now'); ?>',
|
||||
closeText: '<?php echo __('Close'); ?>'});
|
||||
|
||||
$('[id^=text-date_init]').datepicker ({
|
||||
dateFormat: "<?php echo DATE_FORMAT_JS; ?>",
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
showAnim: "slideDown"});
|
||||
|
||||
/* Show/hide begin date reports controls */
|
||||
$("#checkbox-enable_init_date").click(function() {
|
||||
|
@ -408,8 +413,4 @@ $(document).ready (function () {
|
|||
</script>
|
||||
|
||||
<?php
|
||||
if ($datetime === false || $datetime == -1) {
|
||||
ui_print_error_message(__('Invalid date selected'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230904
|
||||
%define release 230906
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230904
|
||||
%define release 230906
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230904
|
||||
%define release 230906
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -1209,6 +1209,7 @@ CREATE TABLE IF NOT EXISTS `ttrap` (
|
|||
`text` VARCHAR(255) DEFAULT '',
|
||||
`description` VARCHAR(255) DEFAULT '',
|
||||
`severity` TINYINT UNSIGNED NOT NULL DEFAULT 2,
|
||||
`utimestamp` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id_trap`),
|
||||
INDEX timestamp (`timestamp`),
|
||||
INDEX status (`status`),
|
||||
|
@ -4228,10 +4229,17 @@ CREATE TABLE IF NOT EXISTS `tsesion_filter` (
|
|||
`id_filter` INT NOT NULL AUTO_INCREMENT,
|
||||
`id_name` TEXT NULL,
|
||||
`text` TEXT NULL,
|
||||
`period` TEXT NULL,
|
||||
`ip` TEXT NULL,
|
||||
`type` TEXT NULL,
|
||||
`user` TEXT NULL,
|
||||
`custom_date` INT NULL,
|
||||
`date` VARCHAR(45) NULL,
|
||||
`date_text` VARCHAR(45) NULL,
|
||||
`date_units` VARCHAR(45) NULL,
|
||||
`date_init` VARCHAR(45) NULL,
|
||||
`time_init` VARCHAR(45) NULL,
|
||||
`date_end` VARCHAR(45) NULL,
|
||||
`time_end` VARCHAR(45) NULL,
|
||||
PRIMARY KEY (`id_filter`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
|
@ -4283,14 +4291,14 @@ CREATE TABLE IF NOT EXISTS `tsesion_filter_log_viewer` (
|
|||
`order` VARCHAR(45) NULL,
|
||||
`search` VARCHAR(255) NULL,
|
||||
`group_id` INT NULL,
|
||||
`date_range` TINYINT NULL,
|
||||
`start_date_defined` VARCHAR(45) NULL,
|
||||
`start_date_time` VARCHAR(45) NULL,
|
||||
`start_date_date` VARCHAR(45) NULL,
|
||||
`start_date_date_range` VARCHAR(45) NULL,
|
||||
`start_date_time_range` VARCHAR(45) NULL,
|
||||
`end_date_date_range` VARCHAR(45) NULL,
|
||||
`end_date_time_range` VARCHAR(45) NULL,
|
||||
`custom_date` INT NULL,
|
||||
`date` VARCHAR(45) NULL,
|
||||
`date_text` VARCHAR(45) NULL,
|
||||
`date_units` VARCHAR(45) NULL,
|
||||
`date_init` VARCHAR(45) NULL,
|
||||
`time_init` VARCHAR(45) NULL,
|
||||
`date_end` VARCHAR(45) NULL,
|
||||
`time_end` VARCHAR(45) NULL,
|
||||
`agent` VARCHAR(255) NULL,
|
||||
`source` VARCHAR(255) NULL,
|
||||
`display_mode` INT NULL,
|
||||
|
|
|
@ -1096,7 +1096,7 @@ INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `o
|
|||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (14,'Citrix_Sessions','module_begin\r\nmodule_name Citrix_Sessions\r\nmodule_description Opened active sessions on server\r\nmodule_type generic_data\r\nmodule_exec query session | grep Active | wc -l\r\nmodule_end ','Opened active sessions on server',9,'',25,1,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (15,'Users_Connected','module_begin\r\nmodule_name Users_Connected\r\nmodule_description Users connected to this server\r\nmodule_type generic_data\r\nmodule_exec quser | grep Active | wc -l\r\nmodule_interval 2\r\nmodule_end\r\n ','Users connected to this server',9,'',25,1,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (16,'Busy XML Threads','module_begin\r\nmodule_name Busy XML Threads\r\nmodule_description Total threads in the manager who manage the sessions. If there are more than XX, service fails. NOTE: Run this module only in managers\r\nmodule_type generic_data\r\nmodule_exec Typeperf '\\MAQUINA\Citrix Metaframe Presentation Server\Number of busy XML threads' -sc 1\r\nmodule_end\r\n','Total threads in the manager who manage the sessions. If there are more than XX, service fails. NOTE: Run this module only in managers',9,'',25,1,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (17,'CPU Load','module_begin
module_name CPU Load
module_type generic_data
module_wmiquery SELECT LoadPercentage FROM Win32_Processor
module_wmicolumn LoadPercentage
module_description CPU Load (%)
module_min_warning 80
module_max_warning 90
module_min_critical 91
module_max_critical 100
module_end','CPU Load (using WMI)',9,'',11,1,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (17,'CPU Load','module_begin
module_name CPU Load
module_type generic_data
module_wmiquery SELECT LoadPercentage FROM Win32_Processor
module_wmicolumn LoadPercentage
module_description CPU Load (%)
module_min_warning 80
module_max_warning 90
module_min_critical 91
module_max_critical 0
module_end','CPU Load (using WMI)',9,'',11,1,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (18,'FreeMemory','# Free Memory
module_begin
module_name FreeMemory
module_type generic_data
module_freepercentmemory
module_description Free memory (%).
module_min_warning 21
module_max_warning 30
module_min_critical 0
module_max_critical 20
module_end','Free memory (%).',9,'',11,1,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (19,'Microsoft Antivirus','module_begin
module_name Microsoft Antivirus
module_type generic_proc
module_service MsMpSvc
module_description Check if microsoft antivirus/malware service is running
module_end','Check if microsoft antivirus/malware service is running',9,'',11,2,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (21,'Microsoft Firewall','module_begin
module_name Microsoft Firewall
module_type generic_proc
module_service MpsSvc
module_description Microsoft windows firewall status.
module_end','Microsoft windows firewall status.',9,'',11,2,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
|
@ -1115,7 +1115,7 @@ INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `o
|
|||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (34,'disk_root_free','module_begin
module_name disk_root_free
module_type generic_data
module_exec df -kh / | tail -1 | awk '{ print 100-$5 }'
module_max 100
module_min 0
module_description Free disk Percentage of root partition
module_end','Free disk Percentage of root partition',4,'',47,1,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (35,'memfree','module_begin
module_name memfree
module_type generic_data
module_exec vmstat -H 1 2 | tail -1 | awk '{print $5}'
module_description Unused RAM memory
module_end
','Free memory on system',4,'',47,1,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (36,'sshDaemon','module_begin
module_name sshDaemon
module_type generic_proc
module_exec ps -Af | grep sshd | grep -v "grep" | wc -l | sed "s/ //g"
module_end
','Check if SSH daemon is running',4,'',47,2,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (37,'cpu_user','module_begin
module_name cpu_user
module_type generic_data
module_interval 1
module_exec sar 1 2 | tail -1 | awk '{ print $2 }'
module_max 100
module_min 0
module_description User CPU Usage (%)
module_min_warning 70
module_max_warning 90
module_min_critical 91
module_max_critical 100
module_end','User CPU Usage (%)',8,'',48,1,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (37,'cpu_user','module_begin
module_name cpu_user
module_type generic_data
module_interval 1
module_exec sar 1 2 | tail -1 | awk '{ print $2 }'
module_max 100
module_min 0
module_description User CPU Usage (%)
module_min_warning 70
module_max_warning 90
module_min_critical 91
module_max_critical 0
module_end','User CPU Usage (%)',8,'',48,1,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (38,'Load Average','module_begin
module_name Load Average
module_type generic_data
module_exec uptime | sed 's/.*load averages: //'|awk '{print $1}'
module_description Average process in CPU (Last minute)
module_end
','Average process in CPU (Last minute)',8,'',48,1,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (39,'Cache mem free','module_begin
module_name Cache mem free
module_type generic_data
module_exec vm_stat | grep 'Pages free'| awk '{print $3/256}'
module_description Free cache memory in MB
module_min_warning 500
module_max_warning 600
module_min_critical 100
module_max_critical 499
module_end
','Free cache memory in MB',8,'',48,1,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tlocal_component` (`id`, `name`, `data`, `description`, `id_os`, `os_version`, `id_network_component_group`, `type`, `max`, `min`, `module_interval`, `id_module_group`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`, `ff_timeout`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `prediction_sample_window`, `prediction_samples`, `prediction_threshold`) VALUES (40,'Free disk Percentage of root partition','module_begin
module_name disk_root_free
module_type generic_data
module_exec df -kh / | tail -1 | awk '{ print 100-$5 }'
module_max 100
module_min 0
module_description Free disk Percentage of root partition
module_min_warning 70
module_max_warning 90
module_min_critical 91
module_max_critical 100
module_end','Free disk Percentage of root partition',8,'',48,1,0,0,0,0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,0.000000000000000,NULL,'basic',NULL,'','','',0,0,0,'','',0,0,0,0,0,0,0,0,0,0,0);
|
||||
|
@ -1229,7 +1229,7 @@ INSERT INTO `tpolicies` VALUES (6,'Basic Remote Checks','Basic Re
|
|||
|
||||
INSERT INTO `tpolicy_modules` VALUES (1,1,'module_begin
module_name Bytes per second (Received)
module_type generic_data_inc
module_exec powershell -c "Get-NetAdapterStatistics |Measure-Object -Sum ReceivedBytes |Select -ExpandProperty Sum"
module_end



',4,'','Bytes per second (Received)','',0,0,1,'',0,'','','','',1,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (2,1,'module_begin
module_name Bytes per second (Sent)
module_type generic_data_inc
module_exec powershell -c "Get-NetAdapterStatistics |Measure-Object -Sum SentBytes |Select -ExpandProperty Sum"
module_end




',4,'','Bytes per second (Sent)','',0,0,1,'',0,'','','','',1,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (3,1,'module_begin
module_name CPU %
module_type generic_data
module_cpuusage all
module_unit %
module_min_warning 79.00
module_end





',1,'CPU usage (%)','CPU %','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,79.00,90.00,'',91.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (3,1,'module_begin
module_name CPU %
module_type generic_data
module_cpuusage all
module_unit %
module_min_warning 79.00
module_max_warning 90.00;module_min_critical 91.00
module_max_critical 00.00;
module_end





',1,'CPU usage (%)','CPU %','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,79.00,90.00,'',91.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (4,1,'module_begin
module_name Total processes
module_type generic_data
module_exec tasklist | wc -l | gawk "{print $1}"
module_end


',1,'','Total processes','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (5,1,'module_begin
module_name Uptime
module_type generic_data
module_exec powershell -c "((get-date) - (gcim Win32_OperatingSystem).LastBootUpTime | Select -ExpandProperty Ticks) / 100000"
module_end




',1,'','Uptime','_timeticks_',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (6,1,'module_begin
module_name WMI Service
module_type generic_proc
module_service winmgmt
module_end

',2,'WMI Service enabled','WMI Service','',0,0,1,'',0,'','','','',3,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.773.3-230904
|
||||
Version: 7.0NG.773.3-230906
|
||||
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.773.3-230904"
|
||||
pandora_version="7.0NG.773.3-230906"
|
||||
|
||||
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.773.3";
|
||||
my $pandora_build = "230904";
|
||||
my $pandora_build = "230906";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -686,9 +686,9 @@ sub get_agent_status ($$$) {
|
|||
if ($modules_async < $count_modules) {
|
||||
my $last_contact = get_db_value($dbh,
|
||||
'SELECT (UNIX_TIMESTAMP(ultimo_contacto) + (intervalo * 2)) AS last_contact
|
||||
FROM tagente WHERE id_agente = ?', $agent_id);
|
||||
FROM tagente WHERE id_agente = ? AND UNIX_TIMESTAMP(ultimo_contacto) > 0', $agent_id);
|
||||
|
||||
if ($last_contact < time ()) {
|
||||
if (defined($last_contact) && $last_contact < time ()) {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 = "230904";
|
||||
my $pandora_build = "230906";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -382,8 +382,8 @@ sub pandora_snmptrapd {
|
|||
|
||||
# Insert the trap into the DB
|
||||
if (! defined(enterprise_hook ('snmp_insert_trap', [$pa_config, $source, $oid, $type, $value, $custom_oid, $custom_value, $custom_type, $timestamp, $server_id, $dbh]))) {
|
||||
my $trap_id = db_insert ($dbh, 'id_trap', 'INSERT INTO ttrap (timestamp, source, oid, type, value, oid_custom, value_custom, type_custom) VALUES (?, ?, ?, ?, ?, ?, ?, ?)',
|
||||
$timestamp, $source, $oid, $type, $value, $custom_oid, $custom_value, $custom_type);
|
||||
my $trap_id = db_insert ($dbh, 'id_trap', 'INSERT INTO ttrap (timestamp, source, oid, type, value, oid_custom, value_custom, type_custom, utimestamp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)',
|
||||
$timestamp, $source, $oid, $type, $value, $custom_oid, $custom_value, $custom_type, time());
|
||||
logger ($pa_config, "Received SNMP Trap from $source", 4);
|
||||
|
||||
# Evaluate alerts for this trap
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230904
|
||||
%define release 230906
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230904
|
||||
%define release 230906
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.773.3"
|
||||
PI_BUILD="230904"
|
||||
PI_BUILD="230906"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.773.3 Build 230904";
|
||||
my $version = "7.0NG.773.3 Build 230906";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.773.3 Build 230904";
|
||||
my $version = "7.0NG.773.3 Build 230906";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue