Merge remote-tracking branch 'origin/develop' into fix/mr

Former-commit-id: a95ef0c2110e1c0b7be3e9c6cd93543f79e0f230
This commit is contained in:
fbsanchez 2019-03-27 17:09:46 +01:00
commit 66b2102052
82 changed files with 3032 additions and 1518 deletions
pandora_agents
pandora_console
pandora_server

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732, AIX version # Version 7.0NG.733, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732, FreeBSD Version # Version 7.0NG.733, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732, HP-UX Version # Version 7.0NG.733, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732, GNU/Linux # Version 7.0NG.733, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732, GNU/Linux # Version 7.0NG.733, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732, Solaris Version # Version 7.0NG.733, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas # (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.732 # Version 7.0NG.733
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.732, AIX version # Version 7.0NG.733, AIX version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.732 # Version 7.0NG.733
# FreeBSD/IPSO version # FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena # Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.732, HPUX Version # Version 7.0NG.733, HPUX Version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732 # Version 7.0NG.733
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas # (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732 # Version 7.0NG.733
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas # (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732 # Version 7.0NG.733
# Licensed under GPL license v2, # Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.732, Solaris version # Version 7.0NG.733, Solaris version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732, AIX version # Version 7.0NG.733, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.732-190327 Version: 7.0NG.733
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732, GNU/Linux # Version 7.0NG.733, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas # Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732, FreeBSD Version # Version 7.0NG.733, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas # Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732, HP-UX Version # Version 7.0NG.733, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732, GNU/Linux # Version 7.0NG.733, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas # Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732, GNU/Linux # Version 7.0NG.733, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732, NetBSD Version # Version 7.0NG.733, NetBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.732, Solaris Version # Version 7.0NG.733, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -41,7 +41,7 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.732'; use constant AGENT_VERSION => '7.0NG.733';
use constant AGENT_BUILD => '190327'; use constant AGENT_BUILD => '190327';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.732 %define version 7.0NG.733
%define release 190327 %define release 1
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.732 %define version 7.0NG.733
%define release 190327 %define release 1
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.732" PI_VERSION="7.0NG.733"
PI_BUILD="190327" PI_BUILD="190327"
OS_NAME=`uname -s` OS_NAME=`uname -s`

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas # (c) 2006-2017 Artica Soluciones Tecnologicas
# Version 7.0NG.732 # Version 7.0NG.733
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes} {Yes}
AppName AppName
{Pandora FMS Windows Agent v7.0NG.732} {Pandora FMS Windows Agent v7.0NG.733}
ApplicationID ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F} {17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
{No} {No}
Windows,Executable Windows,Executable
{<%AppName%>-<%Version%>-Setup<%Ext%>} {<%AppName%>-Setup<%Ext%>}
Windows,FileDescription Windows,FileDescription
{<%AppName%> <%Version%> Setup} {<%AppName%> <%Version%> Setup}

View File

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

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.732(Build 190327))" VALUE "ProductVersion", "(7.0NG.733(Build 190327))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.732-190327 Version: 7.0NG.733
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -1,6 +1,20 @@
START TRANSACTION; START TRANSACTION;
ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT ''; CREATE TABLE IF NOT EXISTS `tnetwork_matrix` (
`id` int(10) unsigned NOT NULL auto_increment,
`source` varchar(60) default '',
`destination` varchar(60) default '',
`utimestamp` bigint(20) default 0,
`bytes` int(18) unsigned default 0,
`pkts` int(18) unsigned default 0,
PRIMARY KEY (`id`),
UNIQUE (`source`, `destination`, `utimestamp`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0';
UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics";
UPDATE `tnetflow_filter` SET aggregate="dstip" WHERE aggregate NOT IN ("dstip", "srcip", "dstport", "srcport");
ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0'; ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0';

View File

@ -1355,6 +1355,7 @@ ALTER TABLE tgraph ADD COLUMN `fullscale` tinyint(1) UNSIGNED NOT NULL default '
-- Table `tnetflow_filter` -- Table `tnetflow_filter`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tnetflow_filter ADD COLUMN `router_ip` TEXT NOT NULL DEFAULT ""; ALTER TABLE tnetflow_filter ADD COLUMN `router_ip` TEXT NOT NULL DEFAULT "";
UPDATE `tnetflow_filter` SET aggregate="dstip" WHERE aggregate NOT IN ("dstip", "srcip", "dstport", "srcport");
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `treport_custom_sql` -- Table `treport_custom_sql`
@ -1377,6 +1378,7 @@ ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0'; ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL; ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL;
ALTER TABLE treport_content ADD COLUMN `show_extended_events` tinyint(1) default '0'; ALTER TABLE treport_content ADD COLUMN `show_extended_events` tinyint(1) default '0';
UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics";
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmodule_relationship` -- Table `tmodule_relationship`
@ -1914,6 +1916,20 @@ CREATE TABLE `tgis_map_layer_groups` (
CONSTRAINT `tgis_map_layer_groups_ibfk_3` FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE CONSTRAINT `tgis_map_layer_groups_ibfk_3` FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `tnetwork_matrix`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tnetwork_matrix` (
`id` int(10) unsigned NOT NULL auto_increment,
`source` varchar(60) default '',
`destination` varchar(60) default '',
`utimestamp` bigint(20) default 0,
`bytes` int(18) unsigned default 0,
`pkts` int(18) unsigned default 0,
PRIMARY KEY (`id`),
UNIQUE (`source`, `destination`, `utimestamp`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `tnotification_source` -- Table `tnotification_source`
-- ----------------------------------------------------- -- -----------------------------------------------------

View File

@ -56,7 +56,7 @@ $custom_logo_collapsed = 'images/custom_logo/'.$config['custom_logo_collapsed'];
if (!defined('PANDORA_ENTERPRISE')) { if (!defined('PANDORA_ENTERPRISE')) {
$logo_title = get_product_name().' Opensource'; $logo_title = get_product_name().' Opensource';
$custom_logo = 'images/custom_logo/pandora_logo_head_green.png'; $custom_logo = 'images/custom_logo/pandora_logo_head_3.png';
$custom_logo_collapsed = 'images/custom_logo/pandora_logo_green_collapsed.png'; $custom_logo_collapsed = 'images/custom_logo/pandora_logo_green_collapsed.png';
} else { } else {
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo)) { if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo)) {

View File

@ -85,7 +85,6 @@ if ($id) {
$dst_port = $filter['dst_port']; $dst_port = $filter['dst_port'];
$src_port = $filter['src_port']; $src_port = $filter['src_port'];
$aggregate = $filter['aggregate']; $aggregate = $filter['aggregate'];
$output = $filter['output'];
$advanced_filter = $filter['advanced_filter']; $advanced_filter = $filter['advanced_filter'];
} else { } else {
$name = ''; $name = '';
@ -94,8 +93,7 @@ if ($id) {
$ip_src = ''; $ip_src = '';
$dst_port = ''; $dst_port = '';
$src_port = ''; $src_port = '';
$aggregate = 'none'; $aggregate = 'dstip';
$output = 'bytes';
$advanced_filter = ''; $advanced_filter = '';
} }
@ -103,7 +101,6 @@ if ($update) {
$name = (string) get_parameter('name'); $name = (string) get_parameter('name');
$assign_group = (int) get_parameter('assign_group'); $assign_group = (int) get_parameter('assign_group');
$aggregate = get_parameter('aggregate', ''); $aggregate = get_parameter('aggregate', '');
$output = get_parameter('output', 'bytes');
$ip_dst = get_parameter('ip_dst', ''); $ip_dst = get_parameter('ip_dst', '');
$ip_src = get_parameter('ip_src', ''); $ip_src = get_parameter('ip_src', '');
$dst_port = get_parameter('dst_port', ''); $dst_port = get_parameter('dst_port', '');
@ -123,7 +120,6 @@ if ($update) {
'dst_port' => $dst_port, 'dst_port' => $dst_port,
'src_port' => $src_port, 'src_port' => $src_port,
'advanced_filter' => $advanced_filter, 'advanced_filter' => $advanced_filter,
'output' => $output,
]; ];
// Save filter args // Save filter args
@ -142,8 +138,7 @@ if ($update) {
if ($create) { if ($create) {
$name = (string) get_parameter('name'); $name = (string) get_parameter('name');
$assign_group = (int) get_parameter('assign_group'); $assign_group = (int) get_parameter('assign_group');
$aggregate = get_parameter('aggregate', 'none'); $aggregate = get_parameter('aggregate', 'dstip');
$output = get_parameter('output', 'bytes');
$ip_dst = get_parameter('ip_dst', ''); $ip_dst = get_parameter('ip_dst', '');
$ip_src = get_parameter('ip_src', ''); $ip_src = get_parameter('ip_src', '');
$dst_port = get_parameter('dst_port', ''); $dst_port = get_parameter('dst_port', '');
@ -159,7 +154,6 @@ if ($create) {
'src_port' => $src_port, 'src_port' => $src_port,
'aggregate' => $aggregate, 'aggregate' => $aggregate,
'advanced_filter' => $advanced_filter, 'advanced_filter' => $advanced_filter,
'output' => $output,
]; ];
// Save filter args // Save filter args
@ -241,8 +235,6 @@ $table->data[7][1] = html_print_textarea('advanced_filter', 4, 40, $advanced_fil
$table->data[8][0] = '<b>'.__('Aggregate by').'</b>'.ui_print_help_icon('aggregate_by', true); $table->data[8][0] = '<b>'.__('Aggregate by').'</b>'.ui_print_help_icon('aggregate_by', true);
$aggregate_list = [ $aggregate_list = [
'none' => __('None'),
'proto' => __('Protocol'),
'srcip' => __('Src Ip Address'), 'srcip' => __('Src Ip Address'),
'dstip' => __('Dst Ip Address'), 'dstip' => __('Dst Ip Address'),
'srcport' => __('Src Port'), 'srcport' => __('Src Port'),
@ -251,15 +243,6 @@ $aggregate_list = [
$table->data[8][1] = html_print_select($aggregate_list, 'aggregate', $aggregate, '', '', 0, true, false, true, '', false); $table->data[8][1] = html_print_select($aggregate_list, 'aggregate', $aggregate, '', '', 0, true, false, true, '', false);
$table->data[9][0] = '<b>'.__('Output format').'</b>';
$show_output = [
'kilobytes' => __('Kilobytes'),
'megabytes' => __('Megabytes'),
'kilobytespersecond' => __('Kilobytes per second'),
'megabytespersecond' => __('Megabytes per second'),
];
$table->data[9][1] = html_print_select($show_output, 'output', $output, '', '', 0, true, false, true, '', false);
echo '<form method="post" action="'.$config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_edit_form&pure='.$pure.'">'; echo '<form method="post" action="'.$config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_edit_form&pure='.$pure.'">';
html_print_table($table); html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';

View File

@ -110,7 +110,7 @@ $event_graph_validated_vs_unvalidated = false;
$netflow_filter = 0; $netflow_filter = 0;
$max_values = 0; $max_values = 0;
$resolution = 0; $resolution = NETFLOW_RES_MEDD;
$lapse_calc = 0; $lapse_calc = 0;
$lapse = 300; $lapse = 300;
@ -600,18 +600,22 @@ switch ($action) {
break; break;
case 'netflow_area': case 'netflow_area':
case 'netflow_pie':
case 'netflow_data': case 'netflow_data':
case 'netflow_statistics':
case 'netflow_summary': case 'netflow_summary':
$netflow_filter = $item['text']; $netflow_filter = $item['text'];
// Filter // Filter.
$period = $item['period']; $period = $item['period'];
$description = $item['description']; $description = $item['description'];
$resolution = $item['top_n']; $resolution = $item['top_n'];
// Interval resolution // Interval resolution.
$max_values = $item['top_n_value']; $max_values = $item['top_n_value'];
// Max values // Max values.
break;
case 'nt_top_n':
$period = $item['period'];
$description = $item['description'];
$top_n_value = $item['top_n_value'];
break; break;
} }
@ -638,6 +642,7 @@ switch ($action) {
case 'simple_baseline_graph': case 'simple_baseline_graph':
case 'event_report_log': case 'event_report_log':
case 'increment': case 'increment':
case 'nt_top_n':
$label = (isset($style['label'])) ? $style['label'] : ''; $label = (isset($style['label'])) ? $style['label'] : '';
break; break;
@ -840,7 +845,11 @@ $class = 'databox filters';
</td> </td>
<td style=""> <td style="">
<?php <?php
html_print_extended_select_for_time('resolution', $resolution, '', '', '0', 10); html_print_select(
netflow_resolution_select_params(),
'resolution',
$resolution
);
?> ?>
</td> </td>
</tr> </tr>
@ -3673,16 +3682,6 @@ function chooseType() {
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
break; break;
case 'netflow_pie':
$("#row_netflow_filter").show();
$("#row_description").show();
$("#row_period").show();
$("#row_max_values").show();
$("#row_resolution").show();
$("#row_servers").show();
$("#row_historical_db_check").hide();
break;
case 'netflow_data': case 'netflow_data':
$("#row_netflow_filter").show(); $("#row_netflow_filter").show();
$("#row_description").show(); $("#row_description").show();
@ -3694,15 +3693,6 @@ function chooseType() {
break; break;
case 'netflow_summary': case 'netflow_summary':
$("#row_netflow_filter").show();
$("#row_description").show();
$("#row_period").show();
$("#row_resolution").show();
$("#row_servers").show();
$("#row_historical_db_check").hide();
break;
case 'netflow_statistics':
$("#row_netflow_filter").show(); $("#row_netflow_filter").show();
$("#row_description").show(); $("#row_description").show();
$("#row_period").show(); $("#row_period").show();
@ -3711,6 +3701,12 @@ function chooseType() {
$("#row_servers").show(); $("#row_servers").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
break; break;
case 'nt_top_n':
$("#row_description").show();
$("#row_period").show();
$("#row_quantity").show();
break;
} }
switch (type) { switch (type) {
case 'event_report_agent': case 'event_report_agent':

View File

@ -1209,9 +1209,7 @@ switch ($action) {
break; break;
case 'netflow_area': case 'netflow_area':
case 'netflow_pie':
case 'netflow_data': case 'netflow_data':
case 'netflow_statistics':
case 'netflow_summary': case 'netflow_summary':
$values['text'] = get_parameter('netflow_filter'); $values['text'] = get_parameter('netflow_filter');
$values['description'] = get_parameter('description'); $values['description'] = get_parameter('description');
@ -1247,6 +1245,12 @@ switch ($action) {
$good_format = true; $good_format = true;
break; break;
case 'nt_top_n':
$values['period'] = get_parameter('period');
$values['top_n_value'] = get_parameter('quantity');
$good_format = true;
break;
default: default:
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('radiobutton_max_min_avg', 0); $values['top_n'] = get_parameter('radiobutton_max_min_avg', 0);
@ -1437,6 +1441,7 @@ switch ($action) {
case 'MTBF': case 'MTBF':
case 'MTTR': case 'MTTR':
case 'simple_baseline_graph': case 'simple_baseline_graph':
case 'nt_top_n':
if ($label != '') { if ($label != '') {
$style['label'] = $label; $style['label'] = $label;
} else { } else {
@ -1577,9 +1582,7 @@ switch ($action) {
break; break;
case 'netflow_area': case 'netflow_area':
case 'netflow_pie':
case 'netflow_data': case 'netflow_data':
case 'netflow_statistics':
case 'netflow_summary': case 'netflow_summary':
$values['text'] = get_parameter('netflow_filter'); $values['text'] = get_parameter('netflow_filter');
$values['description'] = get_parameter('description'); $values['description'] = get_parameter('description');
@ -1615,6 +1618,12 @@ switch ($action) {
$good_format = true; $good_format = true;
break; break;
case 'nt_top_n':
$values['top_n_value'] = get_parameter('quantity');
$values['period'] = get_parameter('period');
$good_format = true;
break;
default: default:
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('radiobutton_max_min_avg', 0); $values['top_n'] = get_parameter('radiobutton_max_min_avg', 0);
@ -1811,6 +1820,7 @@ switch ($action) {
case 'MTBF': case 'MTBF':
case 'MTTR': case 'MTTR':
case 'simple_baseline_graph': case 'simple_baseline_graph':
case 'nt_top_n':
if ($label != '') { if ($label != '') {
$style['label'] = $label; $style['label'] = $label;
} else { } else {

View File

@ -15,6 +15,7 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
ui_require_css_file('discovery'); ui_require_css_file('discovery');
/** /**
* Mask class names. * Mask class names.
* *

View File

@ -536,6 +536,19 @@ $table->data[] = [
), ),
]; ];
$table->data[] = [
__('Max. days before delete old network matrix data'),
html_print_input_text(
'delete_old_network_matrix',
$config['delete_old_network_matrix'],
'',
5,
5,
true
),
];
$table_other = new stdClass(); $table_other = new stdClass();
$table_other->width = '100%'; $table_other->width = '100%';
$table_other->class = 'databox filters'; $table_other->class = 'databox filters';

View File

@ -131,6 +131,14 @@ if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$table->data[19][1] = html_print_checkbox_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true); $table->data[19][1] = html_print_checkbox_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true);
$table->data[21][0] = __('Enable Network Traffic Analyzer');
$table->data[21][1] = html_print_switch(
[
'name' => 'activate_nta',
'value' => $config['activate_nta'],
]
);
$zone_name = [ $zone_name = [
'Africa' => __('Africa'), 'Africa' => __('Africa'),

View File

@ -214,12 +214,16 @@ class Wizard
$bc[$i] = ''; $bc[$i] = '';
if ($separator_beginning === true) $bc[$i] .= '<span class="breadcrumb_link">&nbsp/&nbsp</span>'; if ($separator_beginning === true) {
$bc[$i] .= '<span class="breadcrumb_link">&nbsp/&nbsp</span>';
}
$bc[$i] .= '<span><a class="breadcrumb_link '.$class.'" href="'.$url['link'].'">'; $bc[$i] .= '<span><a class="breadcrumb_link '.$class.'" href="'.$url['link'].'">';
$bc[$i] .= $url['label']; $bc[$i] .= $url['label'];
$bc[$i] .= '</a>'; $bc[$i] .= '</a>';
if ($count < $array_size) $bc[$i] .= '<span class="breadcrumb_link">&nbsp/&nbsp</span>'; if ($count < $array_size) {
$bc[$i] .= '<span class="breadcrumb_link">&nbsp/&nbsp</span>';
}
$bc[$i] .= '</span>'; $bc[$i] .= '</span>';

View File

@ -710,7 +710,7 @@ class ConsoleSupervisor
$this->notify( $this->notify(
[ [
'type' => 'NOTIF.LICENSE.EXPIRATION', 'type' => 'NOTIF.LICENSE.EXPIRATION',
'title' => __('License is going to expire.'), 'title' => __('License is about to expire'),
'message' => __( 'message' => __(
'Your license will expire in %d days. Please, contact our sales department.', 'Your license will expire in %d days. Please, contact our sales department.',
$days_to_expiry $days_to_expiry

View File

@ -289,6 +289,13 @@ class NetworkMap
*/ */
private $filter; private $filter;
/**
* Do not show the popup window.
*
* @var integer
*/
private $noPopUp;
/** /**
* Base constructor. * Base constructor.
@ -315,7 +322,7 @@ class NetworkMap
$this->mapOptions['width'] = $config['networkmap_max_width']; $this->mapOptions['width'] = $config['networkmap_max_width'];
$this->mapOptions['height'] = $config['networkmap_max_width']; $this->mapOptions['height'] = $config['networkmap_max_width'];
$this->mapOptions['simple'] = 0; $this->mapOptions['simple'] = 0;
$this->mapOptions['font_size'] = 12; $this->mapOptions['font_size'] = 20;
$this->mapOptions['nooverlap'] = 1; $this->mapOptions['nooverlap'] = 1;
$this->mapOptions['z_dash'] = 0.5; $this->mapOptions['z_dash'] = 0.5;
$this->mapOptions['center'] = 0; $this->mapOptions['center'] = 0;
@ -376,10 +383,13 @@ class NetworkMap
$this->noPandoraNode = $options['no_pandora_node']; $this->noPandoraNode = $options['no_pandora_node'];
} }
if (isset($options['no_popup'])) {
$this->noPopUp = $options['no_popup'];
}
// Initialize as widget? // Initialize as widget?
if (isset($options['widget'])) { if (isset($options['widget'])) {
$this->isWidget = (bool) $options['widget']; $this->isWidget = (bool) $options['widget'];
} else {
$this->isWidget = true; $this->isWidget = true;
} }
@ -3421,13 +3431,17 @@ class NetworkMap
$output .= $this->loadMapSkel(); $output .= $this->loadMapSkel();
$output .= $this->loadMapData(); $output .= $this->loadMapData();
$output .= $this->loadController(); $output .= $this->loadController();
$output .= $this->loadAdvancedInterface(); if (!$this->noPopUp) {
$output .= $this->loadAdvancedInterface();
}
} else { } else {
// Simulated, no tmap entries. // Simulated, no tmap entries.
$output .= $this->loadMapSkel(); $output .= $this->loadMapSkel();
$output .= $this->loadMapData(); $output .= $this->loadMapData();
$output .= $this->loadController(); $output .= $this->loadController();
$output .= $this->loadSimpleInterface(); if (!$this->noPopUp) {
$output .= $this->loadSimpleInterface();
}
} }
$output .= ' $output .= '

View File

@ -21,7 +21,7 @@
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC190327'; $build_version = 'PC190327';
$pandora_version = 'v7.0NG.732'; $pandora_version = 'v7.0NG.733';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get(); $script_tz = @date_default_timezone_get();

View File

@ -243,19 +243,25 @@ function format_numeric($number, $decimals=1)
/** /**
* Render numeric data for a graph. It adds magnitude suffix to the number * Render numeric data for a graph. It adds magnitude suffix to the number
* (M for millions, K for thousands...) base-10 * (M for millions, K for thousands...). Base can be modified with divider.
* *
* TODO: base-2 multiplication * @param float $number Number to be rendered.
* * @param integer $decimals Numbers after comma (default 1).
* @param float $number Number to be rendered * @param string $dec_point Decimal separator character (default .).
* @param integer $decimals Numbers after comma. Default value: 1 * @param string $thousands_sep Thousands separator character (default ,).
* @param dec_point Decimal separator character. Default value: . * @param integer $divider Number to divide the rendered number.
* @param thousands_sep Thousands separator character. Default value: , * @param string $sufix Units of the multiple.
* *
* @return string A string with the number and the multiplier * @return string A string with the number and the multiplier
*/ */
function format_for_graph($number, $decimals=1, $dec_point='.', $thousands_sep=',') function format_for_graph(
{ $number,
$decimals=1,
$dec_point='.',
$thousands_sep=',',
$divider=1000,
$sufix=''
) {
$shorts = [ $shorts = [
'', '',
'K', 'K',
@ -268,15 +274,15 @@ function format_for_graph($number, $decimals=1, $dec_point='.', $thousands_sep='
'Y', 'Y',
]; ];
$pos = 0; $pos = 0;
while ($number >= 1000) { while ($number >= $divider) {
// as long as the number can be divided by 1000 // As long as the number can be divided by divider.
$pos++; $pos++;
// Position in array starting with 0 // Position in array starting with 0.
$number = ($number / 1000); $number = ($number / $divider);
} }
return remove_right_zeros(format_numeric($number, $decimals)).$shorts[$pos]; // This will actually do the rounding and the decimals.
// This will actually do the rounding and the decimals return remove_right_zeros(format_numeric($number, $decimals)).$shorts[$pos].$sufix;
} }

View File

@ -224,6 +224,10 @@ function config_update_config()
$error_update[] = __('Enable Netflow'); $error_update[] = __('Enable Netflow');
} }
if (!config_update_value('activate_nta', (bool) get_parameter_switch('activate_nta'))) {
$error_update[] = __('Enable Network Traffic Analyzer');
}
$timezone = (string) get_parameter('timezone'); $timezone = (string) get_parameter('timezone');
if ($timezone != '') { if ($timezone != '') {
if (!config_update_value('timezone', $timezone)) { if (!config_update_value('timezone', $timezone)) {
@ -756,6 +760,10 @@ function config_update_config()
$error_update[] = __('Max. days before delete old messages'); $error_update[] = __('Max. days before delete old messages');
} }
if (!config_update_value('delete_old_network_matrix', get_parameter('delete_old_network_matrix'))) {
$error_update[] = __('Max. days before delete old network matrix data');
}
if (!config_update_value('max_graph_container', get_parameter('max_graph_container'))) { if (!config_update_value('max_graph_container', get_parameter('max_graph_container'))) {
$error_update[] = __('Graph container - Max. Items'); $error_update[] = __('Graph container - Max. Items');
} }
@ -1555,6 +1563,10 @@ function config_process_config()
config_update_value('delete_old_messages', 21); config_update_value('delete_old_messages', 21);
} }
if (!isset($config['delete_old_network_matrix'])) {
config_update_value('delete_old_network_matrix', 10);
}
if (!isset($config['max_graph_container'])) { if (!isset($config['max_graph_container'])) {
config_update_value('max_graph_container', 10); config_update_value('max_graph_container', 10);
} }
@ -1991,6 +2003,10 @@ function config_process_config()
config_update_value('activate_netflow', 0); config_update_value('activate_netflow', 0);
} }
if (!isset($config['activate_nta'])) {
config_update_value('activate_nta', 0);
}
if (!isset($config['netflow_path'])) { if (!isset($config['netflow_path'])) {
if ($is_windows) { if ($is_windows) {
$default = 'C:\\PandoraFMS\\Pandora_Server\\data_in\\netflow'; $default = 'C:\\PandoraFMS\\Pandora_Server\\data_in\\netflow';

View File

@ -533,7 +533,8 @@ function grafico_modulo_sparse_data(
'image_treshold' => false, 'image_treshold' => false,
'graph_combined' => false, 'graph_combined' => false,
'zoom' => 1, 'zoom' => 1,
'server_id' => null 'server_id' => null,
'stacked' => 0,
); );
*/ */
function grafico_modulo_sparse($params) function grafico_modulo_sparse($params)
@ -710,6 +711,10 @@ function grafico_modulo_sparse($params)
$agent_module_id = $params['agent_module_id']; $agent_module_id = $params['agent_module_id'];
} }
if (!isset($params['stacked'])) {
$params['stacked'] = 0;
}
// XXXX Configurable // XXXX Configurable
$params['grid_color'] = '#C1C1C1'; $params['grid_color'] = '#C1C1C1';
$params['legend_color'] = '#636363'; $params['legend_color'] = '#636363';
@ -4104,7 +4109,7 @@ function fullscale_data(
/** /**
* Print an area graph with netflow aggregated * Print an area graph with netflow aggregated
*/ */
function graph_netflow_aggregate_area($data, $period, $width, $height, $unit='', $ttl=1, $only_image=false) function graph_netflow_aggregate_area($data, $period, $width, $height, $ttl=1, $only_image=false, $date=null)
{ {
global $config; global $config;
global $graphic_type; global $graphic_type;
@ -4150,7 +4155,7 @@ function graph_netflow_aggregate_area($data, $period, $width, $height, $unit='',
'period' => $period, 'period' => $period,
'width' => '90%', 'width' => '90%',
'height' => 450, 'height' => 450,
'unit' => $unit, 'unit' => 'bytes',
'only_image' => $only_image, 'only_image' => $only_image,
'homeurl' => $homeurl, 'homeurl' => $homeurl,
'menu' => true, 'menu' => true,
@ -4159,6 +4164,10 @@ function graph_netflow_aggregate_area($data, $period, $width, $height, $unit='',
'font' => $config['fontpath'], 'font' => $config['fontpath'],
'font_size' => $config['font_size'], 'font_size' => $config['font_size'],
'array_data_create' => $chart, 'array_data_create' => $chart,
'stacked' => 1,
'date' => $date,
'show_export_csv' => false,
'show_overview' => false,
]; ];
return grafico_modulo_sparse($params); return grafico_modulo_sparse($params);
@ -4280,9 +4289,16 @@ function graph_netflow_aggregate_pie($data, $aggregate, $ttl=1, $only_image=fals
/** /**
* Print a circular graph with the data transmitted between IPs * Print a circular mesh array.
*
* @param array $data Array with properly data structure. Array with two
* elements required:
* 'elements': Non-associative array with all the relationships.
* 'matrix': Array of arrays with value of the relationship.
*
* @return string HTML data.
*/ */
function graph_netflow_circular_mesh($data, $unit, $radius=700) function graph_netflow_circular_mesh($data)
{ {
global $config; global $config;
@ -4292,14 +4308,14 @@ function graph_netflow_circular_mesh($data, $unit, $radius=700)
include_once $config['homedir'].'/include/graphs/functions_d3.php'; include_once $config['homedir'].'/include/graphs/functions_d3.php';
return d3_relationship_graph($data['elements'], $data['matrix'], $unit, $radius, true); return d3_relationship_graph($data['elements'], $data['matrix'], 700, true);
} }
/** /**
* Print a rectangular graph with the traffic of the ports for each IP * Print a rectangular graph with the traffic of the ports for each IP
*/ */
function graph_netflow_host_traffic($data, $unit, $width=700, $height=700) function graph_netflow_host_traffic($data, $width=700, $height=700)
{ {
global $config; global $config;

View File

@ -1060,7 +1060,7 @@ function html_print_extended_select_for_time(
'images/pencil.png', 'images/pencil.png',
true, true,
[ [
'class' => $uniq_name.'_toggler', 'class' => $uniq_name.'_toggler '.$class,
'alt' => __('Custom'), 'alt' => __('Custom'),
'title' => __('Custom'), 'title' => __('Custom'),
'style' => 'width: 18px;'.$style_icon, 'style' => 'width: 18px;'.$style_icon,
@ -2392,12 +2392,21 @@ function html_print_checkbox_switch($name, $value, $checked=false, $return=false
/** /**
* Prints an image HTML element. * Prints an image HTML element.
* *
* @param string $src Image source filename. * @param string $src Image source filename.
* @param boolean $return Whether to return or print * @param boolean $return Whether to return or print.
* @param array $options Array with optional HTML options to set. At this moment, the * @param array $options Array with optional HTML options to set.
* following options are supported: alt, style, title, width, height, class, pos_tree. * At this moment, the following options are supported:
* @param boolean $return_src Whether to return src field of image ('images/*.*') or complete html img tag ('<img src="..." alt="...">'). * align, border, hspace, ismap, vspace, style, title, height,
* @param boolean $relative Whether to use relative path to image or not (i.e. $relative= true : /pandora/<img_src>). * longdesc, usemap, width, id, class, lang, xml:lang, onclick,
* ondblclick, onmousedown, onmouseup, onmouseover, onmousemove,
* onmouseout, onkeypress, onkeydown, onkeyup, pos_tree, alt.
* @param boolean $return_src Whether to return src field of image
* ('images/*.*') or complete html img tag ('<img src="..." alt="...">').
* @param boolean $relative Whether to use relative path to image or not
* (i.e. $relative= true : /pandora/<img_src>).
* @param boolean $no_in_meta Do not show on metaconsole folder at first. Go
* directly to the node.
* @param boolean $isExternalLink Do not shearch for images in Pandora.
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
@ -2412,9 +2421,9 @@ function html_print_image(
) { ) {
global $config; global $config;
// If metaconsole is in use then don't use skins // If metaconsole is in use then don't use skins.
if (!is_metaconsole()) { if (!is_metaconsole()) {
// Checks if user's skin is available // Checks if user's skin is available.
$isFunctionSkins = enterprise_include_once('include/functions_skins.php'); $isFunctionSkins = enterprise_include_once('include/functions_skins.php');
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
@ -2426,11 +2435,11 @@ function html_print_image(
} }
} }
// If metaconsole is activated and image doesn't exists try to search on normal console // If metaconsole is activated and image doesn't exists try to search on normal console.
if (is_metaconsole()) { if (is_metaconsole()) {
if (!$relative) { if (!$relative) {
$working_dir = str_replace('\\', '/', getcwd()); $working_dir = str_replace('\\', '/', getcwd());
// Windows compatibility // Windows compatibility.
if ($no_in_meta) { if ($no_in_meta) {
$src = '../../'.$src; $src = '../../'.$src;
} else if (strstr($working_dir, 'enterprise/meta') === false) { } else if (strstr($working_dir, 'enterprise/meta') === false) {
@ -2468,22 +2477,22 @@ function html_print_image(
} }
} }
// Only return src field of image // Only return src field of image.
if ($return_src) { if ($return_src) {
if (!$return) { if (!$return) {
echo io_safe_input($src); echo io_safe_input($src);
return; return null;
} }
return io_safe_input($src); return io_safe_input($src);
} }
$output = '<img src="'.$src.'" '; $output = '<img src="'.$src.'" ';
// Dont use safe_input here or the performance will dead // Dont use safe_input here or the performance will dead.
$style = ''; $style = '';
if (!empty($options)) { if (!empty($options)) {
// Deprecated or value-less attributes // Deprecated or value-less attributes.
if (isset($options['align'])) { if (isset($options['align'])) {
$style .= 'align:'.$options['align'].';'; $style .= 'align:'.$options['align'].';';
// Align is deprecated, use styles. // Align is deprecated, use styles.
@ -2491,23 +2500,23 @@ function html_print_image(
if (isset($options['border'])) { if (isset($options['border'])) {
$style .= 'border:'.$options['border'].'px;'; $style .= 'border:'.$options['border'].'px;';
// Border is deprecated, use styles // Border is deprecated, use styles.
} }
if (isset($options['hspace'])) { if (isset($options['hspace'])) {
$style .= 'margin-left:'.$options['hspace'].'px;'; $style .= 'margin-left:'.$options['hspace'].'px;';
// hspace is deprecated, use styles // hspace is deprecated, use styles.
$style .= 'margin-right:'.$options['hspace'].'px;'; $style .= 'margin-right:'.$options['hspace'].'px;';
} }
if (isset($options['ismap'])) { if (isset($options['ismap'])) {
$output .= 'ismap="ismap" '; $output .= 'ismap="ismap" ';
// Defines the image as a server-side image map // Defines the image as a server-side image map.
} }
if (isset($options['vspace'])) { if (isset($options['vspace'])) {
$style .= 'margin-top:'.$options['vspace'].'px;'; $style .= 'margin-top:'.$options['vspace'].'px;';
// hspace is deprecated, use styles // hspace is deprecated, use styles.
$style .= 'margin-bottom:'.$options['vspace'].'px;'; $style .= 'margin-bottom:'.$options['vspace'].'px;';
} }
@ -2515,7 +2524,7 @@ function html_print_image(
$style .= $options['style']; $style .= $options['style'];
} }
// If title is provided activate forced title // If title is provided activate forced title.
if (isset($options['title']) && $options['title'] != '') { if (isset($options['title']) && $options['title'] != '') {
if (isset($options['class'])) { if (isset($options['class'])) {
$options['class'] .= ' forced_title'; $options['class'] .= ' forced_title';
@ -2523,12 +2532,12 @@ function html_print_image(
$options['class'] = 'forced_title'; $options['class'] = 'forced_title';
} }
// New way to show the force_title (cleaner and better performance) // New way to show the force_title (cleaner and better performance).
$output .= 'data-title="'.io_safe_input_html($options['title']).'" '; $output .= 'data-title="'.io_safe_input_html($options['title']).'" ';
$output .= 'data-use_title_for_force_title="1" '; $output .= 'data-use_title_for_force_title="1" ';
} }
// Valid attributes (invalid attributes get skipped) // Valid attributes (invalid attributes get skipped).
$attrs = [ $attrs = [
'height', 'height',
'longdesc', 'longdesc',
@ -2562,7 +2571,7 @@ function html_print_image(
if (!isset($options['alt']) && isset($options['title'])) { if (!isset($options['alt']) && isset($options['title'])) {
$options['alt'] = io_safe_input_html($options['title']); $options['alt'] = io_safe_input_html($options['title']);
// Set alt to title if it's not set // Set alt to title if it's not set.
} }
if (!empty($style)) { if (!empty($style)) {
@ -3002,3 +3011,48 @@ function html_print_switch($attributes=[])
<span class='p-slider'></span> <span class='p-slider'></span>
</label>"; </label>";
} }
/**
* Print a link with post params.The component is really a form with a button
* with some inputs hidden.
*
* @param string $text Text to show.
* @param array $params Params to be written like inputs hidden.
* @param string $text Text of image.
* @param string $style Additional style for the element.
*
* @return string With HTML code.
*/
function html_print_link_with_params($text, $params=[], $type='text', $style='')
{
$html = '<form method=post>';
switch ($type) {
case 'image':
$html .= html_print_input_image($text, $text, $text, $style, true);
break;
case 'text':
default:
if (!empty($style)) {
$style = ' style="'.$style.'"';
}
$html .= html_print_submit_button(
$text,
$text,
false,
'class="button-as-link"'.$style,
true
);
break;
}
foreach ($params as $param => $value) {
$html .= html_print_input_hidden($param, $value, true);
}
$html .= '</form>';
return $html;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,320 @@
<?php
/**
* Network explorer
*
* @package Include.
* @subpackage Network functions.
*
* Pandora FMS - http://pandorafms.com
* ==================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org 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; 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.
*/
// Write here requires and definitions.
/**
* Get the tnetwok_matrix summatory data.
*
* @param integer $top Number of hosts to show.
* @param boolean $talker Talker (true) or listetener (false).
* @param integer $start Utimestamp of start time.
* @param integer $end Utimestamp of end time.
* @param string $ip_filter Ip to filter.
* @param boolean $order_by_bytes True by top by bytes. False by packets.
* @param array $host_filter Host filter array.
*
* @return array With requested data.
*/
function network_matrix_get_top(
$top,
$talker,
$start,
$end,
$ip_filter='',
$order_by_bytes=true,
$host_filter=[]
) {
$field_to_group = ($talker === true) ? 'source' : 'destination';
$field_to_order = ($order_by_bytes === true) ? 'sum_bytes' : 'sum_pkts';
$filter_sql = '';
if (!empty($ip_filter)) {
$filter_field = ($talker === true) ? 'destination' : 'source';
$filter_sql = sprintf('AND %s="%s"', $filter_field, $ip_filter);
}
$host_filter_sql = '';
if (!empty($host_filter)) {
$host_filter_sql = sprintf(
' AND %s IN ("%s")',
$field_to_group,
implode('","', $host_filter)
);
}
$sql = sprintf(
'SELECT SUM(bytes) sum_bytes, SUM(pkts) sum_pkts, %s host
FROM tnetwork_matrix
WHERE utimestamp > %d AND utimestamp < %d
%s
%s
GROUP BY %s
ORDER BY %s DESC
LIMIT %d',
$field_to_group,
$start,
$end,
$filter_sql,
$host_filter_sql,
$field_to_group,
$field_to_order,
$top
);
$data = db_get_all_rows_sql($sql);
return ($data !== false) ? $data : [];
}
/**
* Get the possible actions on networking.
*
* @param boolean $network True if network. False if netflow.
*
* @return array With the actions to print in a select.
*/
function network_get_report_actions($network=true)
{
$common_actions = [
'listeners' => __('Top listeners'),
'talkers' => __('Top talkers'),
];
if ($network) {
return $common_actions;
}
return array_merge(
$common_actions,
[
'tcp' => __('Top TCP protocols'),
'udp' => __('Top UDP protocols'),
]
);
}
/**
* Print the header of the network
*
* @param string $title Title of header.
* @param string $order Current ordering.
* @param string $selected Selected order.
* @param array $hidden_data All the data to hide into the button.
*
* @return string With HTML data.
*/
function network_print_explorer_header(
$title,
$order,
$selected,
$hidden_data
) {
$cell = '<div style="display: flex; align-items: center;">';
$cell .= $title;
$cell .= html_print_link_with_params(
'images/arrow-down-white.png',
array_merge($hidden_data, ['order_by' => $order]),
'image',
($selected === $order) ? 'opacity: 0.5' : ''
);
$cell .= '</div>';
return $cell;
}
/**
* Alias for format_for_graph to print bytes.
*
* @param integer $value Value to parse like bytes.
*
* @return string Number parsed.
*/
function network_format_bytes($value)
{
if (!isset($value)) {
$value = 0;
}
$value = (int) $value;
return format_for_graph(
$value,
2,
'.',
',',
1024,
'B'
);
}
/**
* Build netflow data structure to network map.
*
* @param integer $start Time in timestamp format.
* @param integer $end Time in timestamp format.
* @param integer $top Max data to show.
* @param boolean $talker True to get top tolkers. False for listeners.
*
* @return array With map structure.
*/
function network_build_map_data($start, $end, $top, $talker)
{
$data = network_matrix_get_top($top, $talker, $start, $end);
$hosts = array_map(
function ($elem) {
return $elem['host'];
},
$data
);
$inverse_hosts = array_flip($hosts);
$nodes = array_map(
function ($elem) {
return network_init_node_map($elem);
},
$hosts
);
$relations = [];
$orphan_relations = [];
foreach ($hosts as $host) {
$host_top = network_matrix_get_top(
$top,
!$talker,
$start,
$end,
$host,
true,
$hosts
);
foreach ($host_top as $sd) {
$src_index = $inverse_hosts[$host];
$dst_index = $inverse_hosts[$sd['host']];
if (isset($src_index) === false || isset($dst_index) === false) {
continue;
}
network_init_relation_map(
$relations,
$src_index,
$dst_index,
network_format_bytes($sd['sum_bytes'])
);
}
// Put the orphans on Other node.
if (empty($host_top)) {
$other_id = (end($inverse_hosts) + 1);
// TODOS: Add the data.
network_init_relation_map(
$orphan_relations,
$other_id,
$inverse_hosts[$host]
);
}
}
// Put the Others node and their relations.
if (empty($orphan_relations) === false) {
$nodes[] = network_init_node_map(__('Others'));
$relations = array_merge($relations, $orphan_relations);
}
return network_general_map_configuration($nodes, $relations);
}
/**
* Return the array to pass to constructor to NetworkMap.
*
* @param array $nodes Nodes data structure.
* @param array $relations Relations data structure.
*
* @return array To be passed to NetworMap class.
*/
function network_general_map_configuration($nodes, $relations)
{
return [
'nodes' => $nodes,
'relations' => $relations,
'pure' => 1,
'no_pandora_node' => 1,
'no_popup' => 1,
'map_options' => [
'generation_method' => LAYOUT_SPRING1,
'map_filter' => [
'node_radius' => 40,
'node_sep' => 7,
],
],
];
}
/**
* Added a relation to relations array
*
* @param array $relations Relations array (passed by reference).
* @param integer $parent Parent id (numeric).
* @param integer $child Child id (numeric).
* @param string $text Text to show at the end of edge (optional).
*
* @return void Relations will be modified (passed by reference).
*/
function network_init_relation_map(&$relations, $parent, $child, $text='')
{
$index = $parent.'-'.$child;
$relations[$index] = [
'id_parent' => $parent,
'parent_type' => NODE_GENERIC,
'child_type' => NODE_GENERIC,
'id_child' => $child,
'link_color' => '#82B92E',
];
if (empty($text) === false) {
$relations[$index]['text_start'] = $text;
}
}
/**
* Initialize a node structure to NetworkMap class.
*
* @param string $name Node name.
*
* @return array Node data structure.
*/
function network_init_node_map($name)
{
return [
'name' => $name,
'type' => NODE_GENERIC,
'width' => 20,
'height' => 20,
'status' => '#82B92E',
];
}

View File

@ -36,6 +36,7 @@ require_once $config['homedir'].'/include/functions_forecast.php';
require_once $config['homedir'].'/include/functions_ui.php'; require_once $config['homedir'].'/include/functions_ui.php';
require_once $config['homedir'].'/include/functions_netflow.php'; require_once $config['homedir'].'/include/functions_netflow.php';
require_once $config['homedir'].'/include/functions_os.php'; require_once $config['homedir'].'/include/functions_os.php';
require_once $config['homedir'].'/include/functions_network.php';
// //
// CONSTANTS DEFINITIONS // // CONSTANTS DEFINITIONS //
@ -516,16 +517,6 @@ function reporting_make_reporting_data(
); );
break; break;
case 'netflow_pie':
$report['contents'][] = reporting_netflow(
$report,
$content,
$type,
$force_width_chart,
$force_height_chart,
'netflow_pie',
$pdf
);
break; break;
case 'netflow_data': case 'netflow_data':
@ -540,18 +531,6 @@ function reporting_make_reporting_data(
); );
break; break;
case 'netflow_statistics':
$report['contents'][] = reporting_netflow(
$report,
$content,
$type,
$force_width_chart,
$force_height_chart,
'netflow_statistics',
$pdf
);
break;
case 'netflow_summary': case 'netflow_summary':
$report['contents'][] = reporting_netflow( $report['contents'][] = reporting_netflow(
$report, $report,
@ -794,6 +773,14 @@ function reporting_make_reporting_data(
$pdf $pdf
); );
break; break;
case 'nt_top_n':
$report['contents'][] = reporting_nt_top_n_report(
$report,
$content,
$pdf
);
break;
} }
$index_content++; $index_content++;
@ -3958,6 +3945,20 @@ function reporting_monitor_report($report, $content)
} }
/**
* Generates the data structure to build a netflow report.
*
* @param array $report Global report info.
* @param array $content Report item info.
* @param string $type Report type (static, dynamic, data).
* @param integer $force_width_chart Fixed width chart.
* @param integer $force_height_chart Fixed height chart.
* @param string $type_netflow One of netflow_area, netflow_data,
* netflow_summary.
* @param boolean $pdf True if a pdf report is generating.
*
* @return array Report item structure.
*/
function reporting_netflow( function reporting_netflow(
$report, $report,
$content, $content,
@ -3974,21 +3975,17 @@ function reporting_netflow(
$return['type'] = 'netflow_area'; $return['type'] = 'netflow_area';
break; break;
case 'netflow_pie':
$return['type'] = 'netflow_pie';
break;
case 'netflow_data': case 'netflow_data':
$return['type'] = 'netflow_data'; $return['type'] = 'netflow_data';
break; break;
case 'netflow_statistics':
$return['type'] = 'netflow_statistics';
break;
case 'netflow_summary': case 'netflow_summary':
$return['type'] = 'netflow_summary'; $return['type'] = 'netflow_summary';
break; break;
default:
$return['type'] = 'unknown';
break;
} }
if (empty($content['name'])) { if (empty($content['name'])) {
@ -3997,20 +3994,16 @@ function reporting_netflow(
$content['name'] = __('Netflow Area'); $content['name'] = __('Netflow Area');
break; break;
case 'netflow_pie': case 'netflow_summary':
$content['name'] = __('Netflow Pie'); $content['name'] = __('Netflow Summary');
break; break;
case 'netflow_data': case 'netflow_data':
$content['name'] = __('Netflow Data'); $content['name'] = __('Netflow Data');
break; break;
case 'netflow_statistics': default:
$content['name'] = __('Netflow Statistics'); $content['name'] = __('Unknown report');
break;
case 'netflow_summary':
$content['name'] = __('Netflow Summary');
break; break;
} }
} }
@ -4019,7 +4012,7 @@ function reporting_netflow(
$return['description'] = $content['description']; $return['description'] = $content['description'];
$return['date'] = reporting_get_date_text($report, $content); $return['date'] = reporting_get_date_text($report, $content);
// Get chart // Get chart.
reporting_set_conf_charts( reporting_set_conf_charts(
$width, $width,
$height, $height,
@ -4037,7 +4030,7 @@ function reporting_netflow(
$height = $force_height_chart; $height = $force_height_chart;
} }
// Get item filters // Get item filters.
$filter = db_get_row_sql( $filter = db_get_row_sql(
"SELECT * "SELECT *
FROM tnetflow_filter FROM tnetflow_filter
@ -4062,9 +4055,17 @@ function reporting_netflow(
break; break;
case 'data': case 'data':
default:
// Nothing to do.
break; break;
} }
$return['subtitle'] = netflow_generate_subtitle_report(
$filter['aggregate'],
$content['top_n'],
$type_netflow
);
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
} }
@ -11517,3 +11518,38 @@ function reporting_header_table_for_pdf(string $title='', string $description=''
return $result_pdf; return $result_pdf;
} }
/**
* Build the required data to build network traffic top N report
*
* @param int Period (time window).
* @param array Information about the item of report.
* @param bool Pdf or not
*
* @return array With report presentation info and report data.
*/
function reporting_nt_top_n_report($period, $content, $pdf)
{
$return = [];
$return['type'] = 'nt_top_n';
$return['title'] = $content['name'];
$return['description'] = $content['description'];
// Get the data sent and received
$return['data'] = [];
$start_time = ($period['datetime'] - (int) $content['period']);
$return['data']['send'] = network_matrix_get_top(
$content['top_n_value'],
true,
$start_time,
$period['datetime']
);
$return['data']['recv'] = network_matrix_get_top(
$content['top_n_value'],
false,
$start_time,
$period['datetime']
);
return $return;
}

View File

@ -271,21 +271,7 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
break; break;
case 'netflow_area': case 'netflow_area':
reporting_html_graph($table, $item);
break;
case 'netflow_pie':
reporting_html_graph($table, $item);
break;
case 'netflow_data': case 'netflow_data':
reporting_html_graph($table, $item);
break;
case 'netflow_statistics':
reporting_html_graph($table, $item);
break;
case 'netflow_summary': case 'netflow_summary':
reporting_html_graph($table, $item); reporting_html_graph($table, $item);
break; break;
@ -367,6 +353,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
reporting_enterprise_html_SLA_monthly($table, $item, $mini); reporting_enterprise_html_SLA_monthly($table, $item, $mini);
break; break;
case 'nt_top_n':
reporting_html_nt_top_n($table, $item, $mini);
break;
case 'SLA_weekly': case 'SLA_weekly':
reporting_enterprise_html_SLA_weekly($table, $item, $mini); reporting_enterprise_html_SLA_weekly($table, $item, $mini);
break; break;
@ -4769,6 +4759,65 @@ function reporting_get_event_histogram_meta($width)
} }
/**
* Print network traffic data into top n tables
* (one for received data and another for sent)
*
* @param stdClass Table class to paint the report
* @param array Associative array with info about
* @param bool Unused
*/
function reporting_html_nt_top_n($table, $item, $mini)
{
// Prepare the table
$table_top = new stdClass();
$table_top->cellpadding = 0;
$table_top->cellspacing = 0;
$table_top->width = '100%';
$table_top->class = 'databox data';
$table_top->cellpadding = 0;
$table_top->cellspacing = 0;
$table_top->width = '100%';
$table_top->class = 'databox data';
$table_top->head['host'] = __('Agent');
$table_top->head['bytes'] = __('Kilobytes');
$table_top->head['pkts'] = __('Packages');
// Build the table for sent packages
if (empty($item['data']['send'])) {
$table->data['send_title'] = '<h3>'.__('No network traffic sent data').'</h3>';
} else {
foreach ($item['data']['send'] as $s_item) {
$table_top->data[] = [
'host' => $s_item['host'],
'bytes' => remove_right_zeros(number_format(($s_item['sum_bytes'] / 1024), $config['graph_precision'])),
'pkts' => remove_right_zeros(number_format($s_item['sum_pkts'], $config['graph_precision'])),
];
}
$table->data['send_title'] = '<h3>'.__('Network traffic sent').'</h3>';
$table->data['send'] = html_print_table($table_top, true);
}
// Reset the table and build the table for received packages
$table_top->data = [];
if (empty($item['data']['send'])) {
$table->data['recv_title'] = '<h3>'.__('No network traffic received data').'</h3>';
} else {
foreach ($item['data']['recv'] as $s_item) {
$table_top->data[] = [
'host' => $s_item['host'],
'bytes' => remove_right_zeros(number_format(($s_item['sum_bytes'] / 1024), $config['graph_precision'])),
'pkts' => remove_right_zeros(number_format($s_item['sum_pkts'], $config['graph_precision'])),
];
}
$table->data['recv_title'] = '<h3>'.__('Network traffic received').'</h3>';
$table->data['recv'] = html_print_table($table_top, true);
}
}
function reporting_html_planned_downtimes_table($planned_downtimes) function reporting_html_planned_downtimes_table($planned_downtimes)
{ {
global $config; global $config;

View File

@ -867,18 +867,10 @@ function reports_get_report_types($template=false, $not_editor=false)
'optgroup' => __('Netflow'), 'optgroup' => __('Netflow'),
'name' => __('Netflow area chart'), 'name' => __('Netflow area chart'),
]; ];
$types['netflow_pie'] = [
'optgroup' => __('Netflow'),
'name' => __('Netflow pie chart'),
];
$types['netflow_data'] = [ $types['netflow_data'] = [
'optgroup' => __('Netflow'), 'optgroup' => __('Netflow'),
'name' => __('Netflow data table'), 'name' => __('Netflow data table'),
]; ];
$types['netflow_statistics'] = [
'optgroup' => __('Netflow'),
'name' => __('Netflow statistics table'),
];
$types['netflow_summary'] = [ $types['netflow_summary'] = [
'optgroup' => __('Netflow'), 'optgroup' => __('Netflow'),
'name' => __('Netflow summary table'), 'name' => __('Netflow summary table'),
@ -892,5 +884,10 @@ function reports_get_report_types($template=false, $not_editor=false)
]; ];
} }
$types['nt_top_n'] = [
'optgroup' => __('Network traffic'),
'name' => __('Network Traffic Top N'),
];
return $types; return $types;
} }

View File

@ -2792,8 +2792,9 @@ function ui_print_page_header(
$buffer = '<div id="'.$type2.'" style="">'; $buffer = '<div id="'.$type2.'" style="">';
if (!empty($breadcrumbs)) if (!empty($breadcrumbs)) {
$buffer .= '<div class="breadcrumbs_container">'.$breadcrumbs.'</div>'; $buffer .= '<div class="breadcrumbs_container">'.$breadcrumbs.'</div>';
}
$buffer .= '<div id="menu_tab_left">'; $buffer .= '<div id="menu_tab_left">';

View File

@ -38,7 +38,7 @@ function include_javascript_d3($return=false)
} }
function d3_relationship_graph($elements, $matrix, $unit, $width=700, $return=false) function d3_relationship_graph($elements, $matrix, $width=700, $return=false)
{ {
global $config; global $config;
@ -53,7 +53,7 @@ function d3_relationship_graph($elements, $matrix, $unit, $width=700, $return=fa
$output = '<div id="chord_diagram"></div>'; $output = '<div id="chord_diagram"></div>';
$output .= include_javascript_d3(true); $output .= include_javascript_d3(true);
$output .= "<script language=\"javascript\" type=\"text/javascript\"> $output .= "<script language=\"javascript\" type=\"text/javascript\">
chordDiagram('#chord_diagram', $elements, $matrix, '$unit', $width); chordDiagram('#chord_diagram', $elements, $matrix, $width);
</script>"; </script>";
if (!$return) { if (!$return) {

View File

@ -20,7 +20,7 @@
// matrix = [[0, 0, 2], // a[a => a, a => b, a => c] // matrix = [[0, 0, 2], // a[a => a, a => b, a => c]
// [5, 0, 1], // b[b => a, b => b, b => c] // [5, 0, 1], // b[b => a, b => b, b => c]
// [2, 3, 0]]; // c[c => a, c => b, c => c] // [2, 3, 0]]; // c[c => a, c => b, c => c]
function chordDiagram(recipient, elements, matrix, unit, width) { function chordDiagram(recipient, elements, matrix, width) {
d3.chart = d3.chart || {}; d3.chart = d3.chart || {};
d3.chart.chordWheel = function(options) { d3.chart.chordWheel = function(options) {
// Default values // Default values
@ -206,18 +206,14 @@ function chordDiagram(recipient, elements, matrix, unit, width) {
" → " + " → " +
elements[d.target.index] + elements[d.target.index] +
": <b>" + ": <b>" +
d.source.value.toFixed(2) + valueToBytes(d.source.value) +
" " +
unit +
"</b>" + "</b>" +
"<br>" + "<br>" +
elements[d.target.index] + elements[d.target.index] +
" → " + " → " +
elements[d.source.index] + elements[d.source.index] +
": <b>" + ": <b>" +
d.target.value.toFixed(2) + valueToBytes(d.target.value) +
" " +
unit +
"</b>" "</b>"
) )
); );
@ -227,18 +223,14 @@ function chordDiagram(recipient, elements, matrix, unit, width) {
" → " + " → " +
elements[d.target.index] + elements[d.target.index] +
": <b>" + ": <b>" +
d.source.value.toFixed(2) + valueToBytes(d.source.value) +
" " +
unit +
"</b>" + "</b>" +
"<br>" + "<br>" +
elements[d.target.index] + elements[d.target.index] +
" → " + " → " +
elements[d.source.index] + elements[d.source.index] +
": <b>" + ": <b>" +
d.target.value.toFixed(2) + valueToBytes(d.target.value) +
" " +
unit +
"</b>" "</b>"
); );
} }
@ -2751,3 +2743,17 @@ function printClockDigital1(
setTimeout(tick, 1000 - (now % 1000)); setTimeout(tick, 1000 - (now % 1000));
})(); })();
} }
function valueToBytes(value) {
var shorts = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"];
var pos = 0;
while (value >= 1024) {
// As long as the number can be divided by divider.
pos++;
// Position in array starting with 0.
value = value / 1024;
}
// This will actually do the rounding and the decimals.
return value.toFixed(2) + shorts[pos] + "B";
}

View File

@ -4322,6 +4322,18 @@ form ul.form_flex li ul li {
text-align: center; text-align: center;
} }
.div-v-centered {
display: flex;
align-items: center;
}
.div-v-centered > form > input[type="image"] {
margin: 0;
padding: 0;
width: 14px;
padding-left: 5px;
}
.pandora_upper { .pandora_upper {
text-transform: uppercase; text-transform: uppercase;
} }
@ -4392,6 +4404,13 @@ tr:first-child > td > a.up_arrow {
margin-right: 5px; margin-right: 5px;
} }
.button-as-link {
text-decoration: underline;
background: none !important;
border: none;
padding: 0 !important;
}
/* /*
* --------------------------------------------------------------------- * ---------------------------------------------------------------------
* - MESSAGE LIST POPUP - * - MESSAGE LIST POPUP -

View File

@ -128,7 +128,7 @@
</div> </div>
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.732'; $version = '7.0NG.733';
$build = '190327'; $build = '190327';
$banner = "v$version Build $build"; $banner = "v$version Build $build";

View File

@ -23,7 +23,7 @@ enterprise_include('operation/menu.php');
$menu_operation = []; $menu_operation = [];
$menu_operation['class'] = 'operation'; $menu_operation['class'] = 'operation';
// Agent read, Server read // Agent read, Server read.
if (check_acl($config['id_user'], 0, 'AR')) { if (check_acl($config['id_user'], 0, 'AR')) {
// View agents // View agents
$menu_operation['estado']['text'] = __('Monitoring'); $menu_operation['estado']['text'] = __('Monitoring');
@ -65,20 +65,69 @@ if (check_acl($config['id_user'], 0, 'AR')) {
enterprise_hook('inventory_menu'); enterprise_hook('inventory_menu');
if ($config['activate_netflow']) { if ($config['activate_netflow'] || $config['activate_nta']) {
$sub['operation/netflow/nf_live_view']['text'] = __('Netflow Live View'); $sub['network'] = [
$sub['operation/netflow/nf_live_view']['id'] = 'Netflow Live View'; 'text' => __('Network'),
$sub['operation/netflow/nf_live_view']['refr'] = 0; 'id' => 'Network',
'type' => 'direct',
'subtype' => 'nolink',
'refr' => 0,
];
// Initialize the submenu.
$netflow_sub = [];
if ($config['activate_netflow']) {
$netflow_sub = array_merge(
$netflow_sub,
[
'operation/netflow/netflow_explorer' => [
'text' => __('Netflow explorer'),
'id' => 'Netflow explorer',
],
'operation/netflow/nf_live_view' => [
'text' => __('Netflow Live View'),
'id' => 'Netflow Live View',
],
]
);
}
if ($config['activate_nta']) {
$netflow_sub = array_merge(
$netflow_sub,
[
'operation/network/network_explorer' => [
'text' => __('Network explorer'),
'id' => 'Network explorer',
],
]
);
}
if ($config['activate_nta'] || $config['activate_netflow']) {
$netflow_sub = array_merge(
$netflow_sub,
[
'operation/network/network_usage_map' => [
'text' => __('Network usage map'),
'id' => 'Network usage map',
],
]
);
}
$sub['network']['sub2'] = $netflow_sub;
} }
if ($config['log_collector'] == 1) { if ($config['log_collector'] == 1) {
enterprise_hook('log_collector_menu'); enterprise_hook('log_collector_menu');
} }
// End of view agents // End of view agents.
} }
// SNMP Console // SNMP Console.
$sub2 = []; $sub2 = [];
if (check_acl($config['id_user'], 0, 'AR') || check_acl($config['id_user'], 0, 'AW')) { if (check_acl($config['id_user'], 0, 'AR') || check_acl($config['id_user'], 0, 'AW')) {
$sub2['operation/snmpconsole/snmp_view']['text'] = __('SNMP console'); $sub2['operation/snmpconsole/snmp_view']['text'] = __('SNMP console');
@ -115,10 +164,10 @@ if (!empty($sub)) {
$menu_operation['estado']['sub'] = $sub; $menu_operation['estado']['sub'] = $sub;
} }
// Start network view // Start network view.
$sub = []; $sub = [];
if (check_acl($config['id_user'], 0, 'MR') || check_acl($config['id_user'], 0, 'MW') || check_acl($config['id_user'], 0, 'MM')) { if (check_acl($config['id_user'], 0, 'MR') || check_acl($config['id_user'], 0, 'MW') || check_acl($config['id_user'], 0, 'MM')) {
// Network enterprise // Network enterprise.
$sub['operation/agentes/pandora_networkmap']['text'] = __('Network map'); $sub['operation/agentes/pandora_networkmap']['text'] = __('Network map');
$sub['operation/agentes/pandora_networkmap']['id'] = 'Network map'; $sub['operation/agentes/pandora_networkmap']['id'] = 'Network map';
$sub['operation/agentes/pandora_networkmap']['refr'] = 0; $sub['operation/agentes/pandora_networkmap']['refr'] = 0;
@ -130,17 +179,17 @@ enterprise_hook('services_menu');
if (check_acl($config['id_user'], 0, 'VR') || check_acl($config['id_user'], 0, 'VW') || check_acl($config['id_user'], 0, 'VM')) { if (check_acl($config['id_user'], 0, 'VR') || check_acl($config['id_user'], 0, 'VW') || check_acl($config['id_user'], 0, 'VM')) {
if (!isset($config['vc_favourite_view']) || $config['vc_favourite_view'] == 0) { if (!isset($config['vc_favourite_view']) || $config['vc_favourite_view'] == 0) {
// Visual console // Visual console.
$sub['godmode/reporting/map_builder']['text'] = __('Visual console'); $sub['godmode/reporting/map_builder']['text'] = __('Visual console');
$sub['godmode/reporting/map_builder']['id'] = 'Visual console'; $sub['godmode/reporting/map_builder']['id'] = 'Visual console';
} else { } else {
// Visual console favorite // Visual console favorite.
$sub['godmode/reporting/visual_console_favorite']['text'] = __('Visual console'); $sub['godmode/reporting/visual_console_favorite']['text'] = __('Visual console');
$sub['godmode/reporting/visual_console_favorite']['id'] = 'Visual console'; $sub['godmode/reporting/visual_console_favorite']['id'] = 'Visual console';
} }
if ($config['vc_menu_items'] != 0) { if ($config['vc_menu_items'] != 0) {
// Set godomode path // Set godomode path.
if (!isset($config['vc_favourite_view']) || $config['vc_favourite_view'] == 0) { if (!isset($config['vc_favourite_view']) || $config['vc_favourite_view'] == 0) {
$sub['godmode/reporting/map_builder']['subsecs'] = [ $sub['godmode/reporting/map_builder']['subsecs'] = [
'godmode/reporting/map_builder', 'godmode/reporting/map_builder',
@ -212,7 +261,7 @@ if (check_acl($config['id_user'], 0, 'VR') || check_acl($config['id_user'], 0, '
if (check_acl($config['id_user'], 0, 'MR') || check_acl($config['id_user'], 0, 'MW') || check_acl($config['id_user'], 0, 'MM')) { if (check_acl($config['id_user'], 0, 'MR') || check_acl($config['id_user'], 0, 'MW') || check_acl($config['id_user'], 0, 'MM')) {
// INI GIS Maps // INI GIS Maps.
if ($config['activate_gis']) { if ($config['activate_gis']) {
$sub['gismaps']['text'] = __('GIS Maps'); $sub['gismaps']['text'] = __('GIS Maps');
$sub['gismaps']['id'] = 'GIS Maps'; $sub['gismaps']['id'] = 'GIS Maps';
@ -254,7 +303,7 @@ if (check_acl($config['id_user'], 0, 'MR') || check_acl($config['id_user'], 0, '
$sub['gismaps']['sub2'] = $sub2; $sub['gismaps']['sub2'] = $sub2;
} }
// END GIS Maps // END GIS Maps.
} }
if (!empty($sub)) { if (!empty($sub)) {
@ -265,10 +314,10 @@ if (!empty($sub)) {
$menu_operation['network']['sub'] = $sub; $menu_operation['network']['sub'] = $sub;
} }
// End networkview // End networkview.
// Reports read // Reports read.
if (check_acl($config['id_user'], 0, 'RR') || check_acl($config['id_user'], 0, 'RW') || check_acl($config['id_user'], 0, 'RM')) { if (check_acl($config['id_user'], 0, 'RR') || check_acl($config['id_user'], 0, 'RW') || check_acl($config['id_user'], 0, 'RM')) {
// Reporting // Reporting.
$menu_operation['reporting']['text'] = __('Reporting'); $menu_operation['reporting']['text'] = __('Reporting');
$menu_operation['reporting']['sec2'] = 'godmode/reporting/reporting_builder'; $menu_operation['reporting']['sec2'] = 'godmode/reporting/reporting_builder';
$menu_operation['reporting']['id'] = 'oper-reporting'; $menu_operation['reporting']['id'] = 'oper-reporting';
@ -278,7 +327,7 @@ if (check_acl($config['id_user'], 0, 'RR') || check_acl($config['id_user'], 0, '
$sub['godmode/reporting/reporting_builder']['text'] = __('Custom reporting'); $sub['godmode/reporting/reporting_builder']['text'] = __('Custom reporting');
$sub['godmode/reporting/reporting_builder']['id'] = 'Custom reporting'; $sub['godmode/reporting/reporting_builder']['id'] = 'Custom reporting';
// Set godomode path // Set godomode path.
$sub['godmode/reporting/reporting_builder']['subsecs'] = [ $sub['godmode/reporting/reporting_builder']['subsecs'] = [
'godmode/reporting/reporting_builder', 'godmode/reporting/reporting_builder',
'operation/reporting/reporting_viewer', 'operation/reporting/reporting_viewer',
@ -287,7 +336,7 @@ if (check_acl($config['id_user'], 0, 'RR') || check_acl($config['id_user'], 0, '
$sub['godmode/reporting/graphs']['text'] = __('Custom graphs'); $sub['godmode/reporting/graphs']['text'] = __('Custom graphs');
$sub['godmode/reporting/graphs']['id'] = 'Custom graphs'; $sub['godmode/reporting/graphs']['id'] = 'Custom graphs';
// Set godomode path // Set godomode path.
$sub['godmode/reporting/graphs']['subsecs'] = [ $sub['godmode/reporting/graphs']['subsecs'] = [
'operation/reporting/graph_viewer', 'operation/reporting/graph_viewer',
'godmode/reporting/graph_builder', 'godmode/reporting/graph_builder',
@ -297,15 +346,15 @@ if (check_acl($config['id_user'], 0, 'RR') || check_acl($config['id_user'], 0, '
enterprise_hook('reporting_godmenu'); enterprise_hook('reporting_godmenu');
$menu_operation['reporting']['sub'] = $sub; $menu_operation['reporting']['sub'] = $sub;
// End reporting // End reporting.
} }
// Events reading // Events reading.
if (check_acl($config['id_user'], 0, 'ER') if (check_acl($config['id_user'], 0, 'ER')
|| check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, 'EW')
|| check_acl($config['id_user'], 0, 'EM') || check_acl($config['id_user'], 0, 'EM')
) { ) {
// Events // Events.
$menu_operation['eventos']['text'] = __('Events'); $menu_operation['eventos']['text'] = __('Events');
$menu_operation['eventos']['refr'] = 0; $menu_operation['eventos']['refr'] = 0;
$menu_operation['eventos']['sec2'] = 'operation/events/events'; $menu_operation['eventos']['sec2'] = 'operation/events/events';
@ -318,24 +367,24 @@ if (check_acl($config['id_user'], 0, 'ER')
$sub['operation/events/event_statistics']['text'] = __('Statistics'); $sub['operation/events/event_statistics']['text'] = __('Statistics');
$sub['operation/events/event_statistics']['id'] = 'Statistics'; $sub['operation/events/event_statistics']['id'] = 'Statistics';
// If ip doesn't is in list of allowed IP, isn't show this options // If ip doesn't is in list of allowed IP, isn't show this options.
include_once 'include/functions_api.php'; include_once 'include/functions_api.php';
if (isInACL($_SERVER['REMOTE_ADDR'])) { if (isInACL($_SERVER['REMOTE_ADDR'])) {
$pss = get_user_info($config['id_user']); $pss = get_user_info($config['id_user']);
$hashup = md5($config['id_user'].$pss['password']); $hashup = md5($config['id_user'].$pss['password']);
// RSS // RSS.
$sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure=']['text'] = __('RSS'); $sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure=']['text'] = __('RSS');
$sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure=']['id'] = 'RSS'; $sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure=']['id'] = 'RSS';
$sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure=']['type'] = 'direct'; $sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure=']['type'] = 'direct';
// Marquee // Marquee.
$sub['operation/events/events_marquee.php']['text'] = __('Marquee'); $sub['operation/events/events_marquee.php']['text'] = __('Marquee');
$sub['operation/events/events_marquee.php']['id'] = 'Marquee'; $sub['operation/events/events_marquee.php']['id'] = 'Marquee';
$sub['operation/events/events_marquee.php']['type'] = 'direct'; $sub['operation/events/events_marquee.php']['type'] = 'direct';
} }
// Sound Events // Sound Events.
$javascript = "javascript: window.open('operation/events/sound_events.php');"; $javascript = "javascript: window.open('operation/events/sound_events.php');";
$javascript = 'javascript: alert(111);'; $javascript = 'javascript: alert(111);';
$javascript = 'javascript: openSoundEventWindow();'; $javascript = 'javascript: openSoundEventWindow();';
@ -359,31 +408,31 @@ if (check_acl($config['id_user'], 0, 'ER')
$menu_operation['eventos']['sub'] = $sub; $menu_operation['eventos']['sub'] = $sub;
} }
// Workspace // Workspace.
$menu_operation['workspace']['text'] = __('Workspace'); $menu_operation['workspace']['text'] = __('Workspace');
$menu_operation['workspace']['sec2'] = 'operation/users/user_edit'; $menu_operation['workspace']['sec2'] = 'operation/users/user_edit';
$menu_operation['workspace']['id'] = 'oper-users'; $menu_operation['workspace']['id'] = 'oper-users';
// ANY user can view him/herself ! // ANY user can view him/herself !
// Users // Users.
$sub = []; $sub = [];
$sub['operation/users/user_edit']['text'] = __('Edit my user'); $sub['operation/users/user_edit']['text'] = __('Edit my user');
$sub['operation/users/user_edit']['id'] = 'Edit my user'; $sub['operation/users/user_edit']['id'] = 'Edit my user';
$sub['operation/users/user_edit']['refr'] = 0; $sub['operation/users/user_edit']['refr'] = 0;
// Users // Users.
$sub['operation/users/user_edit_notifications']['text'] = __('Configure user notifications'); $sub['operation/users/user_edit_notifications']['text'] = __('Configure user notifications');
$sub['operation/users/user_edit_notifications']['id'] = 'Configure user notifications'; $sub['operation/users/user_edit_notifications']['id'] = 'Configure user notifications';
$sub['operation/users/user_edit_notifications']['refr'] = 0; $sub['operation/users/user_edit_notifications']['refr'] = 0;
// ANY user can chat with other user and dogs. // ANY user can chat with other user and dogs.
// Users // Users.
$sub['operation/users/webchat']['text'] = __('WebChat'); $sub['operation/users/webchat']['text'] = __('WebChat');
$sub['operation/users/webchat']['id'] = 'WebChat'; $sub['operation/users/webchat']['id'] = 'WebChat';
$sub['operation/users/webchat']['refr'] = 0; $sub['operation/users/webchat']['refr'] = 0;
// Incidents // Incidents.
if (check_acl($config['id_user'], 0, 'IR') if (check_acl($config['id_user'], 0, 'IR')
|| check_acl($config['id_user'], 0, 'IW') || check_acl($config['id_user'], 0, 'IW')
|| check_acl($config['id_user'], 0, 'IM') || check_acl($config['id_user'], 0, 'IM')
@ -410,7 +459,7 @@ if (check_acl($config['id_user'], 0, 'IR')
} }
// Messages // Messages.
$sub['message_list']['text'] = __('Messages'); $sub['message_list']['text'] = __('Messages');
$sub['message_list']['id'] = 'Messages'; $sub['message_list']['id'] = 'Messages';
$sub['message_list']['refr'] = 0; $sub['message_list']['refr'] = 0;
@ -427,7 +476,7 @@ $menu_operation['workspace']['sub'] = $sub;
// End Workspace // End Workspace
// Rest of options, all with AR privilege (or should events be with incidents?) // Rest of options, all with AR privilege (or should events be with incidents?)
// ~ if (check_acl ($config['id_user'], 0, "AR")) { // ~ if (check_acl ($config['id_user'], 0, "AR")) {
// Extensions menu additions // Extensions menu additions.
if (is_array($config['extensions'])) { if (is_array($config['extensions'])) {
$sub = []; $sub = [];
$sub2 = []; $sub2 = [];
@ -450,12 +499,12 @@ if (is_array($config['extensions'])) {
} }
foreach ($config['extensions'] as $extension) { foreach ($config['extensions'] as $extension) {
// If no operation_menu is a godmode extension // If no operation_menu is a godmode extension.
if ($extension['operation_menu'] == '') { if ($extension['operation_menu'] == '') {
continue; continue;
} }
// Check the ACL for this user // Check the ACL for this user.
if (! check_acl($config['id_user'], 0, $extension['operation_menu']['acl'])) { if (! check_acl($config['id_user'], 0, $extension['operation_menu']['acl'])) {
continue; continue;
} }
@ -469,7 +518,7 @@ if (is_array($config['extensions'])) {
continue; continue;
} }
// Check if was displayed inside other menu // Check if was displayed inside other menu.
if ($extension['operation_menu']['fatherId'] == '') { if ($extension['operation_menu']['fatherId'] == '') {
if ($extension_menu['name'] == 'Update manager') { if ($extension_menu['name'] == 'Update manager') {
continue; continue;
@ -480,7 +529,7 @@ if (is_array($config['extensions'])) {
$sub[$extension_menu['sec2']]['refr'] = 0; $sub[$extension_menu['sec2']]['refr'] = 0;
} else { } else {
if (array_key_exists('fatherId', $extension_menu)) { if (array_key_exists('fatherId', $extension_menu)) {
// Check that extension father ID exists previously on the menu // Check that extension father ID exists previously on the menu.
if ((strlen($extension_menu['fatherId']) > 0)) { if ((strlen($extension_menu['fatherId']) > 0)) {
if (array_key_exists('subfatherId', $extension_menu)) { if (array_key_exists('subfatherId', $extension_menu)) {
if ((strlen($extension_menu['subfatherId']) > 0)) { if ((strlen($extension_menu['subfatherId']) > 0)) {

View File

@ -0,0 +1,42 @@
<?php
/**
* Network explorer
*
* @package Operations.
* @subpackage Netflow explorer view.
*
* Pandora FMS - http://pandorafms.com
* ==================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org 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; 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.
*/
global $config;
check_login();
// ACL Check.
if (! check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Netflow explorer'
);
include 'general/noaccess.php';
exit;
}
$action = get_parameter('action', 'listeners');
$is_network = false;
ui_print_page_header(__('Netflow explorer'));
if (netflow_print_check_version_error()) {
include $config['homedir'].'/operation/network/network_report.php';
}

View File

@ -1,16 +1,23 @@
<?php <?php
/**
* Netflow live view
*
* @package Pandora FMS open.
* @subpackage UI file.
*
* Pandora FMS - http://pandorafms.com
* ==================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org 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; 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.
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org 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; 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.
global $config; global $config;
require_once $config['homedir'].'/include/functions_graph.php'; require_once $config['homedir'].'/include/functions_graph.php';
@ -19,7 +26,7 @@ require_once $config['homedir'].'/include/functions_netflow.php';
ui_require_javascript_file('calendar'); ui_require_javascript_file('calendar');
// ACL // ACL.
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'], 0, 'AW')) { if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit( db_pandora_audit(
@ -32,12 +39,12 @@ if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'],
$pure = get_parameter('pure', 0); $pure = get_parameter('pure', 0);
// Ajax callbacks // Ajax callbacks.
if (is_ajax()) { if (is_ajax()) {
$get_filter_type = get_parameter('get_filter_type', 0); $get_filter_type = get_parameter('get_filter_type', 0);
$get_filter_values = get_parameter('get_filter_values', 0); $get_filter_values = get_parameter('get_filter_values', 0);
// Get filter of the current netflow filter // Get filter of the current netflow filter.
if ($get_filter_type) { if ($get_filter_type) {
$id = get_parameter('id'); $id = get_parameter('id');
@ -52,13 +59,13 @@ if (is_ajax()) {
echo $type; echo $type;
} }
// Get values of the current netflow filter // Get values of the current netflow filter.
if ($get_filter_values) { if ($get_filter_values) {
$id = get_parameter('id'); $id = get_parameter('id');
$filter_values = db_get_row_filter('tnetflow_filter', ['id_sg' => $id]); $filter_values = db_get_row_filter('tnetflow_filter', ['id_sg' => $id]);
// Decode HTML entities // Decode HTML entities.
$filter_values['advanced_filter'] = io_safe_output($filter_values['advanced_filter']); $filter_values['advanced_filter'] = io_safe_output($filter_values['advanced_filter']);
@ -68,12 +75,11 @@ if (is_ajax()) {
return; return;
} }
// Read filter configuration // Read filter configuration.
$filter_id = (int) get_parameter('filter_id', 0); $filter_id = (int) get_parameter('filter_id', 0);
$filter['id_name'] = get_parameter('name', ''); $filter['id_name'] = get_parameter('name', '');
$filter['id_group'] = (int) get_parameter('assign_group', 0); $filter['id_group'] = (int) get_parameter('assign_group', 0);
$filter['aggregate'] = get_parameter('aggregate', ''); $filter['aggregate'] = get_parameter('aggregate', '');
$filter['output'] = get_parameter('output', 'bytes');
$filter['ip_dst'] = get_parameter('ip_dst', ''); $filter['ip_dst'] = get_parameter('ip_dst', '');
$filter['ip_src'] = get_parameter('ip_src', ''); $filter['ip_src'] = get_parameter('ip_src', '');
$filter['dst_port'] = get_parameter('dst_port', ''); $filter['dst_port'] = get_parameter('dst_port', '');
@ -81,30 +87,38 @@ $filter['src_port'] = get_parameter('src_port', '');
$filter['advanced_filter'] = get_parameter('advanced_filter', ''); $filter['advanced_filter'] = get_parameter('advanced_filter', '');
$filter['router_ip'] = get_parameter('router_ip'); $filter['router_ip'] = get_parameter('router_ip');
// Read chart configuration // Read chart configuration.
$chart_type = get_parameter('chart_type', 'netflow_area'); $chart_type = get_parameter('chart_type', 'netflow_area');
$max_aggregates = (int) get_parameter('max_aggregates', 1); $max_aggregates = (int) get_parameter('max_aggregates', 10);
$period = (int) get_parameter('period', SECONDS_1DAY);
$update_date = (int) get_parameter('update_date', 0); $update_date = (int) get_parameter('update_date', 0);
$date = get_parameter_post('date', date(DATE_FORMAT, get_system_time()));
$time = get_parameter_post('time', date(TIME_FORMAT, get_system_time()));
$connection_name = get_parameter('connection_name', ''); $connection_name = get_parameter('connection_name', '');
$interval_length = (int) get_parameter('interval_length', 300); $interval_length = get_parameter('interval_length', NETFLOW_RES_MEDD);
$address_resolution = (int) get_parameter('address_resolution', $config['netflow_get_ip_hostname']); $address_resolution = (int) get_parameter('address_resolution', $config['netflow_get_ip_hostname']);
$filter_selected = (int) get_parameter('filter_selected', 0); $filter_selected = (int) get_parameter('filter_selected', 0);
// Read buttons // 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);
} else {
$time_lower = date(TIME_FORMAT, $start_date);
$date_lower = date(DATE_FORMAT, $start_date);
}
// Read buttons.
$draw = get_parameter('draw_button', ''); $draw = get_parameter('draw_button', '');
$save = get_parameter('save_button', ''); $save = get_parameter('save_button', '');
$update = get_parameter('update_button', ''); $update = get_parameter('update_button', '');
// Calculate start and end dates
$end_date = strtotime($date.' '.$time);
$start_date = ($end_date - $period);
if (!is_metaconsole()) { if (!is_metaconsole()) {
// Header // Header.
ui_print_page_header( ui_print_page_header(
__('Netflow live view'), __('Netflow live view'),
'images/op_netflow.png', 'images/op_netflow.png',
@ -118,22 +132,7 @@ if (!is_metaconsole()) {
if ($is_windows) { if ($is_windows) {
ui_print_error_message(__('Not supported in Windows systems')); ui_print_error_message(__('Not supported in Windows systems'));
} else { } else {
// Check the nfdump binary netflow_print_check_version_error();
$check_result = netflow_check_nfdump_binary($config['netflow_nfdump']);
// Not found or not executable
if ($check_result == 1) {
ui_print_error_message(
sprintf(
__('nfdump binary (%s) not found!'),
$config['netflow_nfdump']
)
);
}
// Wrong version
else if ($check_result == 2) {
ui_print_error_message(sprintf(__('Make sure nfdump version 1.6.8 or newer is installed!')));
}
} }
} else { } else {
$nav_bar = [ $nav_bar = [
@ -152,9 +151,9 @@ if (!is_metaconsole()) {
ui_meta_print_header(__('Netflow live view')); ui_meta_print_header(__('Netflow live view'));
} }
// Save user defined filter // Save user defined filter.
if ($save != '' && check_acl($config['id_user'], 0, 'AW')) { if ($save != '' && check_acl($config['id_user'], 0, 'AW')) {
// Save filter args // Save filter args.
$filter['filter_args'] = netflow_get_filter_arguments($filter); $filter['filter_args'] = netflow_get_filter_arguments($filter);
$filter_id = db_process_sql_insert('tnetflow_filter', $filter); $filter_id = db_process_sql_insert('tnetflow_filter', $filter);
@ -164,15 +163,14 @@ if ($save != '' && check_acl($config['id_user'], 0, 'AW')) {
} else { } else {
ui_print_success_message(__('Filter created successfully')); ui_print_success_message(__('Filter created successfully'));
} }
} } else if ($update != '' && check_acl($config['id_user'], 0, 'AW')) {
// Update current filter // Update current filter.
else if ($update != '' && check_acl($config['id_user'], 0, 'AW')) { // Do not update the filter name and group.
// Do not update the filter name and group
$filter_copy = $filter; $filter_copy = $filter;
unset($filter_copy['id_name']); unset($filter_copy['id_name']);
unset($filter_copy['id_group']); unset($filter_copy['id_group']);
// Save filter args // Save filter args.
$filter_copy['filter_args'] = netflow_get_filter_arguments($filter_copy); $filter_copy['filter_args'] = netflow_get_filter_arguments($filter_copy);
$result = db_process_sql_update( $result = db_process_sql_update(
@ -188,7 +186,7 @@ else if ($update != '' && check_acl($config['id_user'], 0, 'AW')) {
} }
// The filter name will not be needed anymore // The filter name will not be needed anymore.
$filter['id_name'] = ''; $filter['id_name'] = '';
$netflow_disable_custom_lvfilters = false; $netflow_disable_custom_lvfilters = false;
@ -223,7 +221,7 @@ if (is_metaconsole()) {
} }
foreach ($servers as $server) { foreach ($servers as $server) {
// If connection was good then retrieve all data server // If connection was good then retrieve all data server.
if (metaconsole_load_external_db($server)) { if (metaconsole_load_external_db($server)) {
$connection = true; $connection = true;
} else { } else {
@ -241,7 +239,7 @@ if (is_metaconsole()) {
} }
echo '<tr>'; echo '<tr>';
echo '<td>'.'<b>'.__('Connection').'</b>'.'</td>'; echo '<td><b>'.__('Connection').'</b></td>';
echo '<td>'.html_print_select( echo '<td>'.html_print_select(
$list_servers, $list_servers,
'connection_name', 'connection_name',
@ -258,23 +256,59 @@ if (is_metaconsole()) {
echo '<tr>'; echo '<tr>';
echo '<td>'.'<b>'.__('Date').'</b>'.'</td>'; $class_not_period = ($is_period) ? 'nf_hidden' : 'nf_display';
$class_period = ($is_period) ? 'nf_display' : 'nf_hidden';
echo '<td>';
echo '<b class="'.$class_period.'">'.__('Interval').'</b>';
echo '<b class="'.$class_not_period.'">'.__('Start date').'</b>';
echo '</td>';
echo '<td>';
echo html_print_extended_select_for_time('period', $period, '', '', 0, false, true, false, true, $class_period);
echo html_print_input_text('date_lower', $date_lower, false, 13, 10, true, false, false, '', $class_not_period);
echo html_print_image(
'images/calendar_view_day.png',
true,
[
'alt' => 'calendar',
'class' => $class_not_period,
]
).html_print_input_text('time_lower', $time_lower, false, 10, 8, true, false, false, '', $class_not_period);
echo html_print_checkbox(
'is_period',
1,
($is_period === true) ? 1 : 0,
true,
false,
'nf_view_click_period(event)'
);
echo ui_print_help_tip(__('Select this checkbox to write interval instead a date.'), true);
echo '</td>';
echo '<td><b>'.__('End date').'</b></td>';
echo '<td>'.html_print_input_text('date', $date, false, 13, 10, true).html_print_image( echo '<td>'.html_print_input_text('date', $date, false, 13, 10, true).html_print_image(
'images/calendar_view_day.png', 'images/calendar_view_day.png',
true, true,
['alt' => 'calendar'] ['alt' => 'calendar']
).ui_print_help_tip(__('Date format is YY/MM/DD'), true).html_print_input_text('time', $time, false, 10, 8, true).ui_print_help_tip(__('Watch format is hours (24h):minutes:seconds'), true).'</td>'; ).ui_print_help_tip(__('Date format is YY/MM/DD'), true).html_print_input_text('time', $time, false, 10, 8, true).ui_print_help_tip(__('Watch format is hours (24h):minutes:seconds'), true);
echo '</td>';
echo '<td>'.'<b>'.__('Interval').'</b>'.'</td>'; echo '<td><b>'.__('Resolution').ui_print_help_tip(__('The interval will be divided in chunks the length of the resolution.'), true).'</b></td>';
echo '<td>'.html_print_select(netflow_get_valid_intervals(), 'period', $period, '', '', 0, true, false, false).'</td>'; echo '<td>'.html_print_select(
netflow_resolution_select_params(),
echo '<td>'.'<b>'.__('Resolution').ui_print_help_tip(__('The interval will be divided in chunks the length of the resolution.'), true).'</b>'.'</td>'; 'interval_length',
echo '<td>'.html_print_select(netflow_get_valid_subintervals(), 'interval_length', $interval_length, '', '', 0, true, false, false).'</td>'; $interval_length,
'',
'',
0,
true,
false,
false
).'</td>';
echo '</tr>'; echo '</tr>';
echo '<tr>'; echo '<tr>';
echo '<td>'.'<b>'.__('Type').'</b>'.'</td>'; echo '<td><b>'.__('Type').'</b></td>';
echo '<td>'.html_print_select( echo '<td>'.html_print_select(
netflow_get_chart_types(), netflow_get_chart_types(),
'chart_type', 'chart_type',
@ -285,7 +319,7 @@ if (is_metaconsole()) {
true true
).'</td>'; ).'</td>';
echo '<td>'.'<b>'.__('Max. values').'</b>'.'</td>'; echo '<td><b>'.__('Max. values').'</b></td>';
$max_values = [ $max_values = [
'2' => '2', '2' => '2',
'5' => '5', '5' => '5',
@ -299,6 +333,134 @@ if (is_metaconsole()) {
echo '<td>'.html_print_select($max_values, 'max_aggregates', $max_aggregates, '', '', 0, true).'<a id="max_values" href="#" onclick="javascript: edit_max_value();">'.html_print_image('images/pencil.png', true, ['id' => 'pencil']).'</a>'; echo '<td>'.html_print_select($max_values, 'max_aggregates', $max_aggregates, '', '', 0, true).'<a id="max_values" href="#" onclick="javascript: edit_max_value();">'.html_print_image('images/pencil.png', true, ['id' => 'pencil']).'</a>';
echo '</td>'; echo '</td>';
echo '<td><b>'.__('Aggregate by').'</b>'.ui_print_help_icon('aggregate_by', true).'</td>';
$aggregate_list = [];
$aggregate_list = [
'srcip' => __('Src Ip Address'),
'dstip' => __('Dst Ip Address'),
'srcport' => __('Src Port'),
'dstport' => __('Dst Port'),
];
echo '<td>'.html_print_select($aggregate_list, 'aggregate', $filter['aggregate'], '', '', 0, true, false, true, '', false).'</td>';
echo '</tr>';
// Read filter type.
if ($filter['advanced_filter'] != '') {
$filter_type = 1;
} else {
$filter_type = 0;
}
echo "<tr class='filter_save' style='display: none;'>";
echo "<td colspan='6'>".ui_print_error_message('Define a name for the filter and click on Save as new filter again', '', true).'</td>';
echo '</tr>';
echo "<tr class='filter_save' style='display: none;'>";
echo '<td><span id="filter_name_color"><b>'.__('Name').'</b></span></td>';
echo "<td colspan='2'>".html_print_input_text(
'name',
$filter['id_name'],
false,
20,
80,
true
).'</td>';
$own_info = get_user_info($config['id_user']);
echo '<td><span id="filter_group_color"><b>'.__('Group').'</b></span></td>';
echo "<td colspan='2'>".html_print_select_groups($config['id_user'], 'IW', $own_info['is_admin'], 'assign_group', $filter['id_group'], '', '', -1, true, false, false).'</td>';
echo '</tr>';
echo '<tr id="filter_toggle">';
echo '<td colspan="5">';
html_print_image(
'images/darrowdown.png',
false,
[
'onclick' => 'toggleFilters(event)',
'style' => 'cursor: pointer;',
'id' => 'nf-toggle-button',
]
);
echo __('Advanced');
echo '</td>';
echo '</tr>';
echo '<tr class="nf_filter">';
if ($netflow_disable_custom_lvfilters) {
echo '<td></td>';
echo '<td></td>';
} else {
echo '<td><b>'.__('Filter').'</b></td>';
echo '<td colspan="2">'.__('Normal').' '.html_print_radio_button_extended('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'style="margin-right: 40px;"', true).__('Custom').' '.html_print_radio_button_extended('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'style="margin-right: 40px;"', true).'</td>';
}
echo '<td><b>'.__('Load filter').'</b></td>';
$user_groups = users_get_groups($config['id_user'], 'AR', $own_info['is_admin'], true);
$user_groups[0] = 0;
// Add all groups.
$sql = 'SELECT *
FROM tnetflow_filter
WHERE id_group IN ('.implode(',', array_keys($user_groups)).')';
echo "<td colspan='3'>".html_print_select_from_sql($sql, 'filter_id', $filter_id, '', __('Select a filter'), 0, true);
html_print_input_hidden('filter_selected', $filter_selected, false);
echo '</td>';
echo '</tr>';
echo "<tr class='filter_normal nf_filter'>";
if ($netflow_disable_custom_lvfilters) {
echo '<td></td>';
echo '<td></td>';
} else {
echo "<td style='font-weight:bold;'>".__('Dst Ip').ui_print_help_tip(__('Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249'), true).'</td>';
echo '<td colspan="2">'.html_print_input_text('ip_dst', $filter['ip_dst'], false, 40, 80, true).'</td>';
}
if ($netflow_disable_custom_lvfilters) {
echo '<td></td>';
echo '<td></td>';
} else {
echo "<td style='font-weight:bold;'>".__('Src Ip').ui_print_help_tip(__('Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249'), true).'</td>';
echo '<td colspan="2">'.html_print_input_text('ip_src', $filter['ip_src'], false, 40, 80, true).'</td>';
}
echo '</tr>';
echo "<tr class='filter_normal nf_filter'>";
if ($netflow_disable_custom_lvfilters) {
echo '<td></td>';
echo '<td></td>';
} else {
echo "<td style='font-weight:bold;'>".__('Dst Port').ui_print_help_tip(__('Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22'), true).'</td>';
echo '<td colspan="2">'.html_print_input_text('dst_port', $filter['dst_port'], false, 40, 80, true).'</td>';
}
if ($netflow_disable_custom_lvfilters) {
echo '<td></td>';
echo '<td></td>';
} else {
echo "<td style='font-weight:bold;'>".__('Src Port').ui_print_help_tip(__('Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22'), true).'</td>';
echo '<td colspan="2">'.html_print_input_text('src_port', $filter['src_port'], false, 40, 80, true).'</td>';
}
echo '</tr>';
echo "<tr class='filter_advance nf_filter' style='display: none;'>";
if ($netflow_disable_custom_lvfilters) {
echo '<td></td>';
echo '<td></td>';
} else {
echo '<td>'.ui_print_help_icon('pcap_filter', true).'</td>';
echo "<td colspan='5'>".html_print_textarea('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px; width: 90%;'", true).'</td>';
}
echo '</tr>';
echo '<tr class="nf_filter">';
$onclick = "if (!confirm('".__('Warning').'. '.__('IP address resolution can take a lot of time')."')) return false;"; $onclick = "if (!confirm('".__('Warning').'. '.__('IP address resolution can take a lot of time')."')) return false;";
$radio_buttons = __('Yes').'&nbsp;&nbsp;'.html_print_radio_button_extended( $radio_buttons = __('Yes').'&nbsp;&nbsp;'.html_print_radio_button_extended(
'address_resolution', 'address_resolution',
@ -317,141 +479,11 @@ if (is_metaconsole()) {
$address_resolution, $address_resolution,
true true
); );
echo '<td>'.'<b>'.__('IP address resolution').'</b>'.ui_print_help_tip(__('Resolve the IP addresses to get their hostnames.'), true).'</td>'; echo '<td><b>'.__('IP address resolution').'</b>'.ui_print_help_tip(__('Resolve the IP addresses to get their hostnames.'), true).'</td>';
echo "<td>$radio_buttons</td>"; echo '<td colspan="2">'.$radio_buttons.'</td>';
echo '</tr>'; echo '<td><b>'.__('Source ip').'</b></td>';
echo '<td colspan="2">'.html_print_input_text('router_ip', $filter['router_ip'], false, 40, 80, true).'</td>';
// Read filter type
if ($filter['advanced_filter'] != '') {
$filter_type = 1;
} else {
$filter_type = 0;
}
echo "<tr class='filter_save' style='display: none;'>";
echo "<td colspan='6'>".ui_print_error_message('Define a name for the filter and click on Save as new filter again', '', true).'</td>';
echo '</tr>';
echo "<tr class='filter_save' style='display: none;'>";
echo '<td>'.'<span id="filter_name_color"><b>'.__('Name').'</b></span>'.'</td>';
echo "<td colspan='2'>".html_print_input_text(
'name',
$filter['id_name'],
false,
20,
80,
true
).'</td>';
$own_info = get_user_info($config['id_user']);
echo '<td>'.'<span id="filter_group_color"><b>'.__('Group').'</b></span>'.'</td>';
echo "<td colspan='2'>".html_print_select_groups($config['id_user'], 'IW', $own_info['is_admin'], 'assign_group', $filter['id_group'], '', '', -1, true, false, false).'</td>';
echo '</tr>';
echo '<tr>';
if ($netflow_disable_custom_lvfilters) {
echo '<td></td>';
echo '<td></td>';
} else {
echo '<td>'.'<b>'.__('Filter').'</b>'.'</td>';
echo '<td>'.__('Normal').' '.html_print_radio_button_extended('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'style="margin-right: 40px;"', true).__('Advanced').' '.html_print_radio_button_extended('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'style="margin-right: 40px;"', true).'</td>';
}
echo '<td>'.'<b>'.__('Load filter').'</b>'.'</td>';
$user_groups = users_get_groups($config['id_user'], 'AR', $own_info['is_admin'], true);
$user_groups[0] = 0;
// Add all groups.
$sql = 'SELECT *
FROM tnetflow_filter
WHERE id_group IN ('.implode(',', array_keys($user_groups)).')';
echo "<td colspan='3'>".html_print_select_from_sql($sql, 'filter_id', $filter_id, '', __('Select a filter'), 0, true);
html_print_input_hidden('filter_selected', $filter_selected, false);
echo '</td>';
echo '</tr>';
echo "<tr class='filter_normal'>";
if ($netflow_disable_custom_lvfilters) {
echo '<td></td>';
echo '<td></td>';
} else {
echo "<td style='font-weight:bold;'>".__('Dst Ip').ui_print_help_tip(__('Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249'), true).'</td>';
echo '<td>'.html_print_input_text('ip_dst', $filter['ip_dst'], false, 30, 80, true).'</td>';
}
if ($netflow_disable_custom_lvfilters) {
echo '<td></td>';
echo '<td></td>';
} else {
echo "<td style='font-weight:bold;'>".__('Src Ip').ui_print_help_tip(__('Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249'), true).'</td>';
echo '<td>'.html_print_input_text('ip_src', $filter['ip_src'], false, 30, 80, true).'</td>';
}
echo '</tr>';
echo "<tr class='filter_normal'>";
if ($netflow_disable_custom_lvfilters) {
echo '<td></td>';
echo '<td></td>';
} else {
echo "<td style='font-weight:bold;'>".__('Dst Port').ui_print_help_tip(__('Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22'), true).'</td>';
echo '<td>'.html_print_input_text('dst_port', $filter['dst_port'], false, 30, 80, true).'</td>';
}
if ($netflow_disable_custom_lvfilters) {
echo '<td></td>';
echo '<td></td>';
} else {
echo "<td style='font-weight:bold;'>".__('Src Port').ui_print_help_tip(__('Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22'), true).'</td>';
echo '<td>'.html_print_input_text('src_port', $filter['src_port'], false, 30, 80, true).'</td>';
}
echo '</tr>';
echo "<tr class='filter_advance' style='display: none;'>";
if ($netflow_disable_custom_lvfilters) {
echo '<td></td>';
echo '<td></td>';
} else {
echo '<td>'.ui_print_help_icon('pcap_filter', true).'</td>';
echo "<td colspan='5'>".html_print_textarea('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px; width: 90%;'", true).'</td>';
}
echo '</tr>';
echo '<tr>';
echo '<td>'.'<b>'.__('Aggregate by').'</b>'.ui_print_help_icon('aggregate_by', true).'</td>';
$aggregate_list = [];
$aggregate_list = [
'none' => __('None'),
'proto' => __('Protocol'),
'srcip' => __('Src Ip Address'),
'dstip' => __('Dst Ip Address'),
'srcport' => __('Src Port'),
'dstport' => __('Dst Port'),
];
echo '<td>'.html_print_select($aggregate_list, 'aggregate', $filter['aggregate'], '', '', 0, true, false, true, '', false).'</td>';
echo '<td>'.'<b>'.__('Router ip').'</b>'.'</td>';
echo '<td>'.html_print_input_text('router_ip', $filter['router_ip'], false, 30, 80, true).'</td>';
echo '<td>'.'<b>'.__('Output format').'</b>'.'</td>';
$show_output = [
'bytes' => __('Bytes'),
'bytespersecond' => __('Bytes per second'),
'kilobytes' => __('Kilobytes'),
'megabytes' => __('Megabytes'),
'kilobytespersecond' => __('Kilobytes per second'),
'megabytespersecond' => __('Megabytes per second'),
];
echo '<td>'.html_print_select($show_output, 'output', $filter['output'], '', '', 0, true, false, true, '', false).'</td>';
echo '</tr>'; echo '</tr>';
@ -473,15 +505,14 @@ if (is_metaconsole()) {
echo '</form>'; echo '</form>';
if ($draw != '') { if ($draw != '') {
// Draw // Draw.
echo '<br/>'; echo '<br/>';
// No filter selected // No filter selected.
if ($netflow_disable_custom_lvfilters && $filter_selected == 0) { if ($netflow_disable_custom_lvfilters && $filter_selected == 0) {
ui_print_error_message(__('No filter selected')); ui_print_error_message(__('No filter selected'));
} } else {
// Draw the netflow chart // Draw the netflow chart.
else {
echo netflow_draw_item( echo netflow_draw_item(
$start_date, $start_date,
$end_date, $end_date,
@ -569,7 +600,22 @@ if (is_metaconsole()) {
return true; return true;
}; };
function toggleFilters (event) {
// Display or show the items.
var is_advanced = $("#radiobtn0001").is(':checked');
var class_name = is_advanced ? ".filter_advance" : ".filter_normal";
$(".nf_filter").not(class_name).toggle();
// Change the image.
$('#' + event.target.id).attr(
'src',
$(".nf_filter").not(class_name).first().is(':visible')
? 'images/darrowup.png'
: 'images/darrowdown.png'
);
}
// Display the appropriate filter // Display the appropriate filter
var filter_type = <?php echo $filter_type; ?>; var filter_type = <?php echo $filter_type; ?>;
if (filter_type == 0) { if (filter_type == 0) {
@ -600,7 +646,6 @@ if (is_metaconsole()) {
$("#text-router_ip").val(''); $("#text-router_ip").val('');
$("#textarea_advanced_filter").val(''); $("#textarea_advanced_filter").val('');
$("#aggregate").val(''); $("#aggregate").val('');
$("#output").val('');
// Hide update filter button // Hide update filter button
$("#submit-update_button").hide(); $("#submit-update_button").hide();
@ -669,8 +714,6 @@ if (is_metaconsole()) {
$("#textarea_advanced_filter").val(val); $("#textarea_advanced_filter").val(val);
if (i == 'aggregate') if (i == 'aggregate')
$("#aggregate").val(val); $("#aggregate").val(val);
if (i == 'output')
$("#output").val(val);
}); });
}, },
"json"); "json");
@ -704,7 +747,7 @@ if (is_metaconsole()) {
}); });
}); });
$("#text-time").timepicker({ $("#text-time, #text-time_lower").timepicker({
showSecond: true, showSecond: true,
timeFormat: '<?php echo TIME_FORMAT_JS; ?>', timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time'); ?>', timeOnlyTitle: '<?php echo __('Choose time'); ?>',
@ -715,7 +758,17 @@ if (is_metaconsole()) {
currentText: '<?php echo __('Now'); ?>', currentText: '<?php echo __('Now'); ?>',
closeText: '<?php echo __('Close'); ?>'}); closeText: '<?php echo __('Close'); ?>'});
$("#text-date").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"}); $("#text-date, #text-date_lower").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$.datepicker.regional["<?php echo get_user_language(); ?>"]; $.datepicker.regional["<?php echo get_user_language(); ?>"];
function nf_view_click_period(event) {
$(".nf_display").toggle();
$(".nf_hidden").toggle();
}
</script> </script>
<style type="text/css">
.nf_filter, .nf_hidden {
display: none;
}
</style>

View File

@ -0,0 +1,40 @@
<?php
/**
* Network explorer
*
* @package Operations.
* @subpackage Network explorer view.
*
* Pandora FMS - http://pandorafms.com
* ==================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org 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; 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.
*/
global $config;
check_login();
// ACL Check.
if (! check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Network explorer'
);
include 'general/noaccess.php';
exit;
}
$action = get_parameter('action', 'listeners');
$is_network = true;
ui_print_page_header(__('Network explorer'));
require $config['homedir'].'/operation/network/network_report.php';

View File

@ -0,0 +1,374 @@
<?php
/**
* Network explorer
*
* @package Operations.
* @subpackage Network explorer view.
*
* Pandora FMS - http://pandorafms.com
* ==================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org 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; 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.
*/
check_login();
// ACL Check.
if (! check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Network report.'
);
include 'general/noaccess.php';
exit;
}
// Include JS timepicker.
ui_include_time_picker();
// Query params and other initializations.
$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);
}
$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'])) {
$main_value = '';
}
$order_by = get_parameter('order_by', 'bytes');
if (!in_array($order_by, ['bytes', 'pkts', 'flows'])) {
$order_by = 'bytes';
}
$style_end = ($is_period) ? 'display: none;' : '';
$style_period = ($is_period) ? '' : 'display: none;';
// Build the table.
$table = new stdClass();
$table->class = 'databox';
$table->styleTable = 'width: 100%';
$table->data['0']['0'] = __('Data to show').'&nbsp;&nbsp;';
$table->data['0']['0'] .= html_print_select(
network_get_report_actions($is_network),
'action',
$action,
'',
'',
0,
true
);
$table->data['0']['1'] = __('Number of result to show').'&nbsp;&nbsp;';
$table->data['0']['1'] .= html_print_select(
[
'5' => 5,
'10' => 10,
'15' => 15,
'20' => 20,
'25' => 25,
'50' => 50,
'100' => 100,
'250' => 250,
],
'top',
$top,
'',
'',
0,
true
);
$table->data['0']['2'] = '';
$table->data['1']['0'] = '<div style="display: flex;">';
$table->data['1']['0'] .= '<div id="end_date_container" style="'.$style_end.'">';
$table->data['1']['0'] .= __('Start date').'&nbsp;&nbsp;';
$table->data['1']['0'] .= html_print_input_text('date_lower', $date_lower, '', 10, 7, true);
$table->data['1']['0'] .= '&nbsp;&nbsp;';
$table->data['1']['0'] .= html_print_input_text('time_lower', $time_lower, '', 7, 8, true);
$table->data['1']['0'] .= '</div>';
$table->data['1']['0'] .= '<div id="period_container" style="'.$style_period.'">';
$table->data['1']['0'] .= __('Time Period').'&nbsp;&nbsp;';
$table->data['1']['0'] .= html_print_extended_select_for_time('period', $period, '', '', 0, false, true);
$table->data['1']['0'] .= '</div>';
$table->data['1']['0'] .= html_print_checkbox(
'is_period',
1,
($is_period === true) ? 1 : 0,
true,
false,
'network_report_click_period(event)'
);
$table->data['1']['0'] .= ui_print_help_tip(
__('Select this checkbox to write interval instead a date.'),
true
);
$table->data['1']['0'] .= '</div>';
$table->data['1']['1'] = __('End date').'&nbsp;&nbsp;';
$table->data['1']['1'] .= html_print_input_text('date_greater', $date_greater, '', 10, 7, true);
$table->data['1']['1'] .= '&nbsp;&nbsp;';
$table->data['1']['1'] .= html_print_input_text('time_greater', $time_greater, '', 7, 8, true);
$table->data['1']['2'] = html_print_submit_button(
__('Update'),
'update',
false,
'class="sub upd"',
true
);
$table->data['1']['2'] .= '&nbsp;&nbsp;';
$table->data['1']['2'] .= html_print_submit_button(
__('Export to CSV'),
'export_csv',
false,
'class="sub next"',
true
);
echo '<form method="post">';
html_print_input_hidden('order_by', $order_by);
if (!empty($main_value)) {
html_print_input_hidden('main_value', $main_value);
}
html_print_table($table);
echo '</form>';
// Print the data.
$data = [];
if ($is_network) {
$data = network_matrix_get_top(
$top,
$action === 'talkers',
$utimestamp_lower,
$utimestamp_greater,
$main_value,
$order_by !== 'pkts'
);
} else {
$data = netflow_get_top_summary(
$top,
$action,
$utimestamp_lower,
$utimestamp_greater,
$main_value,
$order_by
);
}
// Get the params to return the builder.
$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,
'action' => $action,
];
unset($table);
$table = new stdClass();
$table->styleTable = 'width: 60%';
// Print the header.
$table->head = [];
$table->head['main'] = __('IP');
if (!$is_network) {
$table->head['flows'] = network_print_explorer_header(
__('Flows'),
'flows',
$order_by,
array_merge(
$hidden_main_link,
['main_value' => $main_value]
)
);
}
$table->head['pkts'] = network_print_explorer_header(
__('Packets'),
'pkts',
$order_by,
array_merge(
$hidden_main_link,
['main_value' => $main_value]
)
);
$table->head['bytes'] = network_print_explorer_header(
__('Bytes'),
'bytes',
$order_by,
array_merge(
$hidden_main_link,
['main_value' => $main_value]
)
);
// Add the order.
$hidden_main_link['order_by'] = $order_by;
if (get_parameter('export_csv')) {
// Clean the buffer.
while (ob_get_level()) {
ob_end_clean();
}
// Write metadata.
header('Content-type: text/csv;');
header('Content-Disposition: attachment; filename="network_data.csv"');
$div = $config['csv_divider'];
$nl = "\n";
// Print the header.
echo reset($table->head).$div;
if (!$is_network) {
echo __('Flows').$div;
}
echo __('Packets').$div;
echo __('Bytes').$div;
echo $nl;
// Print the data.
foreach ($data as $row) {
echo $row['host'].$div;
if (isset($row['sum_flows'])) {
echo $row['sum_flows'].$div;
}
echo $row['sum_pkts'].$div;
echo $row['sum_bytes'].$nl;
}
exit;
}
// Print the filter remove link.
if (!empty($main_value)) {
echo html_print_link_with_params(
in_array($action, ['udp', 'tcp']) ? __('Filtered by port %s. Click here to remove the filter.', $main_value) : __('Filtered by IP %s. Click here to remove the filter.', $main_value),
array_merge(
$hidden_main_link,
[
'main_value' => $main_value,
'remove_filter' => 1,
]
)
);
}
// Print the data and build the chart.
$table->data = [];
$chart_data = [];
$hide_filter = !empty($main_value) && ($action === 'udp' || $action === 'tcp');
foreach ($data as $item) {
$row = [];
$row['main'] = '<div class="div-v-centered">';
$row['main'] .= $item['host'];
if (!$hide_filter) {
$row['main'] .= html_print_link_with_params(
'images/filter.png',
array_merge($hidden_main_link, ['main_value' => $item['host']]),
'image'
);
}
$row['main'] .= '</div>';
if (!$is_network) {
$row['flows'] = format_for_graph($item['sum_flows'], 2);
$row['flows'] .= ' ('.$item['pct_flows'].'%)';
}
$row['pkts'] = format_for_graph($item['sum_pkts'], 2);
if (!$is_network) {
$row['pkts'] .= ' ('.$item['pct_pkts'].'%)';
}
$row['bytes'] = network_format_bytes($item['sum_bytes']);
if (!$is_network) {
$row['bytes'] .= ' ('.$item['pct_bytes'].'%)';
}
$table->data[] = $row;
// Build the pie graph data structure.
switch ($order_by) {
case 'pkts':
$chart_data[$item['host']] = $item['sum_bytes'];
break;
case 'flows':
$chart_data[$item['host']] = $item['sum_flows'];
break;
case 'bytes':
default:
$chart_data[$item['host']] = $item['sum_bytes'];
break;
}
}
if (empty($data)) {
ui_print_info_message(__('No data found'));
} else {
echo '<div style="display: flex; margin-top: 10px;">';
html_print_table($table);
// Print the graph.
echo '<div style="margin-top: 50px; width: 40%;">';
echo pie_graph(
$chart_data,
320,
200,
__('Others')
);
echo '</div>';
echo '</div>';
}
?>
<script>
// Configure jQuery timepickers.
$("#text-time_lower, #text-time_greater").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'); ?>'
});
$("#text-date_lower, #text-date_greater").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
function network_report_click_period(event) {
var is_period = document.getElementById(event.target.id).checked;
document.getElementById('period_container').style.display = !is_period ? 'none' : 'block';
document.getElementById('end_date_container').style.display = is_period ? 'none' : 'block';
}
</script>

View File

@ -0,0 +1,236 @@
<?php
/**
* Netflow functions
*
* @package Netflow usage map.
* @subpackage UI.
*
* Pandora FMS - http://pandorafms.com
* ==================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org 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; 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.
*/
require_once $config['homedir'].'/include/functions_network.php';
require_once $config['homedir'].'/include/class/NetworkMap.class.php';
global $config;
check_login();
ui_print_page_header(__('Network usage map'));
// ACL Check.
if (! check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Network usage map.'
);
include 'general/noaccess.php';
exit;
}
// Include JS timepicker.
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)));
$utimestamp_lower = ($is_period) ? ($utimestamp_greater - $period) : strtotime($date_lower.' '.$time_lower);
if (!$is_period) {
$period = ($utimestamp_greater - $utimestamp_lower);
}
$top = (int) get_parameter('top', 10);
$order_by = get_parameter('order_by', 'bytes');
if (!in_array($order_by, ['bytes', 'pkts', 'flows'])) {
$order_by = 'bytes';
}
$style_end = ($is_period) ? 'display: none;' : '';
$style_period = ($is_period) ? '' : 'display: none;';
// Build the table.
$table = new stdClass();
$table->class = 'databox';
$table->styleTable = 'width: 100%';
$table->data['0']['0'] = '<div style="display: flex;">';
$table->data['0']['0'] .= '<div id="end_date_container" style="'.$style_end.'">';
$table->data['0']['0'] .= __('Start date').'&nbsp;&nbsp;';
$table->data['0']['0'] .= html_print_input_text('date_lower', $date_lower, '', 10, 7, true);
$table->data['0']['0'] .= '&nbsp;&nbsp;';
$table->data['0']['0'] .= html_print_input_text('time_lower', $time_lower, '', 7, 8, true);
$table->data['0']['0'] .= '</div>';
$table->data['0']['0'] .= '<div id="period_container" style="'.$style_period.'">';
$table->data['0']['0'] .= __('Time Period').'&nbsp;&nbsp;';
$table->data['0']['0'] .= html_print_extended_select_for_time('period', $period, '', '', 0, false, true);
$table->data['0']['0'] .= '</div>';
$table->data['0']['0'] .= html_print_checkbox(
'is_period',
1,
($is_period === true) ? 1 : 0,
true,
false,
'network_report_click_period(event)'
);
$table->data['0']['0'] .= ui_print_help_tip(
__('Select this checkbox to write interval instead a date.'),
true
);
$table->data['0']['0'] .= '</div>';
$table->data['0']['1'] = __('End date').'&nbsp;&nbsp;';
$table->data['0']['1'] .= html_print_input_text('date_greater', $date_greater, '', 10, 7, true);
$table->data['0']['1'] .= '&nbsp;&nbsp;';
$table->data['0']['1'] .= html_print_input_text('time_greater', $time_greater, '', 7, 8, true);
$table->data['0']['2'] = __('Number of result to show').'&nbsp;&nbsp;';
$table->data['0']['2'] .= html_print_select(
[
'5' => 5,
'10' => 10,
'15' => 15,
'20' => 20,
'25' => 25,
'50' => 50,
'100' => 100,
'250' => 250,
],
'top',
$top,
'',
'',
0,
true
);
$table->data['1']['0'] = __('Data to show').'&nbsp;&nbsp;';
$table->data['1']['0'] .= html_print_select(
network_get_report_actions(),
'action',
$action,
'',
'',
0,
true
);
$table->data['1']['1'] = '';
$netflow_button = '';
if ((bool) $config['activate_netflow'] === true) {
$netflow_button = html_print_submit_button(
__('Show netflow map'),
'update_netflow',
false,
'class="sub upd"',
true
);
}
$nta_button = '';
if ((bool) $config['activate_nta'] === true) {
$nta_button = html_print_submit_button(
__('Show NTA map'),
'update_nta',
false,
'class="sub upd"',
true
);
}
$table->data['1']['2'] .= implode(
'&nbsp;&nbsp;',
[
$netflow_button,
$nta_button,
]
);
echo '<form method="post">';
html_print_input_hidden('order_by', $order_by);
html_print_table($table);
echo '</form>';
$has_data = false;
$first_load = true;
if ((bool) get_parameter('update_netflow') === true) {
$map_data = netflow_build_map_data(
$utimestamp_lower,
$utimestamp_greater,
$top,
($action === 'talkers') ? 'srcip' : 'dstip'
);
$has_data = !empty($map_data['nodes']);
$first_load = false;
} else if ((bool) get_parameter('update_nta') === true) {
$map_data = network_build_map_data(
$utimestamp_lower,
$utimestamp_greater,
$top,
$action === 'talkers'
);
$has_data = !empty($map_data['nodes']);
$first_load = false;
}
if ($has_data === true) {
$map_manager = new NetworkMap($map_data);
$map_manager->printMap();
} else if (!$first_load) {
ui_print_info_message(__('No data retrieved'));
}
?>
<script>
// Configure jQuery timepickers.
$("#text-time_lower, #text-time_greater").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'); ?>'
});
$("#text-date_lower, #text-date_greater").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
function network_report_click_period(event) {
var is_period = document.getElementById(event.target.id).checked;
document.getElementById('period_container').style.display = !is_period
? 'none'
: 'block';
document.getElementById('end_date_container').style.display = is_period
? 'none'
: 'block';
}
</script>
<style type="text/css">
tspan {
font-size: 14px !important;
}
</style>

View File

@ -2,8 +2,8 @@
# Pandora FMS Console # Pandora FMS Console
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.732 %define version 7.0NG.733
%define release 190327 %define release 1
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -2,8 +2,8 @@
# Pandora FMS Console # Pandora FMS Console
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.732 %define version 7.0NG.733
%define release 190327 %define release 1
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -9,7 +9,7 @@
# This code is licensed under GPL 2.0 license. # This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.732" PI_VERSION="7.0NG.733"
FORCE=0 FORCE=0
DESTDIR="" DESTDIR=""
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"` LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`

View File

@ -3491,6 +3491,20 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
PRIMARY KEY(`id`) PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `tnetwork_matrix`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tnetwork_matrix` (
`id` int(10) unsigned NOT NULL auto_increment,
`source` varchar(60) default '',
`destination` varchar(60) default '',
`utimestamp` bigint(20) default 0,
`bytes` int(18) unsigned default 0,
`pkts` int(18) unsigned default 0,
PRIMARY KEY (`id`),
UNIQUE (`source`, `destination`, `utimestamp`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `user_task` -- Table `user_task`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.732-190327 Version: 7.0NG.733
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -1,7 +1,7 @@
############################################################################# #############################################################################
# Pandora FMS Server Parameters # Pandora FMS Server Parameters
# Pandora FMS, the Flexible Monitoring System. # Pandora FMS, the Flexible Monitoring System.
# Version 7.0NG.732 # Version 7.0NG.733
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2017 Artica Soluciones Tecnologicas # (c) 2003-2017 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -44,7 +44,7 @@ our @EXPORT = qw(
); );
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.732"; my $pandora_version = "7.0NG.733";
my $pandora_build = "190327"; my $pandora_build = "190327";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;

View File

@ -29,6 +29,8 @@ use XML::Parser::Expat;
use XML::Simple; use XML::Simple;
use POSIX qw(setsid strftime); use POSIX qw(setsid strftime);
use IO::Uncompress::Unzip; use IO::Uncompress::Unzip;
use JSON qw(decode_json);
use MIME::Base64;
# Required for file names with accents # Required for file names with accents
use Encode qw(decode); use Encode qw(decode);
@ -222,6 +224,10 @@ sub data_consumer ($$) {
process_xml_server ($self->getConfig (), $file_name, $xml_data, $self->getDBH ()); process_xml_server ($self->getConfig (), $file_name, $xml_data, $self->getDBH ());
} elsif (defined($xml_data->{'connection_source'})) { } elsif (defined($xml_data->{'connection_source'})) {
enterprise_hook('process_xml_connections', [$self->getConfig (), $file_name, $xml_data, $self->getDBH ()]); enterprise_hook('process_xml_connections', [$self->getConfig (), $file_name, $xml_data, $self->getDBH ()]);
} elsif (defined($xml_data->{'network_matrix'})){
process_xml_matrix_network(
$self->getConfig(), $xml_data, $self->getDBH()
);
} else { } else {
process_xml_data ($self->getConfig (), $file_name, $xml_data, $self->getServerID (), $self->getDBH ()); process_xml_data ($self->getConfig (), $file_name, $xml_data, $self->getServerID (), $self->getDBH ());
} }
@ -326,6 +332,7 @@ sub process_xml_data ($$$$$) {
# Get agent id # Get agent id
my $agent_id = get_agent_id ($dbh, $agent_name); my $agent_id = get_agent_id ($dbh, $agent_name);
my $group_id = 0;
if ($agent_id < 1) { if ($agent_id < 1) {
if ($pa_config->{'autocreate'} == 0) { if ($pa_config->{'autocreate'} == 0) {
logger($pa_config, "ERROR: There is no agent defined with name $agent_name", 3); logger($pa_config, "ERROR: There is no agent defined with name $agent_name", 3);
@ -334,7 +341,7 @@ sub process_xml_data ($$$$$) {
# Get OS, group and description # Get OS, group and description
my $os = pandora_get_os ($dbh, $data->{'os_name'}); my $os = pandora_get_os ($dbh, $data->{'os_name'});
my $group_id = $pa_config->{'autocreate_group'}; $group_id = $pa_config->{'autocreate_group'};
if (! defined (get_group_name ($dbh, $group_id))) { if (! defined (get_group_name ($dbh, $group_id))) {
if (defined ($data->{'group_id'}) && $data->{'group_id'} ne '') { if (defined ($data->{'group_id'}) && $data->{'group_id'} ne '') {
$group_id = $data->{'group_id'}; $group_id = $data->{'group_id'};
@ -600,6 +607,9 @@ sub process_xml_data ($$$$$) {
# Process snmptrapd modules # Process snmptrapd modules
enterprise_hook('process_snmptrap_data', [$pa_config, $data, $server_id, $dbh]); enterprise_hook('process_snmptrap_data', [$pa_config, $data, $server_id, $dbh]);
# Process events
process_events_dataserver($pa_config, $data, $agent_id, $group_id, $dbh);
# Process disovery modules # Process disovery modules
enterprise_hook('process_discovery_data', [$pa_config, $data, $server_id, $dbh]); enterprise_hook('process_discovery_data', [$pa_config, $data, $server_id, $dbh]);
} }
@ -970,5 +980,84 @@ sub unlink_modules {
db_do($dbh, "UPDATE tagente_modulo SET parent_module_id = 0 WHERE id_agente_modulo = ?", $child_id); db_do($dbh, "UPDATE tagente_modulo SET parent_module_id = 0 WHERE id_agente_modulo = ?", $child_id);
} }
##########################################################################
# Process events in the XML.
##########################################################################
sub process_events_dataserver {
my ($pa_config, $data, $agent_id, $group_id, $dbh) = @_;
return unless defined($data->{'events'}->[0]->{'event'});
foreach my $event (@{$data->{'events'}->[0]->{'event'}}) {
next unless defined($event);
# Try to decode the base64 inside
my $event_info;
eval {
$event_info = decode_json(decode_base64($event));
};
if ($@) {
logger($pa_config, "Error processing base64 event data '$event'.", 5);
next;
}
next unless defined($event_info->{'data'});
pandora_event(
$pa_config,
$event_info->{'data'},
$group_id,
$agent_id,
defined($event_info->{'severity'}) ? $event_info->{'severity'} : 0,
0,
0,
'system',
0,
$dbh
);
}
return;
}
##########################################################################
# Process events in the XML.
##########################################################################
sub process_xml_matrix_network {
my ($pa_config, $data, $dbh) = @_;
my $utimestamp = $data->{'network_matrix'}->[0]->{'utimestamp'};
my $content = $data->{'network_matrix'}->[0]->{'content'};
return unless defined($utimestamp) && defined($content);
# Try to decode the base64 inside
my $matrix_info;
eval {
$matrix_info = decode_json(decode_base64($content));
};
if ($@) {
logger($pa_config, "Error processing base64 matrix data '$content'.", 5);
return;
}
foreach my $source (keys %$matrix_info) {
foreach my $destination (keys %{$matrix_info->{$source}}) {
my $matrix_single_data = $matrix_info->{$source}->{$destination};
$matrix_single_data->{'source'} = $source;
$matrix_single_data->{'destination'} = $destination;
$matrix_single_data->{'utimestamp'} = $utimestamp;
eval {
db_process_insert($dbh, 'id', 'tnetwork_matrix', $matrix_single_data);
};
if ($@) {
logger($pa_config, "Error inserted matrix data. Source: $source, destination: $destination, utimestamp: $utimestamp.", 5);
}
}
}
return;
}
1; 1;
__END__ __END__

View File

@ -31,7 +31,7 @@ use base 'Exporter';
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.732"; my $pandora_version = "7.0NG.733";
my $pandora_build = "190327"; my $pandora_build = "190327";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;

View File

@ -2,8 +2,8 @@
# Pandora FMS Server # Pandora FMS Server
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.732 %define version 7.0NG.733
%define release 190327 %define release 1
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
# Pandora FMS Server # Pandora FMS Server
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.732 %define version 7.0NG.733
%define release 190327 %define release 1
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -8,7 +8,7 @@
# This code is licensed under GPL 2.0 license. # This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.732" PI_VERSION="7.0NG.733"
PI_BUILD="190327" PI_BUILD="190327"
MODE=$1 MODE=$1

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.732 PS190327"; my $version = "7.0NG.733 PS190327";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;
@ -340,7 +340,7 @@ sub pandora_purgedb ($$) {
} else { } else {
my @blacklist_types = ("'SLA_services'", "'custom_graph'", "'sql_graph_vbar'", "'sql_graph_hbar'", my @blacklist_types = ("'SLA_services'", "'custom_graph'", "'sql_graph_vbar'", "'sql_graph_hbar'",
"'sql_graph_pie'", "'database_serialized'", "'sql'", "'inventory'", "'inventory_changes'", "'sql_graph_pie'", "'database_serialized'", "'sql'", "'inventory'", "'inventory_changes'",
"'netflow_area'", "'netflow_pie'", "'netflow_data'", "'netflow_statistics'", "'netflow_summary'"); "'netflow_area'", "'netflow_data'", "'netflow_summary'");
my $blacklist_types_str = join(',', @blacklist_types); my $blacklist_types_str = join(',', @blacklist_types);
# Deleted modules # Deleted modules
@ -429,10 +429,17 @@ sub pandora_purgedb ($$) {
WHERE date < CURDATE() - $conf->{'_num_past_special_days'} AND date > '0001-01-01'"); WHERE date < CURDATE() - $conf->{'_num_past_special_days'} AND date > '0001-01-01'");
} }
} }
# Delete old tgraph_source data # Delete old tgraph_source data
db_do ($dbh,"DELETE FROM tgraph_source WHERE id_graph NOT IN (SELECT id_graph FROM tgraph)"); db_do ($dbh,"DELETE FROM tgraph_source WHERE id_graph NOT IN (SELECT id_graph FROM tgraph)");
# Delete network traffic old data.
log_message ('PURGE', 'Deleting old network matrix data.');
if ($conf->{'_delete_old_network_matrix'} > 0) {
my $matrix_limit = time() - 86400 * $conf->{'_delete_old_network_matrix'};
db_do ($dbh, "DELETE FROM tnetwork_matrix WHERE utimestamp < ?", $matrix_limit);
}
# Delete old messages # Delete old messages
log_message ('PURGE', "Deleting old messages."); log_message ('PURGE', "Deleting old messages.");
if ($conf->{'_delete_old_messages'} > 0) { if ($conf->{'_delete_old_messages'} > 0) {
@ -659,6 +666,7 @@ sub pandora_load_config_pdb ($) {
$conf->{'_days_delete_unknown'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'days_delete_unknown'"); $conf->{'_days_delete_unknown'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'days_delete_unknown'");
$conf->{'_inventory_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'inventory_purge'"); $conf->{'_inventory_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'inventory_purge'");
$conf->{'_delete_old_messages'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'delete_old_messages'"); $conf->{'_delete_old_messages'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'delete_old_messages'");
$conf->{'_delete_old_network_matrix'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'delete_old_network_matrix'");
$conf->{'_enterprise_installed'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'enterprise_installed'"); $conf->{'_enterprise_installed'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'enterprise_installed'");
$conf->{'_metaconsole'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'metaconsole'"); $conf->{'_metaconsole'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'metaconsole'");
$conf->{'_metaconsole_events_history'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'metaconsole_events_history'"); $conf->{'_metaconsole_events_history'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'metaconsole_events_history'");

View File

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