mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-26 03:19:05 +02:00
Merge remote-tracking branch 'origin/develop' into ent-11471-integracion-pandora-integria
This commit is contained in:
commit
3e2c2990df
@ -11,7 +11,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
|
||||
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
|
||||
|
||||
|
||||
S_VERSION='2023050901'
|
||||
S_VERSION='2023062901'
|
||||
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
||||
|
||||
# define default variables
|
||||
@ -285,8 +285,7 @@ console_dependencies=" \
|
||||
mod_ssl \
|
||||
libzstd \
|
||||
openldap-clients \
|
||||
chromium \
|
||||
http://firefly.pandorafms.com/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
|
||||
chromium"
|
||||
execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
|
||||
|
||||
# Server dependencies
|
||||
@ -313,7 +312,6 @@ server_dependencies=" \
|
||||
bind-utils \
|
||||
whois \
|
||||
cpanminus \
|
||||
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
||||
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \
|
||||
https://firefly.pandorafms.com/centos7/pandorawmic-1.0.0-1.x86_64.rpm"
|
||||
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
|
||||
@ -341,7 +339,6 @@ execute_cmd "yum install -y $oracle_dependencies || yum reinstall -y $oracle_dep
|
||||
|
||||
#ipam dependencies
|
||||
ipam_dependencies=" \
|
||||
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
||||
perl(NetAddr::IP) \
|
||||
perl(Sys::Syslog) \
|
||||
perl(DBI) \
|
||||
@ -719,6 +716,9 @@ echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cro
|
||||
systemctl enable pandora_agent_daemon &>> $LOGFILE
|
||||
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
|
||||
|
||||
# Enable postrix
|
||||
systemctl enable postfix --now &>> "$LOGFILE"
|
||||
|
||||
#SSH banner
|
||||
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)
|
||||
|
||||
|
@ -14,7 +14,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
|
||||
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
|
||||
|
||||
|
||||
S_VERSION='2023050901'
|
||||
S_VERSION='2023062901'
|
||||
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
||||
|
||||
# define default variables
|
||||
@ -344,8 +344,7 @@ console_dependencies=" \
|
||||
http://firefly.pandorafms.com/centos8/chromium-110.0.5481.177-1.el7.x86_64.rpm \
|
||||
http://firefly.pandorafms.com/centos8/chromium-common-110.0.5481.177-1.el7.x86_64.rpm \
|
||||
http://firefly.pandorafms.com/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
|
||||
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \
|
||||
http://firefly.pandorafms.com/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
|
||||
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm"
|
||||
execute_cmd "dnf install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
|
||||
|
||||
# Server dependencies
|
||||
@ -371,7 +370,7 @@ server_dependencies=" \
|
||||
java \
|
||||
bind-utils \
|
||||
whois \
|
||||
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
||||
libnsl \
|
||||
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \
|
||||
https://firefly.pandorafms.com/centos8/pandorawmic-1.0.0-1.x86_64.rpm"
|
||||
execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
|
||||
@ -399,7 +398,6 @@ execute_cmd "dnf install -y $oracle_dependencies" "Installing Oracle Instant cli
|
||||
|
||||
#ipam dependencies
|
||||
ipam_dependencies=" \
|
||||
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
||||
perl(NetAddr::IP) \
|
||||
perl(Sys::Syslog) \
|
||||
perl(DBI) \
|
||||
@ -622,8 +620,9 @@ sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini
|
||||
sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini
|
||||
sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
|
||||
|
||||
#adding 900s to httpd timeout
|
||||
#adding 900s to httpd timeout and 300 to ProxyTimeout
|
||||
echo 'TimeOut 900' > /etc/httpd/conf.d/timeout.conf
|
||||
echo 'ProxyTimeout 300' >> /etc/httpd/conf.d/timeout.conf
|
||||
|
||||
cat > /var/www/html/index.html << EOF_INDEX
|
||||
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
|
||||
@ -787,6 +786,9 @@ echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cro
|
||||
systemctl enable pandora_agent_daemon &>> "$LOGFILE"
|
||||
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
|
||||
|
||||
# Enable postfix
|
||||
systemctl enable postfix --now &>> "$LOGFILE"
|
||||
|
||||
#SSH banner
|
||||
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)
|
||||
|
||||
|
@ -17,7 +17,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
|
||||
WORKDIR=/opt/pandora/deploy
|
||||
|
||||
|
||||
S_VERSION='2023050901'
|
||||
S_VERSION='2023062901'
|
||||
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
||||
rm -f $LOGFILE &> /dev/null # remove last log before start
|
||||
|
||||
@ -265,7 +265,6 @@ server_dependencies=" \
|
||||
openssh-client \
|
||||
postfix \
|
||||
unzip \
|
||||
xprobe \
|
||||
coreutils \
|
||||
libio-compress-perl \
|
||||
libmoosex-role-timer-perl \
|
||||
@ -287,6 +286,7 @@ server_dependencies=" \
|
||||
libgeo-ip-perl \
|
||||
arping \
|
||||
snmp-mibs-downloader \
|
||||
libnsl2 \
|
||||
openjdk-8-jdk "
|
||||
execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
|
||||
|
||||
@ -299,17 +299,7 @@ echo -en "${cyan}Installing wmic and pandorawmic...${reset}"
|
||||
chmod +x pandorawmic wmic &>> "$LOGFILE" && \
|
||||
cp -a wmic /usr/bin/ &>> "$LOGFILE" && \
|
||||
cp -a pandorawmic /usr/bin/ &>> "$LOGFILE"
|
||||
check_cmd_status "Error Installing phanromjs"
|
||||
|
||||
# phantomjs
|
||||
echo -en "${cyan}Installing phantomjs...${reset}"
|
||||
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
|
||||
export OPENSSL_CONF=/etc/ssl
|
||||
curl -LSs -O "https://firefly.pandorafms.com/pandorafms/utils/$PHANTOM_JS.tar.bz2" &>> "$LOGFILE" && \
|
||||
tar xvjf "$PHANTOM_JS.tar.bz2" &>> "$LOGFILE" && \
|
||||
mv $PHANTOM_JS/bin/phantomjs /usr/bin &>> "$LOGFILE" && \
|
||||
/usr/bin/phantomjs --version &>> "$LOGFILE"
|
||||
check_cmd_status "Error Installing phanromjs"
|
||||
check_cmd_status "Error Installing pandorawmic/wmic"
|
||||
|
||||
# create symlink for fping
|
||||
rm -f /usr/sbin/fping &>> "$LOGFILE"
|
||||
@ -370,7 +360,6 @@ source '/root/.profile' &>> "$LOGFILE"
|
||||
|
||||
#ipam dependencies
|
||||
ipam_dependencies=" \
|
||||
xprobe \
|
||||
libnetaddr-ip-perl \
|
||||
coreutils \
|
||||
libdbd-mysql-perl \
|
||||
@ -619,8 +608,9 @@ sed --follow-symlinks -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.i
|
||||
sed --follow-symlinks -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
|
||||
sed --follow-symlinks -i -e "s/^disable_functions/;disable_functions/" /etc/php.ini
|
||||
|
||||
#adding 900s to httpd timeout
|
||||
#echo 'TimeOut 900' > /etc/httpd/conf.d/timeout.conf
|
||||
#adding 900s to httpd timeout and 300 to ProxyTimeout
|
||||
echo 'TimeOut 900' > /etc/apache2/conf-enabled/timeout.conf
|
||||
echo 'ProxyTimeout 300' >> /etc/apache2/conf-enabled/timeout.conf
|
||||
|
||||
cat > /var/www/html/index.html << EOF_INDEX
|
||||
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
|
||||
@ -792,6 +782,9 @@ systemctl enable pandora_agent_daemon &>> "$LOGFILE"
|
||||
#fix path phantomjs
|
||||
sed --follow-symlinks -i -e "s/^openssl_conf = openssl_init/#openssl_conf = openssl_init/g" /etc/ssl/openssl.cnf &>> "$LOGFILE"
|
||||
|
||||
# Enable postfix
|
||||
systemctl enable postfix --now &>> "$LOGFILE"
|
||||
|
||||
#SSH banner
|
||||
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.772-230718
|
||||
Version: 7.0NG.772-230720
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.772-230718"
|
||||
pandora_version="7.0NG.772-230720"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -1031,7 +1031,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.772';
|
||||
use constant AGENT_BUILD => '230718';
|
||||
use constant AGENT_BUILD => '230720';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.772
|
||||
%define release 230718
|
||||
%define release 230720
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.772
|
||||
%define release 230718
|
||||
%define release 230720
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.772"
|
||||
PI_BUILD="230718"
|
||||
PI_BUILD="230720"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{230718}
|
||||
{230720}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.772 Build 230718")
|
||||
#define PANDORA_VERSION ("7.0NG.772 Build 230720")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.772(Build 230718))"
|
||||
VALUE "ProductVersion", "(7.0NG.772(Build 230720))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.772-230718
|
||||
Version: 7.0NG.772-230720
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.772-230718"
|
||||
pandora_version="7.0NG.772-230720"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -1,5 +1,23 @@
|
||||
START TRANSACTION;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tnetwork_explorer_filter` (
|
||||
`id` INT NOT NULL,
|
||||
`filter_name` VARCHAR(45) NULL,
|
||||
`top` VARCHAR(45) NULL,
|
||||
`action` VARCHAR(45) NULL,
|
||||
`advanced_filter` TEXT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tnetwork_usage_filter` (
|
||||
`id` INT NOT NULL auto_increment,
|
||||
`filter_name` VARCHAR(45) NULL,
|
||||
`top` VARCHAR(45) NULL,
|
||||
`action` VARCHAR(45) NULL,
|
||||
`advanced_filter` TEXT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
ALTER TABLE `tlayout`
|
||||
ADD COLUMN `grid_color` VARCHAR(45) NOT NULL DEFAULT '#cccccc' AFTER `maintenance_mode`,
|
||||
ADD COLUMN `grid_size` VARCHAR(45) NOT NULL DEFAULT '10' AFTER `grid_color`;
|
||||
|
@ -210,7 +210,7 @@ if (is_ajax() === true) {
|
||||
|
||||
// Ldapsearch timeout.
|
||||
// Default Ldapsearch timeout.
|
||||
set_when_empty($config['ldap_searh_timeout'], 5);
|
||||
set_when_empty($config['ldap_search_timeout'], 5);
|
||||
$row = [];
|
||||
$row['name'] = __('Ldap search timeout (secs)');
|
||||
$row['control'] = html_print_input_text(
|
||||
@ -558,7 +558,13 @@ echo '</form>';
|
||||
if ($('input[type=checkbox][name=secondary_ldap_enabled]:checked').val() == 1) {
|
||||
$("tr[id*='ldap_'][id$='_secondary']").show();
|
||||
} else {
|
||||
$( "tr[id*='ldap_'][id$='_secondary']" ).hide();
|
||||
$( "tr[id*='ldap_'][id$='_secondary']" ).hide();
|
||||
}
|
||||
|
||||
if ($('input[type=checkbox][name=secondary_active_directory]:checked').val() == 1) {
|
||||
$("tr[id*='ad_'][id$='_secondary']").show();
|
||||
} else {
|
||||
$( "tr[id*='ad_'][id$='_secondary']" ).hide();
|
||||
}
|
||||
}
|
||||
$( document ).ready(function() {
|
||||
|
BIN
pandora_console/images/widgets/netflow.png
Normal file
BIN
pandora_console/images/widgets/netflow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
@ -237,8 +237,13 @@ function process_user_login_remote($login, $pass, $api=false)
|
||||
|
||||
// Active Directory.
|
||||
case 'ad':
|
||||
if (enterprise_hook('ad_process_user_login', [$login, $pass]) === false) {
|
||||
$config['auth_error'] = 'User not found in database or incorrect password';
|
||||
$sr = enterprise_hook('ad_process_user_login', [$login, $pass]);
|
||||
// Try with secondary server.
|
||||
if ($sr === false && (bool) $config['secondary_active_directory'] === true) {
|
||||
$sr = enterprise_hook('ad_process_user_login', [$login, $pass, true]);
|
||||
}
|
||||
|
||||
if ($sr === false) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
@ -1807,7 +1807,8 @@ class ConsoleSupervisor
|
||||
$this->cleanNotifications('NOTIF.PHP.SERIALIZE_PRECISION');
|
||||
}
|
||||
|
||||
if (version_compare('8.1', PHP_VERSION) >= 0) {
|
||||
// If PHP_VERSION is lower than 8.0.27 version_compare() returns 1.
|
||||
if (version_compare('8.0.27', PHP_VERSION) === 1) {
|
||||
$url = 'https://www.php.net/supported-versions.php';
|
||||
$this->notify(
|
||||
[
|
||||
|
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC230718';
|
||||
$build_version = 'PC230720';
|
||||
$pandora_version = 'v7.0NG.772';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -2770,6 +2770,69 @@ function agents_delete_agent($id_agents, $disableACL=false)
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
enterprise_hook('agent_delete_from_cache', [$id_agent]);
|
||||
|
||||
// Delete agent from visual console.
|
||||
db_process_sql_delete(
|
||||
'tlayout_data',
|
||||
['id_agent' => $id_agent]
|
||||
);
|
||||
|
||||
// Delete agent from visual dashboards.
|
||||
db_process_sql(
|
||||
'UPDATE twidget_dashboard
|
||||
SET options = NULL
|
||||
WHERE options LIKE ("%\"agentid\":\"'.$id_agent.'\"%")'
|
||||
);
|
||||
|
||||
// Delete agent from treport.
|
||||
db_process_sql_delete(
|
||||
'treport_content',
|
||||
['id_agent' => $id_agent]
|
||||
);
|
||||
|
||||
// Delete rules from tevent alerts (correlative alerts)
|
||||
db_process_sql_delete(
|
||||
'tevent_rule',
|
||||
[
|
||||
'agent' => $id_agent,
|
||||
'operator_agent' => '==',
|
||||
]
|
||||
);
|
||||
|
||||
db_process_sql_delete(
|
||||
'tevent_rule',
|
||||
[
|
||||
'log_agent' => $id_agent,
|
||||
'operator_log_agent' => '==',
|
||||
]
|
||||
);
|
||||
|
||||
// Delete from gis maps history
|
||||
db_process_sql_delete(
|
||||
'tgis_data_history',
|
||||
['tagente_id_agente' => $id_agent]
|
||||
);
|
||||
|
||||
// Delete from policies.
|
||||
db_process_sql_delete(
|
||||
'tpolicy_agents',
|
||||
['id_agent' => $id_agent]
|
||||
);
|
||||
|
||||
// Delete from tnetwork maps
|
||||
db_process_sql_delete(
|
||||
'titem',
|
||||
['source_data' => $id_agent]
|
||||
);
|
||||
|
||||
db_process_sql_delete(
|
||||
'trel_item',
|
||||
[
|
||||
'id_parent_source_data' => $id_agent,
|
||||
'id_child_source_data' => $id_agent,
|
||||
],
|
||||
'OR'
|
||||
);
|
||||
|
||||
// Delete agent from fav menu.
|
||||
db_process_sql_delete(
|
||||
'tfavmenu_user',
|
||||
|
@ -627,6 +627,30 @@ function config_update_config()
|
||||
$error_update[] = __('Domain');
|
||||
}
|
||||
|
||||
if (config_update_value('secondary_active_directory', get_parameter('secondary_active_directory'), true) === false) {
|
||||
$error_update[] = __('Secondary active directory');
|
||||
}
|
||||
|
||||
if (config_update_value('ad_server_secondary', get_parameter('ad_server_secondary'), true) === false) {
|
||||
$error_update[] = __('Secondary active directory server');
|
||||
}
|
||||
|
||||
if (config_update_value('ad_port_secondary', get_parameter('ad_port_secondary'), true) === false) {
|
||||
$error_update[] = __('Secondary active directory port');
|
||||
}
|
||||
|
||||
if (config_update_value('ad_start_tls_secondary', get_parameter('ad_start_tls_secondary'), true) === false) {
|
||||
$error_update[] = __('Secondary start TLS');
|
||||
}
|
||||
|
||||
if (config_update_value('ad_search_timeout', get_parameter('ad_search_timeout'), true) === false) {
|
||||
$error_update[] = __('AD search timeout');
|
||||
}
|
||||
|
||||
if (config_update_value('ad_domain_secondary', get_parameter('ad_domain_secondary'), true) === false) {
|
||||
$error_update[] = __('Secondary domain');
|
||||
}
|
||||
|
||||
if (config_update_value('ad_adv_perms', get_parameter('ad_adv_perms'), true) === false) {
|
||||
$error_update[] = __('Advanced Permisions AD');
|
||||
}
|
||||
@ -3100,6 +3124,14 @@ function config_process_config()
|
||||
config_update_value('ad_port', 389);
|
||||
}
|
||||
|
||||
if (!isset($config['ad_server_secondary'])) {
|
||||
config_update_value('ad_server_secondary', 'localhost');
|
||||
}
|
||||
|
||||
if (!isset($config['ad_port_secondary'])) {
|
||||
config_update_value('ad_port_secondary', 389);
|
||||
}
|
||||
|
||||
if (!isset($config['ad_start_tls'])) {
|
||||
config_update_value('ad_start_tls', 0);
|
||||
}
|
||||
|
@ -4407,7 +4407,10 @@ function graph_netflow_circular_mesh($data)
|
||||
|
||||
include_once $config['homedir'].'/include/graphs/functions_d3.php';
|
||||
|
||||
return d3_relationship_graph($data['elements'], $data['matrix'], 900, true);
|
||||
$width = (empty($data['width']) === false) ? $data['width'] : 900;
|
||||
$height = (empty($data['height']) === false) ? $data['height'] : 900;
|
||||
|
||||
return d3_relationship_graph($data['elements'], $data['matrix'], $width, true, $height);
|
||||
}
|
||||
|
||||
|
||||
@ -4766,19 +4769,18 @@ function graph_monitor_wheel($width=550, $height=600, $filter=false)
|
||||
$filter_module_group = (!empty($filter) && !empty($filter['module_group'])) ? $filter['module_group'] : false;
|
||||
|
||||
if ($filter['group'] != 0) {
|
||||
$filter_subgroups = '';
|
||||
if (!$filter['dont_show_subgroups']) {
|
||||
$filter_subgroups = ' || parent IN ('.$filter['group'].')';
|
||||
if ($filter['dont_show_subgroups'] === false) {
|
||||
$groups = groups_get_children($filter['group']);
|
||||
$groups_ax = [];
|
||||
foreach ($groups as $g) {
|
||||
$groups_ax[$g['id_grupo']] = $g;
|
||||
}
|
||||
|
||||
$groups = $groups_ax;
|
||||
} else {
|
||||
$groups = groups_get_group_by_id($filter['group']);
|
||||
$groups[$group['id_grupo']] = $group;
|
||||
}
|
||||
|
||||
$groups = db_get_all_rows_sql('SELECT * FROM tgrupo where id_grupo IN ('.$filter['group'].') '.$filter_subgroups);
|
||||
|
||||
$groups_ax = [];
|
||||
foreach ($groups as $g) {
|
||||
$groups_ax[$g['id_grupo']] = $g;
|
||||
}
|
||||
|
||||
$groups = $groups_ax;
|
||||
} else {
|
||||
$groups = users_get_groups(false, 'AR', false, true, (!empty($filter) && isset($filter['group']) ? $filter['group'] : null));
|
||||
}
|
||||
|
@ -1233,7 +1233,9 @@ function netflow_draw_item(
|
||||
$max_aggregates,
|
||||
$connection_name='',
|
||||
$output='HTML',
|
||||
$address_resolution=false
|
||||
$address_resolution=false,
|
||||
$width_content=false,
|
||||
$height_content=false
|
||||
) {
|
||||
$aggregate = $filter['aggregate'];
|
||||
$interval = ($end_date - $start_date);
|
||||
@ -1432,6 +1434,9 @@ function netflow_draw_item(
|
||||
netflow_aggregate_is_ip($aggregate)
|
||||
);
|
||||
|
||||
$data_circular['width'] = $width_content;
|
||||
$data_circular['height'] = $height_content;
|
||||
|
||||
$html = '<div class="center">';
|
||||
$html .= graph_netflow_circular_mesh($data_circular);
|
||||
$html .= '</div>';
|
||||
@ -1734,7 +1739,12 @@ function netflow_get_top_summary(
|
||||
switch ($top_action) {
|
||||
case 'listeners':
|
||||
if (empty(!$filter)) {
|
||||
$netflow_filter['ip_src'] = $filter;
|
||||
if (!is_array($filter)) {
|
||||
$netflow_filter['ip_src'] = $filter;
|
||||
} else {
|
||||
$netflow_filter['ip_src'] = $filter['ip'];
|
||||
$netflow_filter['advanced_filter'] = $filter['advanced_filter'];
|
||||
}
|
||||
}
|
||||
|
||||
$sort = 'dstip';
|
||||
@ -1742,7 +1752,12 @@ function netflow_get_top_summary(
|
||||
|
||||
case 'talkers':
|
||||
if (empty(!$filter)) {
|
||||
$netflow_filter['ip_dst'] = $filter;
|
||||
if (!is_array($filter)) {
|
||||
$netflow_filter['ip_dst'] = $filter;
|
||||
} else {
|
||||
$netflow_filter['ip_dst'] = $filter['ip'];
|
||||
$netflow_filter['advanced_filter'] = $filter['advanced_filter'];
|
||||
}
|
||||
}
|
||||
|
||||
$sort = 'srcip';
|
||||
@ -2069,7 +2084,7 @@ function netflow_aggregate_is_ip($aggregate)
|
||||
*
|
||||
* @return array With map structure.
|
||||
*/
|
||||
function netflow_build_map_data($start_date, $end_date, $top, $aggregate)
|
||||
function netflow_build_map_data($start_date, $end_date, $top, $aggregate, $advanced_filter='')
|
||||
{
|
||||
// Pass an empty filter data structure.
|
||||
$data = netflow_get_relationships_raw_data(
|
||||
@ -2083,7 +2098,7 @@ function netflow_build_map_data($start_date, $end_date, $top, $aggregate)
|
||||
'ip_src' => '',
|
||||
'dst_port' => '',
|
||||
'src_port' => '',
|
||||
'advanced_filter' => '',
|
||||
'advanced_filter' => $advanced_filter,
|
||||
'router_ip' => '',
|
||||
],
|
||||
$top,
|
||||
|
@ -57,7 +57,7 @@ function include_javascript_d3($return=false)
|
||||
}
|
||||
|
||||
|
||||
function d3_relationship_graph($elements, $matrix, $width=700, $return=false)
|
||||
function d3_relationship_graph($elements, $matrix, $width=700, $return=false, $height=700)
|
||||
{
|
||||
global $config;
|
||||
|
||||
@ -72,7 +72,7 @@ function d3_relationship_graph($elements, $matrix, $width=700, $return=false)
|
||||
$output = '<div id="chord_diagram"></div>';
|
||||
$output .= include_javascript_d3(true);
|
||||
$output .= "<script language=\"javascript\" type=\"text/javascript\">
|
||||
chordDiagram('#chord_diagram', $elements, $matrix, $width);
|
||||
chordDiagram('#chord_diagram', $elements, $matrix, $width, $height);
|
||||
</script>";
|
||||
|
||||
if (!$return) {
|
||||
|
@ -22,7 +22,7 @@
|
||||
// matrix = [[0, 0, 2], // a[a => a, a => b, a => c]
|
||||
// [5, 0, 1], // b[b => a, b => b, b => c]
|
||||
// [2, 3, 0]]; // c[c => a, c => b, c => c]
|
||||
function chordDiagram(recipient, elements, matrix, width) {
|
||||
function chordDiagram(recipient, elements, matrix, width, height) {
|
||||
d3.chart = d3.chart || {};
|
||||
d3.chart.chordWheel = function(options) {
|
||||
// Default values
|
||||
@ -59,10 +59,13 @@ function chordDiagram(recipient, elements, matrix, width) {
|
||||
.enter()
|
||||
.append("svg:svg")
|
||||
.attr("width", width)
|
||||
.attr("height", width)
|
||||
.attr("height", height)
|
||||
.attr("class", "dependencyWheel")
|
||||
.append("g")
|
||||
.attr("transform", "translate(" + width / 2 + "," + width / 2 + ")");
|
||||
.attr(
|
||||
"transform",
|
||||
"translate(" + width / 2 + "," + height / 2 + ") scale(1.2)"
|
||||
);
|
||||
|
||||
var arc = d3.svg
|
||||
.arc()
|
||||
@ -206,8 +209,8 @@ function chordDiagram(recipient, elements, matrix, width) {
|
||||
.on("mousemove", move_tooltip);
|
||||
|
||||
function move_tooltip(d) {
|
||||
x = d3.event.pageX + 10;
|
||||
y = d3.event.pageY + 10;
|
||||
x = d3.event.layerX + 10;
|
||||
y = d3.event.layerY + 10;
|
||||
|
||||
$("#tooltip").css("left", x + "px");
|
||||
$("#tooltip").css("top", y + "px");
|
||||
|
@ -416,6 +416,10 @@ class Widget
|
||||
$className .= '\OsQuickReportWidget';
|
||||
break;
|
||||
|
||||
case 'netflow':
|
||||
$className .= '\Netflow';
|
||||
break;
|
||||
|
||||
case 'GroupedMeterGraphs':
|
||||
case 'ColorModuleTabs':
|
||||
case 'BlockHistogram':
|
||||
|
465
pandora_console/include/lib/Dashboard/Widgets/netflow.php
Normal file
465
pandora_console/include/lib/Dashboard/Widgets/netflow.php
Normal file
@ -0,0 +1,465 @@
|
||||
<?php
|
||||
/**
|
||||
* Widget Netflow Pandora FMS Console
|
||||
*
|
||||
* @category Console Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage Widget Netflow
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 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 for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
namespace PandoraFMS\Dashboard;
|
||||
|
||||
/**
|
||||
* Netflow.
|
||||
*/
|
||||
class Netflow extends Widget
|
||||
{
|
||||
|
||||
/**
|
||||
* Name widget.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Title widget.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Page widget;
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $page;
|
||||
|
||||
/**
|
||||
* Class name widget.
|
||||
*
|
||||
* @var [type]
|
||||
*/
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* Values options for each widget.
|
||||
*
|
||||
* @var [type]
|
||||
*/
|
||||
protected $values;
|
||||
|
||||
/**
|
||||
* Configuration required.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $configurationRequired;
|
||||
|
||||
/**
|
||||
* Error load widget.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $loadError;
|
||||
|
||||
/**
|
||||
* Width.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $width;
|
||||
|
||||
/**
|
||||
* Heigth.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $height;
|
||||
|
||||
/**
|
||||
* Grid Width.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $gridWidth;
|
||||
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param integer $cellId Cell ID.
|
||||
* @param integer $dashboardId Dashboard ID.
|
||||
* @param integer $widgetId Widget ID.
|
||||
* @param integer|null $width New width.
|
||||
* @param integer|null $height New height.
|
||||
* @param integer|null $gridWidth Grid width.
|
||||
*/
|
||||
public function __construct(
|
||||
int $cellId,
|
||||
int $dashboardId=0,
|
||||
int $widgetId=0,
|
||||
?int $width=0,
|
||||
?int $height=0,
|
||||
?int $gridWidth=0
|
||||
) {
|
||||
global $config;
|
||||
|
||||
// Includes.
|
||||
include_once $config['homedir'].'/include/functions_graph.php';
|
||||
include_once $config['homedir'].'/include/class/NetworkMap.class.php';
|
||||
// WARNING: Do not edit. This chunk must be in the constructor.
|
||||
parent::__construct(
|
||||
$cellId,
|
||||
$dashboardId,
|
||||
$widgetId
|
||||
);
|
||||
|
||||
// Width.
|
||||
$this->width = $width;
|
||||
|
||||
// Height.
|
||||
$this->height = $height;
|
||||
|
||||
// Grid Width.
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
||||
// Page.
|
||||
$this->page = basename(__FILE__);
|
||||
|
||||
// ClassName.
|
||||
$class = new \ReflectionClass($this);
|
||||
$this->className = $class->getShortName();
|
||||
|
||||
// Title.
|
||||
$this->title = __('Netflow');
|
||||
|
||||
// Name.
|
||||
if (empty($this->name) === true) {
|
||||
$this->name = 'netflow';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
* @return array Of inputs.
|
||||
*
|
||||
* @throws Exception On error.
|
||||
*/
|
||||
public function getFormInputs(): array
|
||||
{
|
||||
$values = $this->values;
|
||||
|
||||
// Retrieve global - common inputs.
|
||||
$inputs = parent::getFormInputs();
|
||||
|
||||
// Default values.
|
||||
if (isset($values['quantity']) === false) {
|
||||
$values['quantity'] = 5;
|
||||
}
|
||||
|
||||
// Default values.
|
||||
if (isset($values['period']) === false) {
|
||||
$values['period'] = SECONDS_1WEEK;
|
||||
}
|
||||
|
||||
// Default values.
|
||||
if (isset($values['max_values']) === false) {
|
||||
$values['max_values'] = 10;
|
||||
}
|
||||
|
||||
// Period.
|
||||
$inputs[] = [
|
||||
'label' => __('Interval'),
|
||||
'arguments' => [
|
||||
'name' => 'period',
|
||||
'type' => 'interval',
|
||||
'value' => $values['period'],
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
],
|
||||
];
|
||||
$chart_types = netflow_get_chart_types();
|
||||
$chart_types['usage_map'] = __('Usage map');
|
||||
$inputs[] = [
|
||||
'label' => __('Type graph'),
|
||||
'arguments' => [
|
||||
'name' => 'chart_type',
|
||||
'type' => 'select',
|
||||
'fields' => $chart_types,
|
||||
'selected' => $values['chart_type'],
|
||||
],
|
||||
];
|
||||
|
||||
$aggregate_list = [
|
||||
'srcip' => __('Src Ip Address'),
|
||||
'dstip' => __('Dst Ip Address'),
|
||||
'srcport' => __('Src Port'),
|
||||
'dstport' => __('Dst Port'),
|
||||
];
|
||||
$inputs[] = [
|
||||
'label' => __('Aggregated by'),
|
||||
'id' => 'aggregated',
|
||||
'arguments' => [
|
||||
'name' => 'aggregate',
|
||||
'type' => 'select',
|
||||
'fields' => $aggregate_list,
|
||||
'selected' => $values['aggregate'],
|
||||
],
|
||||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Data to show'),
|
||||
'id' => 'data_to_show',
|
||||
'arguments' => [
|
||||
'name' => 'action',
|
||||
'type' => 'select',
|
||||
'fields' => network_get_report_actions(),
|
||||
'selected' => $values['action'],
|
||||
],
|
||||
];
|
||||
|
||||
$max_values = [
|
||||
'2' => '2',
|
||||
'5' => '5',
|
||||
'10' => '10',
|
||||
'15' => '15',
|
||||
'20' => '20',
|
||||
'25' => '25',
|
||||
'50' => '50',
|
||||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Max values'),
|
||||
'arguments' => [
|
||||
'name' => 'max_values',
|
||||
'type' => 'select',
|
||||
'fields' => $max_values,
|
||||
'selected' => $values['max_values'],
|
||||
],
|
||||
];
|
||||
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Post for widget.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPost():array
|
||||
{
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::getPost();
|
||||
|
||||
$values['period'] = \get_parameter('period', 0);
|
||||
$values['chart_type'] = \get_parameter('chart_type', '');
|
||||
$values['aggregate'] = \get_parameter('aggregate');
|
||||
$values['max_values'] = \get_parameter('max_values', 10);
|
||||
$values['action'] = \get_parameter('action', 'srcip');
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw widget.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
ui_require_css_file('netflow_widget', 'include/styles/', true);
|
||||
global $config;
|
||||
|
||||
$output = '';
|
||||
|
||||
$size = parent::getSize();
|
||||
|
||||
$start_date = (time() - $this->values['period']);
|
||||
$end_date = time();
|
||||
if ($this->values['chart_type'] === 'usage_map') {
|
||||
$map_data = netflow_build_map_data(
|
||||
$start_date,
|
||||
$end_date,
|
||||
$this->values['max_values'],
|
||||
($this->values['action'] === 'talkers') ? 'srcip' : 'dstip'
|
||||
);
|
||||
$has_data = !empty($map_data['nodes']);
|
||||
|
||||
if ($has_data === true) {
|
||||
$map_manager = new \NetworkMap($map_data);
|
||||
$map_manager->printMap();
|
||||
} else {
|
||||
ui_print_info_message(__('No data to show'));
|
||||
}
|
||||
} else {
|
||||
$netflowContainerClass = ($this->values['chart_type'] === 'netflow_data' || $this->values['chart_type'] === 'netflow_summary' || $this->values['chart_type'] === 'netflow_top_N') ? '' : 'white_box';
|
||||
$filter = [
|
||||
'aggregate' => $this->values['aggregate'],
|
||||
'netflow_monitoring_interval' => 300,
|
||||
];
|
||||
|
||||
$output .= html_print_input_hidden(
|
||||
'selected_style_theme',
|
||||
$config['style'],
|
||||
true
|
||||
);
|
||||
$style = 'width:100%; height: 100%; border: none;';
|
||||
if ($this->values['chart_type'] !== 'netflow_area') {
|
||||
$style .= ' width: 95%;';
|
||||
}
|
||||
|
||||
if ($size['width'] > $size['height']) {
|
||||
$size['width'] = $size['height'];
|
||||
}
|
||||
|
||||
// Draw the netflow chart.
|
||||
$output .= html_print_div(
|
||||
[
|
||||
'class' => $netflowContainerClass,
|
||||
'style' => $style,
|
||||
'content' => netflow_draw_item(
|
||||
$start_date,
|
||||
$end_date,
|
||||
12,
|
||||
$this->values['chart_type'],
|
||||
$filter,
|
||||
$this->values['max_values'],
|
||||
'',
|
||||
'HTML',
|
||||
0,
|
||||
($size['width'] - 50),
|
||||
($size['height'] - 20),
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return aux javascript code for forms.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormJS()
|
||||
{
|
||||
return '
|
||||
$(document).ready(function(){
|
||||
//Limit 1 week
|
||||
$("#period_select option").each(function(key, element){
|
||||
if(element.value > 604800){
|
||||
$(element).remove();
|
||||
}
|
||||
})
|
||||
$("#period_manual option").each(function(key, element){
|
||||
if(element.value > 604800){
|
||||
$(element).remove();
|
||||
}
|
||||
});
|
||||
$("#period_manual input").on("change", function(e){
|
||||
if($("#hidden-period").val() > 604800) {
|
||||
$(this).val(1);
|
||||
$("#hidden-period").val(604800);
|
||||
$("#period_manual select option").removeAttr("selected");
|
||||
setTimeout(() => {
|
||||
$("#period_default select option[value=\'604800\']").attr("selected", "selected");
|
||||
$("#period_manual select option[value=\'604800\']").attr("selected", "selected");
|
||||
$("#period_manual select").val(604800);
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
if($("#chart_type").val() === "usage_map") {
|
||||
$("#data_to_show").show();
|
||||
$("#aggregated").hide();
|
||||
} else {
|
||||
$("#data_to_show").hide();
|
||||
$("#aggregated").show();
|
||||
}
|
||||
$("#chart_type").on("change", function(e){
|
||||
if(this.value === "usage_map") {
|
||||
$("#data_to_show").show();
|
||||
$("#aggregated").hide();
|
||||
} else {
|
||||
$("#data_to_show").hide();
|
||||
$("#aggregated").show();
|
||||
}
|
||||
});
|
||||
});
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get description.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public static function getDescription()
|
||||
{
|
||||
return __('Netflow');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Name.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public static function getName()
|
||||
{
|
||||
return 'netflow';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get size Modal Configuration.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSizeModalConfiguration(): array
|
||||
{
|
||||
$size = [
|
||||
'width' => 400,
|
||||
'height' => 530,
|
||||
];
|
||||
|
||||
return $size;
|
||||
}
|
||||
|
||||
|
||||
}
|
13
pandora_console/include/styles/netflow_widget.css
Normal file
13
pandora_console/include/styles/netflow_widget.css
Normal file
@ -0,0 +1,13 @@
|
||||
.menu_graph {
|
||||
display: none;
|
||||
}
|
||||
.parent_graph {
|
||||
width: 97% !important;
|
||||
}
|
||||
#image_hide_show_labels {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.select2-search--dropdown .select2-search__field {
|
||||
padding: 0px !important;
|
||||
}
|
@ -712,7 +712,6 @@ if (isset($config['id_user']) === false) {
|
||||
login_check_failed($nick);
|
||||
}
|
||||
|
||||
$config['auth_error'] = __('User is blocked');
|
||||
$login_failed = true;
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@
|
||||
<div style='padding-bottom: 50px'>
|
||||
<?php
|
||||
$version = '7.0NG.772';
|
||||
$build = '230718';
|
||||
$build = '230720';
|
||||
$banner = "v$version Build $build";
|
||||
error_reporting(0);
|
||||
|
||||
|
@ -205,9 +205,15 @@ if ($edit_networkmap) {
|
||||
|
||||
$button = [];
|
||||
if ($edit_networkmap === true) {
|
||||
if (empty($method) === false && $method === 'radial_dinamic') {
|
||||
$url = 'index.php?sec=network&sec2=operation/agentes/networkmap.dinamic&activeTab=radial_dynamic&id_networkmap='.$id;
|
||||
} else {
|
||||
$url = 'index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap='.$id;
|
||||
}
|
||||
|
||||
$button['map'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap='.$id.'">'.html_print_image(
|
||||
'text' => '<a href="'.$url.'">'.html_print_image(
|
||||
'images/network@svg.svg',
|
||||
true,
|
||||
[
|
||||
|
@ -39,10 +39,26 @@ if (! check_acl($config['id_user'], 0, 'AR')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Ajax callbacks.
|
||||
if (is_ajax() === true) {
|
||||
$get_filter_values = get_parameter('get_filter_values', 0);
|
||||
// Get values of the current network filter.
|
||||
if ($get_filter_values) {
|
||||
$id = get_parameter('id');
|
||||
$filter_values = db_get_row_filter('tnetwork_explorer_filter', ['id' => $id]);
|
||||
// Decode HTML entities.
|
||||
$filter_values['advanced_filter'] = io_safe_output($filter_values['advanced_filter']);
|
||||
echo json_encode($filter_values);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Include JS timepicker.
|
||||
ui_include_time_picker();
|
||||
|
||||
// Query params and other initializations.
|
||||
$filter_id = (int) get_parameter('filter_id', 0);
|
||||
$time_greater = get_parameter('time_greater', date(TIME_FORMAT));
|
||||
$date_greater = get_parameter('date_greater', date(DATE_FORMAT));
|
||||
$utimestamp_greater = strtotime($date_greater.' '.$time_greater);
|
||||
@ -59,6 +75,13 @@ $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 = '';
|
||||
} else {
|
||||
$filter['ip'] = $main_value;
|
||||
}
|
||||
|
||||
$advanced_filter = get_parameter('advanced_filter', '');
|
||||
if ($advanced_filter !== '') {
|
||||
$filter['advanced_filter'] = $advanced_filter;
|
||||
}
|
||||
|
||||
$order_by = get_parameter('order_by', 'bytes');
|
||||
@ -66,30 +89,143 @@ if (!in_array($order_by, ['bytes', 'pkts', 'flows'])) {
|
||||
$order_by = 'bytes';
|
||||
}
|
||||
|
||||
$style_end = ($is_period) ? 'display: none;' : '';
|
||||
$style_period = ($is_period) ? '' : 'display: none;';
|
||||
$save = get_parameter('save_button', '');
|
||||
$update = get_parameter('update_button', '');
|
||||
|
||||
// Save user defined filter.
|
||||
if ($save != '' && check_acl($config['id_user'], 0, 'AW')) {
|
||||
// Save filter args.
|
||||
$data['filter_name'] = get_parameter('filter_name');
|
||||
$data['top'] = $top;
|
||||
$data['action'] = $action;
|
||||
$data['advanced_filter'] = $advanced_filter;
|
||||
|
||||
|
||||
$filter_id = db_process_sql_insert('tnetwork_explorer_filter', $data);
|
||||
if ($filter_id === false) {
|
||||
$filter_id = 0;
|
||||
ui_print_error_message(__('Error creating filter'));
|
||||
} else {
|
||||
ui_print_success_message(__('Filter created successfully'));
|
||||
}
|
||||
} else if ($update != '' && check_acl($config['id_user'], 0, 'AW')) {
|
||||
// Update current filter.
|
||||
// Do not update the filter name and group.
|
||||
$data['top'] = $top;
|
||||
$data['action'] = $action;
|
||||
$data['advanced_filter'] = $advanced_filter;
|
||||
|
||||
$result = db_process_sql_update(
|
||||
'tnetwork_explorer_filter',
|
||||
$data,
|
||||
['id' => $filter_id]
|
||||
);
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Filter updated successfully'),
|
||||
__('Error updating filter')
|
||||
);
|
||||
}
|
||||
|
||||
// Build the table.
|
||||
$table = new stdClass();
|
||||
$table->class = 'filter-table-adv';
|
||||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$filterTable = new stdClass();
|
||||
$filterTable->id = '';
|
||||
$filterTable->class = 'filter-table-adv';
|
||||
$filterTable->size = [];
|
||||
$filterTable->size[0] = '33%';
|
||||
$filterTable->size[1] = '33%';
|
||||
$filterTable->size[2] = '33%';
|
||||
$filterTable->data = [];
|
||||
|
||||
$table->data[0][] = html_print_label_input_block(
|
||||
__('Data to show'),
|
||||
html_print_select(
|
||||
network_get_report_actions(false),
|
||||
'action',
|
||||
$action,
|
||||
$filterTable->data[0][0] = html_print_label_input_block(
|
||||
__('Interval'),
|
||||
html_print_extended_select_for_time(
|
||||
'period',
|
||||
$period,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
true
|
||||
),
|
||||
[ 'div_id' => 'period_container' ]
|
||||
);
|
||||
|
||||
$filterTable->data[0][0] .= html_print_label_input_block(
|
||||
__('Start date'),
|
||||
html_print_div(
|
||||
[
|
||||
'class' => '',
|
||||
'content' => html_print_input_text(
|
||||
'date_lower',
|
||||
$date_lower,
|
||||
false,
|
||||
13,
|
||||
10,
|
||||
true
|
||||
).html_print_image(
|
||||
'images/calendar_view_day.png',
|
||||
true,
|
||||
[
|
||||
'alt' => 'calendar',
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
).html_print_input_text(
|
||||
'time_lower',
|
||||
$time_lower,
|
||||
false,
|
||||
10,
|
||||
8,
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
),
|
||||
[ 'div_id' => 'end_date_container' ]
|
||||
);
|
||||
|
||||
$filterTable->data[0][1] = html_print_label_input_block(
|
||||
__('End date'),
|
||||
html_print_div(
|
||||
[
|
||||
'content' => html_print_input_text(
|
||||
'date',
|
||||
$date_greater,
|
||||
false,
|
||||
13,
|
||||
10,
|
||||
true
|
||||
).html_print_image(
|
||||
'images/calendar_view_day.png',
|
||||
true,
|
||||
['alt' => 'calendar']
|
||||
).html_print_input_text(
|
||||
'time',
|
||||
$time_greater,
|
||||
false,
|
||||
10,
|
||||
8,
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[0][] = html_print_label_input_block(
|
||||
__('Number of result to show'),
|
||||
$filterTable->data[0][2] = html_print_label_input_block(
|
||||
__('Defined period'),
|
||||
html_print_checkbox_switch(
|
||||
'is_period',
|
||||
1,
|
||||
($is_period === true) ? 1 : 0,
|
||||
true,
|
||||
false,
|
||||
'nf_view_click_period()'
|
||||
)
|
||||
);
|
||||
|
||||
$filterTable->data[1][] = html_print_label_input_block(
|
||||
__('Results to show'),
|
||||
html_print_select(
|
||||
[
|
||||
'5' => 5,
|
||||
@ -110,95 +246,62 @@ $table->data[0][] = html_print_label_input_block(
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[1][] = html_print_label_input_block(
|
||||
__('Start date'),
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'end_date_container',
|
||||
'content' => html_print_input_text(
|
||||
'date_lower',
|
||||
$date_lower,
|
||||
'',
|
||||
10,
|
||||
10,
|
||||
true
|
||||
).html_print_input_text(
|
||||
'time_lower',
|
||||
$time_lower,
|
||||
'',
|
||||
7,
|
||||
8,
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
).html_print_div(
|
||||
[
|
||||
'id' => 'period_container',
|
||||
'style' => 'display: none;',
|
||||
'content' => html_print_label_input_block(
|
||||
'',
|
||||
html_print_extended_select_for_time(
|
||||
'period',
|
||||
$period,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
true
|
||||
),
|
||||
),
|
||||
],
|
||||
$filterTable->data[1][] = html_print_label_input_block(
|
||||
__('Data to show'),
|
||||
html_print_select(
|
||||
network_get_report_actions(),
|
||||
'action',
|
||||
$action,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[1][] = html_print_label_input_block(
|
||||
__('End date'),
|
||||
html_print_div(
|
||||
[
|
||||
'id' => '',
|
||||
'class' => '',
|
||||
'content' => html_print_input_text(
|
||||
'date_greater',
|
||||
$date_greater,
|
||||
'',
|
||||
10,
|
||||
10,
|
||||
true
|
||||
).html_print_input_text(
|
||||
'time_greater',
|
||||
$time_greater,
|
||||
'',
|
||||
7,
|
||||
8,
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
)
|
||||
$advanced_toggle = new stdClass();
|
||||
$advanced_toggle->class = 'filter-table-adv';
|
||||
$advanced_toggle->size = [];
|
||||
$advanced_toggle->size[0] = '50%';
|
||||
$advanced_toggle->size[1] = '50%';
|
||||
$advanced_toggle->width = '100%';
|
||||
$user_groups = users_get_groups($config['id_user'], 'AR', $own_info['is_admin'], true);
|
||||
$user_groups[0] = 0;
|
||||
// Add all groups.
|
||||
$sql = 'SELECT * FROM tnetwork_explorer_filter';
|
||||
$advanced_toggle->data[0][0] = html_print_label_input_block(
|
||||
__('Load Filter'),
|
||||
html_print_select_from_sql($sql, 'filter_id', $filter_id, '', __('Select a filter'), 0, true, false, true, false, 'width:100%;')
|
||||
);
|
||||
|
||||
$table->data[2][] = html_print_label_input_block(
|
||||
__('Defined period'),
|
||||
html_print_checkbox_switch(
|
||||
'is_period',
|
||||
1,
|
||||
($is_period === true) ? 1 : 0,
|
||||
$advanced_toggle->data[0][1] = html_print_label_input_block(
|
||||
__('Filter name'),
|
||||
html_print_input_text('filter_name', '', false, 40, 45, true, false, false, '', 'w100p')
|
||||
);
|
||||
$advanced_toggle->colspan[1][0] = 2;
|
||||
$advanced_toggle->data[1][0] = html_print_label_input_block(
|
||||
__('Filter').ui_print_help_icon('pcap_filter', true),
|
||||
html_print_textarea('advanced_filter', 4, 10, $advanced_filter, 'style="width:100%"', true)
|
||||
);
|
||||
$filterTable->colspan[2][0] = 3;
|
||||
$filterTable->data[2][0] = html_print_label_input_block(
|
||||
'',
|
||||
ui_toggle(
|
||||
html_print_table($advanced_toggle, true),
|
||||
__('Advanced'),
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
'network_report_click_period(event)'
|
||||
true,
|
||||
'',
|
||||
'white-box-content',
|
||||
'box-flat white_table_graph'
|
||||
)
|
||||
);
|
||||
|
||||
echo '<form method="post">';
|
||||
html_print_input_hidden('order_by', $order_by);
|
||||
if (empty($main_value) === false) {
|
||||
html_print_input_hidden('main_value', $main_value);
|
||||
}
|
||||
|
||||
$outputTable = html_print_table($table, true);
|
||||
$outputTable .= html_print_div(
|
||||
$filterInputTable = '<form method="POST">';
|
||||
$filterInputTable .= html_print_input_hidden('order_by', $order_by);
|
||||
$filterInputTable .= html_print_table($filterTable, true);
|
||||
$filterInputTable .= html_print_div(
|
||||
[
|
||||
'class' => 'action-buttons-right-forced',
|
||||
'content' => html_print_submit_button(
|
||||
@ -210,19 +313,48 @@ $outputTable .= html_print_div(
|
||||
'mode' => 'mini',
|
||||
],
|
||||
true
|
||||
).html_print_submit_button(
|
||||
__('Save as new filter'),
|
||||
'save_button',
|
||||
false,
|
||||
[
|
||||
'icon' => 'load',
|
||||
'onClick' => 'return defineFilterName();',
|
||||
'mode' => 'mini secondary',
|
||||
'class' => 'mrgn_right_10px',
|
||||
],
|
||||
true
|
||||
).html_print_submit_button(
|
||||
__('Update current filter'),
|
||||
'update_button',
|
||||
false,
|
||||
[
|
||||
'icon' => 'load',
|
||||
'mode' => 'mini secondary',
|
||||
'class' => 'mrgn_right_10px',
|
||||
],
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
$filterInputTable .= html_print_div(
|
||||
[
|
||||
'class' => 'action-buttons',
|
||||
'content' => $netflow_button,
|
||||
],
|
||||
true
|
||||
);
|
||||
$filterInputTable .= '</form>';
|
||||
ui_toggle(
|
||||
$outputTable,
|
||||
'<span class="subsection_header_title">'.__('Filters').'</span>',
|
||||
__('Filters'),
|
||||
'',
|
||||
$filterInputTable,
|
||||
'<span class="subsection_header_title">'.__('Filter').'</span>',
|
||||
__('Filter'),
|
||||
'search',
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
'white-box-content',
|
||||
'white-box-content no_border',
|
||||
'box-flat white_table_graph fixed_filter_bar'
|
||||
);
|
||||
html_print_action_buttons(
|
||||
@ -246,7 +378,7 @@ $data = netflow_get_top_summary(
|
||||
$action,
|
||||
$utimestamp_lower,
|
||||
$utimestamp_greater,
|
||||
$main_value,
|
||||
$filter,
|
||||
$order_by
|
||||
);
|
||||
|
||||
@ -450,6 +582,26 @@ if (empty($data)) {
|
||||
|
||||
?>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
nf_view_click_period();
|
||||
|
||||
$('#filter_id').change(function(){
|
||||
jQuery.post (
|
||||
"ajax.php",
|
||||
{
|
||||
"page" : "operation/network/network_report",
|
||||
"get_filter_values" : 1,
|
||||
"id": $(this).val(),
|
||||
},
|
||||
function (data) {
|
||||
$('#action').val(data.action).trigger('change');
|
||||
$('#top').val(data.top).trigger('change');
|
||||
$('#textarea_advanced_filter').val(data.advanced_filter);
|
||||
$('select#filter_id').select2('close');
|
||||
}, 'json');
|
||||
});
|
||||
});
|
||||
|
||||
// Configure jQuery timepickers.
|
||||
$("#text-time_lower, #text-time_greater").timepicker({
|
||||
showSecond: true,
|
||||
@ -472,4 +624,11 @@ function network_report_click_period(event) {
|
||||
document.getElementById('period_container').style.display = !is_period ? 'none' : 'block';
|
||||
document.getElementById('end_date_container').style.display = is_period ? 'none' : 'block';
|
||||
}
|
||||
|
||||
function nf_view_click_period() {
|
||||
var is_period = document.getElementById('checkbox-is_period').checked;
|
||||
|
||||
document.getElementById('period_container').style.display = !is_period ? 'none' : 'flex';
|
||||
document.getElementById('end_date_container').style.display = is_period ? 'none' : 'flex';
|
||||
}
|
||||
</script>
|
||||
|
@ -34,6 +34,21 @@ global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
// Ajax callbacks.
|
||||
if (is_ajax() === true) {
|
||||
$get_filter_values = get_parameter('get_filter_values', 0);
|
||||
// Get values of the current network filter.
|
||||
if ($get_filter_values) {
|
||||
$id = get_parameter('id');
|
||||
$filter_values = db_get_row_filter('tnetwork_usage_filter', ['id' => $id]);
|
||||
// Decode HTML entities.
|
||||
$filter_values['advanced_filter'] = io_safe_output($filter_values['advanced_filter']);
|
||||
echo json_encode($filter_values);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Header.
|
||||
ui_print_standard_header(
|
||||
__('Network usage map'),
|
||||
@ -76,6 +91,7 @@ $is_period = (bool) get_parameter('is_period', false);
|
||||
$period = (int) get_parameter('period', SECONDS_1HOUR);
|
||||
$time_lower = get_parameter('time_lower', date(TIME_FORMAT, ($utimestamp_greater - $period)));
|
||||
$date_lower = get_parameter('date_lower', date(DATE_FORMAT, ($utimestamp_greater - $period)));
|
||||
$advanced_filter = get_parameter('advanced_filter', '');
|
||||
$utimestamp_lower = ($is_period) ? ($utimestamp_greater - $period) : strtotime($date_lower.' '.$time_lower);
|
||||
if (!$is_period) {
|
||||
$period = ($utimestamp_greater - $utimestamp_lower);
|
||||
@ -88,6 +104,44 @@ if (in_array($order_by, ['bytes', 'pkts', 'flows']) === false) {
|
||||
$order_by = 'bytes';
|
||||
}
|
||||
|
||||
$save = get_parameter('save_button', '');
|
||||
$update = get_parameter('update_button', '');
|
||||
|
||||
// Save user defined filter.
|
||||
if ($save != '' && check_acl($config['id_user'], 0, 'AW')) {
|
||||
// Save filter args.
|
||||
$data['filter_name'] = get_parameter('filter_name');
|
||||
$data['top'] = $top;
|
||||
$data['action'] = $action;
|
||||
$data['advanced_filter'] = $advanced_filter;
|
||||
|
||||
|
||||
$filter_id = db_process_sql_insert('tnetwork_usage_filter', $data);
|
||||
if ($filter_id === false) {
|
||||
$filter_id = 0;
|
||||
ui_print_error_message(__('Error creating filter'));
|
||||
} else {
|
||||
ui_print_success_message(__('Filter created successfully'));
|
||||
}
|
||||
} else if ($update != '' && check_acl($config['id_user'], 0, 'AW')) {
|
||||
// Update current filter.
|
||||
// Do not update the filter name and group.
|
||||
$data['top'] = $top;
|
||||
$data['action'] = $action;
|
||||
$data['advanced_filter'] = $advanced_filter;
|
||||
|
||||
$result = db_process_sql_update(
|
||||
'tnetwork_usage_filter',
|
||||
$data,
|
||||
['id' => $filter_id]
|
||||
);
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Filter updated successfully'),
|
||||
__('Error updating filter')
|
||||
);
|
||||
}
|
||||
|
||||
if ((bool) $config['activate_netflow'] === true) {
|
||||
$netflow_button = html_print_submit_button(
|
||||
__('Show netflow map'),
|
||||
@ -95,6 +149,27 @@ if ((bool) $config['activate_netflow'] === true) {
|
||||
false,
|
||||
['icon' => 'update'],
|
||||
true
|
||||
).html_print_submit_button(
|
||||
__('Save as new filter'),
|
||||
'save_button',
|
||||
false,
|
||||
[
|
||||
'icon' => 'load',
|
||||
'onClick' => 'return defineFilterName();',
|
||||
'mode' => 'mini secondary',
|
||||
'class' => 'mrgn_right_10px',
|
||||
],
|
||||
true
|
||||
).html_print_submit_button(
|
||||
__('Update current filter'),
|
||||
'update_button',
|
||||
false,
|
||||
[
|
||||
'icon' => 'load',
|
||||
'mode' => 'mini secondary',
|
||||
'class' => 'mrgn_right_10px',
|
||||
],
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$netflow_button = '';
|
||||
@ -232,6 +307,44 @@ $filterTable->data[1][] = html_print_label_input_block(
|
||||
)
|
||||
);
|
||||
|
||||
$advanced_toggle = new stdClass();
|
||||
$advanced_toggle->class = 'filter-table-adv';
|
||||
$advanced_toggle->size = [];
|
||||
$advanced_toggle->size[0] = '50%';
|
||||
$advanced_toggle->size[1] = '50%';
|
||||
$advanced_toggle->width = '100%';
|
||||
$user_groups = users_get_groups($config['id_user'], 'AR', $own_info['is_admin'], true);
|
||||
$user_groups[0] = 0;
|
||||
$sql = 'SELECT * FROM tnetwork_usage_filter';
|
||||
$advanced_toggle->data[0][0] = html_print_label_input_block(
|
||||
__('Load Filter'),
|
||||
html_print_select_from_sql($sql, 'filter_id', $filter_id, '', __('Select a filter'), 0, true, false, true, false, 'width:100%;')
|
||||
);
|
||||
$advanced_toggle->data[0][1] = html_print_label_input_block(
|
||||
__('Filter name'),
|
||||
html_print_input_text('filter_name', '', false, 40, 45, true, false, false, '', 'w100p')
|
||||
);
|
||||
$advanced_toggle->colspan[1][0] = 2;
|
||||
$advanced_toggle->data[1][0] = html_print_label_input_block(
|
||||
__('Filter').ui_print_help_icon('pcap_filter', true),
|
||||
html_print_textarea('advanced_filter', 4, 10, $advanced_filter, 'style="width:100%"', true)
|
||||
);
|
||||
$filterTable->colspan[2][0] = 3;
|
||||
$filterTable->data[2][0] = html_print_label_input_block(
|
||||
'',
|
||||
ui_toggle(
|
||||
html_print_table($advanced_toggle, true),
|
||||
__('Advanced'),
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
'white-box-content',
|
||||
'box-flat white_table_graph'
|
||||
)
|
||||
);
|
||||
|
||||
$filterInputTable = '<form method="POST">';
|
||||
$filterInputTable .= html_print_input_hidden('order_by', $order_by);
|
||||
$filterInputTable .= html_print_table($filterTable, true);
|
||||
@ -263,7 +376,8 @@ if ((bool) get_parameter('update_netflow') === true) {
|
||||
$utimestamp_lower,
|
||||
$utimestamp_greater,
|
||||
$top,
|
||||
($action === 'talkers') ? 'srcip' : 'dstip'
|
||||
($action === 'talkers') ? 'srcip' : 'dstip',
|
||||
$advanced_filter
|
||||
);
|
||||
$has_data = !empty($map_data['nodes']);
|
||||
}
|
||||
@ -283,10 +397,26 @@ if ($has_data === true) {
|
||||
</style>
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
nf_view_click_period();
|
||||
}
|
||||
);
|
||||
$(document).ready(function(){
|
||||
nf_view_click_period();
|
||||
|
||||
$('#filter_id').change(function(){
|
||||
jQuery.post (
|
||||
"ajax.php",
|
||||
{
|
||||
"page" : "operation/network/network_usage_map",
|
||||
"get_filter_values" : 1,
|
||||
"id": $(this).val(),
|
||||
},
|
||||
function (data) {
|
||||
$('#action').val(data.action).trigger('change');
|
||||
$('#top').val(data.top).trigger('change');
|
||||
$('#textarea_advanced_filter').val(data.advanced_filter);
|
||||
$('select#filter_id').select2('close');
|
||||
}, 'json');
|
||||
});
|
||||
});
|
||||
|
||||
// Configure jQuery timepickers.
|
||||
$("#text-time_lower, #text-time_greater").timepicker({
|
||||
showSecond: true,
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.772
|
||||
%define release 230718
|
||||
%define release 230720
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.772
|
||||
%define release 230718
|
||||
%define release 230720
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.772
|
||||
%define release 230718
|
||||
%define release 230720
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -4329,3 +4329,27 @@ CREATE TABLE IF NOT EXISTS `tsesion_filter_log_viewer` (
|
||||
`graph_type` INT NULL,
|
||||
PRIMARY KEY (`id_filter`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tnetwork_explorer_filter`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tnetwork_explorer_filter` (
|
||||
`id` INT NOT NULL,
|
||||
`filter_name` VARCHAR(45) NULL,
|
||||
`top` VARCHAR(45) NULL,
|
||||
`action` VARCHAR(45) NULL,
|
||||
`advanced_filter` TEXT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tnetwork_usage_filter`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tnetwork_usage_filter` (
|
||||
`id` INT NOT NULL auto_increment,
|
||||
`filter_name` VARCHAR(45) NULL,
|
||||
`top` VARCHAR(45) NULL,
|
||||
`action` VARCHAR(45) NULL,
|
||||
`advanced_filter` TEXT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 7.0NG.772-230718
|
||||
Version: 7.0NG.772-230720
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.772-230718"
|
||||
pandora_version="7.0NG.772-230720"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.772";
|
||||
my $pandora_build = "230718";
|
||||
my $pandora_build = "230720";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -1040,8 +1040,12 @@ sub pandora_execute_alert {
|
||||
$event_generated = 1;
|
||||
$monitoring_event_custom_data = $custom_data;
|
||||
}
|
||||
|
||||
|
||||
if($alert_mode == FIRED_ALERT || ($alert_mode == RECOVERED_ALERT && $action->{'recovered'} == 0)) {
|
||||
pandora_execute_action ($pa_config, $data, $agent, $alert, $alert_mode, $action, $module, $dbh, $timestamp, $extra_macros, $monitoring_event_custom_data);
|
||||
}else{
|
||||
logger ($pa_config, "Skipping recover action " . safe_output($action->{'name'}) . " for alert '" . safe_output($alert->{'name'}) . "' module '" . safe_output($module->{'nombre'}) . "'.", 10);
|
||||
}
|
||||
|
||||
if($alert_mode == RECOVERED_ALERT) {
|
||||
# Reset action thresholds and set recovered
|
||||
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.772";
|
||||
my $pandora_build = "230718";
|
||||
my $pandora_build = "230720";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.772
|
||||
%define release 230718
|
||||
%define release 230720
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.772
|
||||
%define release 230718
|
||||
%define release 230720
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -9,7 +9,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.772"
|
||||
PI_BUILD="230718"
|
||||
PI_BUILD="230720"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
||||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.772 Build 230718";
|
||||
my $version = "7.0NG.772 Build 230720";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
@ -760,7 +760,53 @@ sub pandora_checkdb_integrity {
|
||||
|
||||
# Delete orphan data_inc reference records
|
||||
db_do ($dbh, 'DELETE FROM tagente_datos_inc WHERE id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_modulo)');
|
||||
|
||||
|
||||
# Delete orphan data from visual console.
|
||||
log_message ('INTEGRITY', "Deleting orphan visual console items.");
|
||||
db_do ($dbh, 'DELETE FROM tlayout_data WHERE id_agent NOT IN (SELECT id_agente FROM tagente)');
|
||||
db_do ($dbh, 'DELETE FROM tlayout_data WHERE id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_modulo)');
|
||||
|
||||
# Delete orphan data form deleted agents.
|
||||
# Clearl orphan data from dashboards
|
||||
log_message ('INTEGRITY', "Deleting orphan dahsboard items.");
|
||||
my @agents_ids = get_db_rows($dbh, 'SELECT id_agente FROM tagente');
|
||||
my $where_condition;
|
||||
foreach my $agent_id (@agents_ids) {
|
||||
$where_condition .= 'options NOT LIKE ("%\\"agentid\\":\\"'.$agent_id->{'id_agente'}.'\\"%")';
|
||||
if($agent_id == $agents_ids[-1]) {
|
||||
last;
|
||||
}
|
||||
$where_condition .= ' AND ';
|
||||
}
|
||||
|
||||
db_do ($dbh, 'UPDATE twidget_dashboard set options = NULL WHERE '.$where_condition);
|
||||
|
||||
$where_condition = '';
|
||||
my @modules = get_db_rows($dbh, 'SELECT id_agente_modulo FROM tagente_modulo');
|
||||
foreach my $id_agente_modulo (@modules) {
|
||||
$where_condition .= 'options NOT LIKE ("%\\"moduleId\\":\\"'.$id_agente_modulo->{'id_agente_modulo'}.'\\"%")';
|
||||
if($id_agente_modulo == $modules[-1]) {
|
||||
last;
|
||||
}
|
||||
$where_condition .= ' AND ';
|
||||
}
|
||||
|
||||
db_do ($dbh, 'UPDATE twidget_dashboard set options = NULL WHERE '.$where_condition);
|
||||
|
||||
# Delete orphan data from favorite agents
|
||||
log_message ('INTEGRITY', "Deleting orphan favories items.");
|
||||
db_do ($dbh, 'DELETE FROM tfavmenu_user WHERE section = "Agents" AND id_element NOT IN (SELECT id_agente FROM tagente)');
|
||||
|
||||
# Delete orphan data from gis maps
|
||||
log_message ('INTEGRITY', "Deleting orphan GIS data.");
|
||||
db_do ($dbh, 'DELETE FROM tgis_data_history WHERE tagente_id_agente NOT IN (SELECT id_agente FROM tagente)');
|
||||
|
||||
# Delete orphan tnetwork maps data
|
||||
log_message ('INTEGRITY', "Deleting orphan networkmaps data.");
|
||||
db_do ($dbh, 'DELETE FROM titem WHERE source_data NOT IN (SELECT id_agente FROM tagente)');
|
||||
db_do ($dbh, 'DELETE FROM trel_item WHERE id_parent_source_data NOT IN (SELECT id_agente FROM tagente) OR id_child_source_data NOT IN (SELECT id_agente FROM tagente)');
|
||||
|
||||
|
||||
# Check enterprise tables
|
||||
enterprise_hook ('pandora_checkdb_integrity_enterprise', [$conf, $dbh]);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
||||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.772 Build 230718";
|
||||
my $version = "7.0NG.772 Build 230720";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user