Merge branch 'develop' into 'ent-11931-made-selector-de-modulo-donde-se-activa-made-monitoring-anomaly-detection-engine'

# Conflicts:
#   pandora_console/extras/mr/66.sql
This commit is contained in:
Luis 2023-09-25 14:08:43 +00:00
commit 086835765d
95 changed files with 2765 additions and 898 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,169 @@
#
#Pandora FMS Linux Agent
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230919
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: ArticaST <http://www.artica.es>
Source0: %{source_name}-%{version}.tar.gz
URL: http://pandorafms.org
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: x86_64
Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: coreutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl-interpreter
Requires: perl-IO-Compress
Requires: libnsl
AutoReq: 0
Provides: %{name}-%{version}
%description
Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n unix
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
install -m 0644 pandora_agent_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_agent
if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
fi
%clean
rm -Rf $RPM_BUILD_ROOT
%pre
getent passwd pandora >/dev/null || \
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
exit 0
chown pandora:root /var/log/pandora
%post
if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora
fi
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
fi
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
else
[[ ! -f /etc/pandora/pandora_agent.conf.rpmnew ]] && ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
fi
if [ ! -e /etc/pandora/plugins ]; then
ln -s /usr/share/pandora_agent/plugins /etc/pandora
fi
if [ ! -e /etc/pandora/collections ]; then
mkdir -p /usr/share/pandora_agent/collections
ln -s /usr/share/pandora_agent/collections /etc/pandora
fi
if [ ! -e /etc/pandora/commands ]; then
mkdir -p /usr/share/pandora_agent/commands
ln -s /usr/share/pandora_agent/commands /etc/pandora
fi
mkdir -p /var/spool/pandora/data_out
if [ ! -d /var/log/pandora ]; then
mkdir -p /var/log/pandora
fi
if [ `command -v systemctl` ];
then
echo "Copying new version of pandora_agent_daemon service"
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
# Enable the services on SystemD
systemctl enable pandora_agent_daemon.service
else
/sbin/chkconfig --add pandora_agent_daemon
/sbin/chkconfig pandora_agent_daemon on
fi
if [ "$1" -gt 1 ]
then
echo "If Pandora Agent daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
%preun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
/sbin/chkconfig --del pandora_agent_daemon
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
# Remove symbolic links
pushd /etc/pandora
for f in pandora_agent.conf plugins collections
do
[ -L $f ] && rm -f $f
done
exit 0
%files
%defattr(750,root,root)
/usr/bin/pandora_agent
%defattr(755,pandora,root)
%{prefix}/pandora_agent
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent

View File

@ -0,0 +1,170 @@
#
#Pandora FMS Linux Agent
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230919
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: ArticaST <http://www.artica.es>
Source0: %{source_name}-%{version}.tar.gz
URL: http://pandorafms.org
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: x86_64
Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: coreutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl-interpreter
Requires: perl-IO-Compress
Requires: libnsl
Requires: libxcrypt-compat
AutoReq: 0
Provides: %{name}-%{version}
%description
Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n unix
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
install -m 0644 pandora_agent_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_agent
if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
fi
%clean
rm -Rf $RPM_BUILD_ROOT
%pre
getent passwd pandora >/dev/null || \
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
exit 0
chown pandora:root /var/log/pandora
%post
if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora
fi
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
fi
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
else
[[ ! -f /etc/pandora/pandora_agent.conf.rpmnew ]] && ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
fi
if [ ! -e /etc/pandora/plugins ]; then
ln -s /usr/share/pandora_agent/plugins /etc/pandora
fi
if [ ! -e /etc/pandora/collections ]; then
mkdir -p /usr/share/pandora_agent/collections
ln -s /usr/share/pandora_agent/collections /etc/pandora
fi
if [ ! -e /etc/pandora/commands ]; then
mkdir -p /usr/share/pandora_agent/commands
ln -s /usr/share/pandora_agent/commands /etc/pandora
fi
mkdir -p /var/spool/pandora/data_out
if [ ! -d /var/log/pandora ]; then
mkdir -p /var/log/pandora
fi
if [ `command -v systemctl` ];
then
echo "Copying new version of pandora_agent_daemon service"
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
# Enable the services on SystemD
systemctl enable pandora_agent_daemon.service
else
/sbin/chkconfig --add pandora_agent_daemon
/sbin/chkconfig pandora_agent_daemon on
fi
if [ "$1" -gt 1 ]
then
echo "If Pandora Agent daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
%preun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
/sbin/chkconfig --del pandora_agent_daemon
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
# Remove symbolic links
pushd /etc/pandora
for f in pandora_agent.conf plugins collections
do
[ -L $f ] && rm -f $f
done
exit 0
%files
%defattr(750,root,root)
/usr/bin/pandora_agent
%defattr(755,pandora,root)
%{prefix}/pandora_agent
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230907
%define release 230925
Summary: Pandora FMS Linux agent, binary version
Name: %{name}
@ -26,6 +26,7 @@ Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: coreutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl
#Requires: libnsl
AutoReq: 0
Provides: %{name}-%{version}

View File

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

View File

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

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230907}
{230925}
ViewReadme
{Yes}

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
-- Active: 1685706586212@@172.16.0.2@3306@pandora
START TRANSACTION;
ALTER TABLE tevent_filter ADD private_filter_user text NULL;
ALTER TABLE `ttrap` ADD COLUMN `utimestamp` INT UNSIGNED NOT NULL DEFAULT 0;
UPDATE ttrap SET utimestamp=UNIX_TIMESTAMP(timestamp);
@ -26,6 +27,11 @@ UPDATE tnetwork_component SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
ALTER TABLE tagente_modulo ADD COLUMN `made_enabled` TINYINT UNSIGNED DEFAULT 0;
ALTER TABLE tpolicy_modules ADD COLUMN `made_enabled` TINYINT UNSIGNED DEFAULT 0;
ALTER TABLE talert_templates
ADD COLUMN `time_window` ENUM ('thirty_days','this_month','seven_days','this_week','one_day','today'),
ADD COLUMN `math_function` ENUM ('avg', 'min', 'max', 'sum'),
ADD COLUMN `condition` ENUM ('lower', 'greater', 'equal'),
MODIFY COLUMN `type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always', 'not_normal', 'complex');
ALTER TABLE `tsesion_filter_log_viewer`
CHANGE COLUMN `date_range` `custom_date` INT NULL DEFAULT NULL ,
@ -49,4 +55,27 @@ ADD COLUMN `time_init` VARCHAR(45) NULL AFTER `date_init`,
ADD COLUMN `date_end` VARCHAR(45) NULL AFTER `time_init`,
ADD COLUMN `time_end` VARCHAR(45) NULL AFTER `date_end`;
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.vmware';
-- Insert new Proxmox APP
SET @short_name = 'pandorafms.proxmox';
SET @name = 'Proxmox';
SET @section = 'app';
SET @description = 'Monitor&#x20;Proxmox&#x20;VMs,&#x20;LXC,&#x20;backups&#x20;and&#x20;nodes&#x20;from&#x20;a&#x20;specific&#x20;host';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_proxmox');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;-g&#x20;&#039;__taskGroup__&#039;&#x20;--host&#x20;&#039;_host_&#039;&#x20;--port&#x20;&#039;_port_&#039;&#x20;--user&#x20;&#039;_user_&#039;&#x20;--password&#x20;&#039;_password_&#039;&#x20;--vm&#x20;&#039;_scanVM_&#039;&#x20;--lxc&#x20;&#039;_scanLXC_&#039;&#x20;--backups&#x20;&#039;_scanBackups_&#039;&#x20;--nodes&#x20;&#039;_scanNodes_&#039;&#x20;--transfer_mode&#x20;tentacle&#x20;--tentacle_address&#x20;&#039;_tentacleIP_&#039;&#x20;--tentacle_port&#x20;&#039;_tentaclePort_&#039;&#x20;--as_discovery_plugin&#x20;1');
ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `status_of_check` TINYTEXT;
ALTER TABLE `tservice` ADD COLUMN `enable_horizontal_tree` TINYINT NOT NULL DEFAULT 0;
COMMIT;

View File

@ -352,6 +352,21 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$display_counter = 'display:none';
}
$header_setup = '';
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$header_setup .= '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general').'">';
$header_setup .= html_print_image(
'images/configuration@svg.svg',
true,
[
'alt' => __('Setup'),
'class' => 'bot invert_filter main_menu_icon',
'title' => __('Setup'),
]
);
$header_setup .= '</a></div>';
}
$header_autorefresh = '<div id="header_autorefresh">';
$header_autorefresh .= $autorefresh_link_open_img;
$header_autorefresh .= $autorefresh_img;
@ -428,7 +443,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
);
// Logout.
$header_logout = '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
$header_logout = '<div id="header_logout"><a onClick=\'if (!confirm("'.__('Are you sure?').'")) return false;\' class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
$header_logout .= html_print_image(
'images/sign_out@header.svg',
true,
@ -454,7 +469,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
} else {
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
<div class="header_center">'.$header_searchbar.'</div>
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $header_welcome, $servers_list, $modal_help, $header_user, $header_logout.'</div>';
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $header_welcome, $servers_list, $modal_help, $header_setup, $header_user, $header_logout.'</div>';
}
?>
</div> <!-- Closes #table_header_inner -->

View File

@ -437,7 +437,7 @@ if ($id_agente) {
[
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=alert&amp;id_agente='.$id_agente,
'content' => html_print_image(
'images/alert@svg.svg',
'images/add-alert.svg',
true,
[
'title' => __('Alerts'),

View File

@ -811,7 +811,7 @@ foreach ($simple_alerts as $alert) {
$data[3] .= '<tr class="datos2">';
$data[3] .= '<td class="w50p">'.html_print_label_input_block(
__('Agent'),
ui_print_truncate_text($alias, 'agent_small', false, true, true, '[&hellip;]')
ui_print_truncate_text($alias, 'agent_medium', false, true, true, '[&hellip;]')
).'</td>';
$data[3] .= '<td class="w50p">'.html_print_label_input_block(
__('Module'),

View File

@ -374,6 +374,9 @@ function update_template($step)
$max = (float) get_parameter('max');
$min = (float) get_parameter('min');
$matches = (bool) get_parameter('matches_value');
$math_function = (string) get_parameter('math_function');
$condition = (string) get_parameter('condition');
$time_window = (string) get_parameter('time_window');
$default_action = (int) get_parameter('default_action');
if (empty($default_action) === true) {
@ -394,6 +397,9 @@ function update_template($step)
'min_value' => $min,
'matches_value' => $matches,
'disable_event' => $disable_event,
'math_function' => $math_function,
'condition' => $condition,
'time_window' => $time_window,
];
$result = alerts_update_alert_template($id, $values);
@ -607,6 +613,9 @@ if ($id && ! $create_template) {
$max = $template['max_value'];
$min = $template['min_value'];
$matches = $template['matches_value'];
$math_function = $template['math_function'];
$condition = $template['condition'];
$time_window = $template['time_window'];
$schedule = json_encode(
$default_events_calendar
@ -856,6 +865,58 @@ if ($step == 2) {
).'</span>'
);
$table->data['math_function'][0] = html_print_label_input_block(
__('Math function'),
html_print_select(
alerts_get_alert_templates_functions(),
'math_function',
$math_function,
'',
__('None'),
0,
true,
false,
false,
'w100p',
(!$is_management_allowed | $disabled)
)
);
$table->data['time_window'][0] = html_print_label_input_block(
__('Time window').ui_print_help_tip(__('Limits to data in the following time window.'), true),
html_print_select(
alerts_get_alert_templates_windows(),
'time_window',
$time_window,
'',
__('None'),
0,
true,
false,
false,
'w100p',
(!$is_management_allowed | $disabled)
)
);
$table->data['condition'][0] = html_print_label_input_block(
__('Alert condition'),
html_print_select(
alerts_get_alert_templates_conditions(),
'condition',
$condition,
'',
__('None'),
0,
true,
false,
false,
'w100p',
(!$is_management_allowed | $disabled)
)
);
$table->data['value'][1] = html_print_label_input_block(
__('Value'),
html_print_input_text(
@ -1088,6 +1149,12 @@ if ($step == 2) {
$table->rowstyle['min'] = '';
break;
case 'complex':
$table->rowstyle['math_function'] = '';
$table->rowstyle['condition'] = '';
$table->rowstyle['time_window'] = '';
break;
case 'onchange':
$show_matches = true;
break;
@ -1299,6 +1366,7 @@ var onchange_not = <?php echo '"'.__('The alert would fire when the module value
var unknown = <?php echo "'".__('The alert would fire when the module is in unknown status')."'"; ?>;
var error_message_min_max_zero = <?php echo "'".__('The alert template cannot have the same value for min and max thresholds.')."'"; ?>;
var not_normal = <?php echo "'".__('The alert would fire when the module is in not normal status')."'"; ?>;
var complex = <?php echo "'".__('Alert would fire when the <span id="math_function"></span> within <span id="time_window"></span> <span id="condition"></span> <span id="value"></span>')."'"; ?>;
function check_fields_step2() {
var correct = true;
@ -1361,6 +1429,68 @@ function render_example () {
else {
$("span#value").empty ().append (vvalue);
}
/* Set math function */
var vfunction = $("select#math_function").val();
var functionMessage = "";
if (vfunction == "0") {
functionMessage = "<em><?php echo __('[function]'); ?></em>";
} else {
if (vfunction == "avg"){
$("span#value").empty ();
}
functionMessage = vfunction;
}
$("span#math_function").empty ().append (functionMessage);
/* Set complex value */
if($("select#type").val() == "complex"){
var valueMessage = "";
if(vfunction == "avg"){
valueMessage = "";
}else if (vvalue == "") {
valueMessage = "<em><?php echo __('[value]'); ?></em>" ;
} else {
valueMessage = vvalue;
}
$("span#value").empty ().append (valueMessage);
}
/* Set condition */
var vCondition = $("select#condition").val();
var conditionMessage = "<em><?php echo __('[condition]'); ?></em>" ;
switch (vCondition){
case "greater":
conditionMessage = (vfunction == "avg") ? "increases" : "is more than";
break
case "lower":
conditionMessage = (vfunction == "avg") ? "decreases" : "is less than";
break
case "equal":
conditionMessage = (vfunction == "avg") ? "remains the same" : "is equal to";
break
}
$("span#condition").empty ().append (conditionMessage);
var vWindow = $("select#time_window").val();
/* Set time window */
var timeWindowMessages = {
"thirty_days": "the last 30 days",
"month": "the last month",
"seven_days": "the last 7 days",
"week": "the last week",
"one_day": "the last 24 hours",
"today": "today"
};
var windowMessage = timeWindowMessages[vWindow] || "<em><?php echo __(' the last [window]'); ?></em>";
$("span#time_window").empty().append(windowMessage);
}
// Fix for metaconsole toggle
@ -1388,6 +1518,18 @@ if ($step == 2) {
$("input#text-value").keyup (render_example);
$("input#text-max").keyup (render_example);
$("input#text-min").keyup (render_example);
$("#condition").change (render_example);
$("#time_window").change (render_example);
$("#math_function").change (function () {
if (["0", 'avg'].includes(this.value)) {
$("#template-value").hide();
} else {
$("#template-value").show ();
}
render_example ();
})
$("#type").change (function () {
switch (this.value) {
@ -1395,6 +1537,7 @@ if ($step == 2) {
case "not_equal":
$("img#regex_good, img#regex_bad, span#matches_value").hide ();
$("#template-max, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-value, #template-example").show ();
/* Show example */
@ -1405,6 +1548,7 @@ if ($step == 2) {
break;
case "regex":
$("#template-max, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-value, #template-example, span#matches_value").show ();
check_regex ();
@ -1416,6 +1560,7 @@ if ($step == 2) {
break;
case "max_min":
$("#template-value").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-max, #template-min, #template-example, span#matches_value").show ();
/* Show example */
@ -1424,9 +1569,25 @@ if ($step == 2) {
else
$("span#example").empty ().append (between_not);
break;
case "complex":
$("pan#matches_value, #template-example, #template-value, #template-max, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").show ();
$("#template-example").show ();
if (["0", 'avg'].includes($("#math_function").val())) {
$("#template-value").hide();
}else {
$("#template-value").show();
}
/* Show example */
$("span#example").empty ().append (complex);
break;
case "max":
$("#template-value, #template-min, span#matches_value").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-max, #template-example").show ();
/* Show example */
@ -1434,6 +1595,7 @@ if ($step == 2) {
break;
case "min":
$("#template-value, #template-max, span#matches_value").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-min, #template-example").show ();
/* Show example */
@ -1441,6 +1603,7 @@ if ($step == 2) {
break;
case "warning":
$("#template-value, #template-max, span#matches_value, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example").show ();
/* Show example */
@ -1448,6 +1611,7 @@ if ($step == 2) {
break;
case "critical":
$("#template-value, #template-max, span#matches_value, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example").show ();
/* Show example */
@ -1455,6 +1619,7 @@ if ($step == 2) {
break;
case "not_normal":
$("#template-value, #template-max, span#matches_value, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example").show ();
/* Show example */
@ -1462,6 +1627,7 @@ if ($step == 2) {
break;
case "onchange":
$("#template-value, #template-max, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example, span#matches_value").show ();
/* Show example */
@ -1472,6 +1638,7 @@ if ($step == 2) {
break;
case "unknown":
$("#template-value, #template-max, span#matches_value, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example").show ();
if ($("#text-min_alerts").val() > 0 ) {
@ -1483,6 +1650,7 @@ if ($step == 2) {
break;
default:
$("#template-value, #template-max, #template-min, #template-example, span#matches_value").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
break;
}

View File

@ -61,6 +61,9 @@ if ($id) {
$filter = events_get_event_filter($id);
$id_group_filter = $filter['id_group_filter'];
$id_group = $filter['id_group'];
// Get owner user private filter.
$private_filter = ($filter['private_filter_user'] === null || $filter['private_filter_user'] === '') ? 0 : 1;
$private_filter_user = $filter['private_filter_user'];
$id_name = $filter['id_name'];
$event_type = $filter['event_type'];
$severity = explode(',', $filter['severity']);
@ -113,6 +116,7 @@ if ($id) {
$server_id = ($filter['server_id'] ?? '');
} else {
$id_group = '';
$private_filter = 0;
$id_group_filter = '';
$id_name = '';
$event_type = '';
@ -167,8 +171,8 @@ if ($update || $create) {
$id_user_ack = get_parameter('id_user_ack', '');
$owner_user = get_parameter('owner_user', '');
$group_rep = get_parameter('group_rep', '');
$date_from = get_parameter('date_from', '');
$date_to = get_parameter('date_to', '');
$date_from = get_parameter('date_from', '0000-00-00');
$date_to = get_parameter('date_to', '0000-00-00');
$source = get_parameter('source');
$id_extra = get_parameter('id_extra');
$user_comment = get_parameter('user_comment');
@ -192,6 +196,16 @@ if ($update || $create) {
$server_id = implode(',', $servers_array);
}
// Get private filter from user.
$private_filter = get_parameter_switch('private_filter_event', 0);
if ((int) $private_filter === 1 && $create) {
$private_filter_user = $_SESSION['id_usuario'];
} else if ((int) $private_filter === 1 && $update) {
$private_filter_user = ($private_filter_user === $_SESSION['id_usuario']) ? $private_filter_user : $_SESSION['id_usuario'];
} else if ((int) $private_filter === 0) {
$private_filter_user = null;
}
$values = [
'id_name' => $id_name,
'id_group_filter' => $id_group_filter,
@ -222,6 +236,7 @@ if ($update || $create) {
'custom_data' => $custom_data,
'custom_data_filter_type' => $custom_data_filter_type,
'server_id' => $server_id,
'private_filter_user' => $private_filter_user,
];
$severity = explode(',', $severity);
@ -293,6 +308,17 @@ $table->data[0][0] = html_print_label_input_block(
false,
'',
'w100p'
).html_print_label_input_block(
__('Private'),
html_print_checkbox_switch(
'private_filter_event',
$private_filter,
$private_filter,
true,
false,
'checked_slide_events(this);',
true
)
)
);

View File

@ -133,6 +133,18 @@ $filters = db_get_all_rows_sql($sql);
if ($filters === false) {
$filters = [];
} else {
foreach ($filters as $key => $filter) {
$permission = users_is_admin($config['id_user']);
// Validate permission and private filter user.
if ($permission || $filter['private_filter_user'] === $config['id_user']) {
if ($filter['private_filter_user'] !== null) {
$filters[$key]['id_name'] = $filter['id_name'].' (P)';
}
} else if ($filter['private_filter_user'] !== null) {
unset($filters[$key]);
}
}
}
$table = new stdClass();

View File

@ -200,6 +200,16 @@ $text_agent_module = '';
$only_data = false;
if (enterprise_installed() === true) {
$categories_security_hardening = categories_of_cis();
foreach ($categories_security_hardening as $key => $cat) {
$categories_security_hardening[$key] = implode(' ', $cat);
}
} else {
$categories_security_hardening = [];
}
// Users.
$id_users = [];
$users_groups = [];
@ -1019,6 +1029,51 @@ switch ($action) {
$idAgent = $item['id_agent'];
break;
case 'top_n_agents_sh':
$group = $item['id_group'];
$recursion = $item['recursion'];
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
break;
case 'top_n_checks_failed':
$group = $item['id_group'];
$recursion = $item['recursion'];
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
break;
case 'top_n_categories_checks':
$group = $item['id_group'];
$recursion = $item['recursion'];
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
break;
case 'vul_by_cat':
$group = $item['id_group'];
$recursion = $item['recursion'];
$cat_selected = $item['cat_security_hardening'];
$ignore_skipped = $item['ignore_skipped'];
break;
case 'list_checks':
$group = $item['id_group'];
$recursion = $item['recursion'];
$cat_selected = $item['cat_security_hardening'];
$status_of_check = $item['status_of_check'];
$idAgent = $item['id_agent'];
break;
case 'scoring':
$group = $item['id_group'];
$recursion = $item['recursion'];
$period = $item['period'];
break;
case 'evolution':
$group = $item['id_group'];
$recursion = $item['recursion'];
$period = $item['period'];
break;
default:
// It's not possible.
break;
@ -1272,6 +1327,28 @@ $class = 'databox filters';
}
?>
<?php
if (is_metaconsole() === true) {
?>
<tr id="row_servers_all" class="datos">
<td class="bolder"><?php echo __('Server'); ?></td>
<td >
<?php
html_print_select(
$servers,
'combo_server_all',
$server_name,
'',
__('All nodes'),
'all'
);
?>
</td>
</tr>
<?php
}
?>
<?php
if ($meta) {
?>
@ -3735,6 +3812,64 @@ $class = 'databox filters';
?>
</td>
</tr>
<tr id="row_ignore_skipped" class="datos">
<td class="bolder">
<?php
echo __('Ignore skipped');
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'ignore_skipped',
1,
($ignore_skipped !== null) ? $ignore_skipped : true,
);
?>
</td>
</tr>
<?php if (enterprise_installed() === true) : ?>
<tr id="row_cat_security_hardening" class="datos">
<td class="bolder">
<?php
echo __('Category');
?>
</td>
<td>
<?php
html_print_select(
$categories_security_hardening,
'cat_security_hardening',
$cat_selected,
);
?>
</td>
</tr>
<?php endif; ?>
<tr id="row_status_check" class="datos">
<td class="bolder">
<?php
echo __('Status of check');
?>
</td>
<td>
<?php
html_print_select(
[
'all' => __('All'),
'PASS' => __('Passed'),
'FAIL' => __('Failed'),
'INVALID' => __('Skipped'),
],
'status_of_check',
$status_of_check,
);
?>
</td>
</tr>
<?php
if ($is_enterprise) {
?>
@ -5063,6 +5198,10 @@ echo "<div id='message_no_group' title='".__('Item Editor Information')."' clas
echo "<p class='center bolder'>".__('Please select a group.').'</p>';
echo '</div>';
echo "<div id='message_no_max_item' title='".__('Max items')."' class='invisible'>";
echo "<p class='center bolder'>".__('Please insert max item number.').'</p>';
echo '</div>';
ui_require_javascript_file(
'pandora_inventory',
ENTERPRISE_DIR.'/include/javascript/'
@ -5406,6 +5545,30 @@ $(document).ready (function () {
return false;
}
break;
case 'list_checks':
if ($("#text-agent").val() == '') {
dialog_message('#message_no_agent');
return false;
}
break;
case 'top_n_agents_sh':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_checks_failed':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_categories_checks':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
default:
break;
}
@ -5476,13 +5639,14 @@ $(document).ready (function () {
});
$("#submit-edit_item").click(function () {
$("#button-edit_item").click(function () {
var type = $('#type').val();
if($('#text-name').val() == ''){
dialog_message('#message_no_name');
return false;
}
switch (type){
case 'agent_module':
case 'agent_module_status':
@ -5535,6 +5699,30 @@ $(document).ready (function () {
return false;
}
break;
case 'list_checks':
if ($("#text-agent").val() == '') {
dialog_message('#message_no_agent');
return false;
}
break;
case 'top_n_agents_sh':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_checks_failed':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_categories_checks':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
default:
break;
@ -6545,6 +6733,7 @@ function chooseType() {
$("#row_alert_actions").hide();
$("#row_servers").hide();
$("#row_servers_all_opt").hide();
$("#row_servers_all").hide();
$("#row_multiple_servers").hide();
$("#row_sort").hide();
$("#row_date").hide();
@ -6607,6 +6796,9 @@ function chooseType() {
$("#row_group_by").hide();
$("#row_type_show").hide();
$("#row_use_prefix_notation").hide();
$("#row_cat_security_hardening").hide();
$("#row_ignore_skipped").hide();
$("#row_status_check").hide();
// SLA list default state.
$("#sla_list").hide();
@ -7109,7 +7301,7 @@ function chooseType() {
case 'group_report':
$("#row_group").show();
$("#row_servers_all_opt").show();
$("#row_servers_all").show();
$("#row_description").show();
$("#row_historical_db_check").hide();
break;
@ -7462,6 +7654,43 @@ function chooseType() {
$("#row_agent").show();
break;
case 'top_n_agents_sh':
$("#row_group").show();
$("#row_max_items").show();
break;
case 'top_n_checks_failed':
$("#row_group").show();
$("#row_max_items").show();
break;
case 'top_n_categories_checks':
$("#row_group").show();
$("#row_max_items").show();
break;
case 'vul_by_cat':
$("#row_group").show();
$("#row_cat_security_hardening").show();
$("#row_ignore_skipped").show();
break;
case 'list_checks':
$("#row_group").show();
$("#row_agent").show();
$("#row_cat_security_hardening").show();
$("#row_status_check").show();
break;
case 'scoring':
$("#row_group").show();
$('#row_period').show();
break;
case 'evolution':
$("#row_group").show();
$('#row_period').show();
break;
}
switch (type) {

View File

@ -1986,7 +1986,51 @@ switch ($action) {
break;
case 'group_report':
$values['server_name'] = get_parameter('combo_server');
$values['server_name'] = get_parameter('combo_server_all');
$good_format = true;
break;
case 'top_n_agents_sh':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_checks_failed':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_categories_checks':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'vul_by_cat':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['ignore_skipped'] = get_parameter('ignore_skipped');
$good_format = true;
break;
case 'list_checks':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['status_of_check'] = get_parameter('status_of_check');
$good_format = true;
break;
case 'scoring':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
case 'evolution':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
@ -2019,6 +2063,7 @@ switch ($action) {
|| ($values['type'] == 'event_report_agent')
|| ($values['type'] == 'agent_configuration')
|| ($values['type'] == 'group_configuration')
|| ($values['type'] == 'list_checks')
) {
$values['id_agent_module'] = '';
} else {
@ -2862,7 +2907,51 @@ switch ($action) {
break;
case 'group_report':
$values['server_name'] = get_parameter('combo_server');
$values['server_name'] = get_parameter('combo_server_all');
$good_format = true;
break;
case 'top_n_agents_sh':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_checks_failed':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_categories_checks':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'vul_by_cat':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['ignore_skipped'] = get_parameter('ignore_skipped');
$good_format = true;
break;
case 'list_checks':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['status_of_check'] = get_parameter('status_of_check');
$good_format = true;
break;
case 'scoring':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
case 'evolution':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;

View File

@ -1025,6 +1025,27 @@ $table_font->data[$row][] = html_print_label_input_block(
);
$row++;
$table_font->data[$row][] = html_print_label_input_block(
__('Truncate agent text at end'),
html_print_checkbox_switch(
'truncate_agent_at_end',
1,
$config['truncate_agent_at_end'],
true
)
);
$table_font->data[$row][] = html_print_label_input_block(
__('Truncate module text at end'),
html_print_checkbox_switch(
'truncate_module_at_end',
1,
$config['truncate_module_at_end'],
true
)
);
$row++;
$table_font->data[$row][] = html_print_label_input_block(
__('Agent size text'),
html_print_div(

View File

@ -607,16 +607,20 @@ if (is_metaconsole() === true) {
}
}
$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control']));
$userManagementTable->rowclass['captions_blocksize_eventfilter'] = 'field_half_width';
$userManagementTable->rowclass['fields_blocksize_eventfilter'] = 'field_half_width';
$userManagementTable->data['captions_blocksize_eventfilter'][0] = __('Block size for pagination');
$userManagementTable->data['fields_blocksize_eventfilter'][0] = html_print_input_text(
'block_size',
$user_info['block_size'],
'',
5,
5,
true
$userManagementTable->data['fields_blocksize_eventfilter'][0] = html_print_input(
[
'type' => 'number',
'size' => 5,
'max' => $performance_variables_control['block_size']->max,
'name' => 'block_size',
'value' => $user_info['block_size'],
'return' => true,
]
);
if (is_metaconsole() === true && empty($user_info['metaconsole_default_event_filter']) !== true) {

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Add alert@svg</title>
<g id="Add-alert" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M10,18 C10,19.1046875 9.10426763,20 8,20 C6.89573237,20 6,19.1046875 6,18 Z M8,2 C8.47753934,2 8.88669653,2.29621004 9.05726495,2.71662986 C8.40926188,3.26642114 8,4.08541645 8,5 L8.00509269,5.17627279 C8.09633912,6.75108004 9.40231912,8 11,8 L12,8 L12,9 C12,10.2760205 12.7966542,11.3659725 13.9197222,11.7996155 C14.313005,13.7223855 15.173052,14.4998338 15.6924763,15.0633413 C15.9067613,15.2955529 16.001761,15.5739183 16,15.8461538 C15.9964039,16.4375 15.5364053,17 14.8535503,17 L1.14644973,17 C0.46359469,17 0.00395325166,16.4375 -1.59872116e-13,15.8461538 C-0.00176101642,15.5739183 0.0932386904,15.2959135 0.307523743,15.0633413 C0.997521614,14.3147837 2.28858906,13.1887019 2.28858906,9.5 C2.28858906,6.69831731 4.23429734,4.45552885 6.85786067,3.90528846 L6.85786067,3.15384615 C6.85786067,2.51670673 7.36928766,2 8,2 Z M15,0 C15.5522847,-1.01453063e-16 16,0.44771525 16,1 L16,3.999 L19,4 C19.5522847,4 20,4.44771525 20,5 C20,5.55228475 19.5522847,6 19,6 L16,6 L16,9 C16,9.55228475 15.5522847,10 15,10 C14.4477153,10 14,9.55228475 14,9 L14,6 L11,6 C10.4477153,6 10,5.55228475 10,5 C10,4.44771525 10.4477153,4 11,4 L14,4 L14,1 C14,0.44771525 14.4477153,1.01453063e-16 15,0 Z" id="Shape" fill="#3F3F3F"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Hardening@svg</title>
<g id="Hardening" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M11.0387503,1.15463195e-14 C11.6463177,1.01024435e-14 12.2209436,0.276179438 12.6004879,0.750609905 L15.5617376,4.45217202 C15.8454385,4.80679812 16,5.24741913 16,5.70156212 L16,6.23960136 C16,6.72942968 15.8202429,7.20222678 15.4948186,7.56832903 L8.74740932,15.1591645 C8.72137833,15.1884494 8.6936487,15.216179 8.66436384,15.24221 C8.25158107,15.609128 7.6195087,15.5719473 7.25259068,15.1591645 L0.505181363,7.56832903 C0.179757138,7.20222678 -8.28191751e-16,6.72942968 0,6.23960136 L0,5.70156212 C8.32561944e-16,5.24741913 0.154561504,4.80679812 0.438262381,4.45217202 L3.39951208,0.750609905 C3.77905645,0.276179438 4.35368225,1.0991794e-14 4.96124969,1.15463195e-14 Z M8.00018082,3 C7.09496946,3 6.30261511,3.60799488 6.06832917,4.48236191 C5.83404323,5.35672894 6.21624479,6.27944513 7.00018082,6.73205081 L7.00018082,9.00205081 C7.00018082,9.55433556 7.44789607,10.0020508 8.00018082,10.0020508 C8.55246557,10.0020508 9.00018082,9.55433556 9.00018082,9.00205081 L9.00018082,6.73205081 C9.78411685,6.27944513 10.1663184,5.35672894 9.93203247,4.48236191 C9.69774653,3.60799488 8.90539218,3 8.00018082,3 Z" id="Path-32" fill="#A7ADAF"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -35,7 +35,6 @@ $disable_alert = (bool) get_parameter('disable_alert');
$enable_alert = (bool) get_parameter('enable_alert');
$get_actions_module = (bool) get_parameter('get_actions_module');
$show_update_action_menu = (bool) get_parameter('show_update_action_menu');
$get_agent_alerts_agent_view = (bool) get_parameter('get_agent_alerts_agent_view');
$resize_event_week = (bool) get_parameter('resize_event_week');
$get_agent_alerts_datatable = (bool) get_parameter('get_agent_alerts_datatable', 0);
$alert_validate = (bool) get_parameter('alert_validate', false);
@ -91,270 +90,6 @@ if ($get_agent_alerts_simple) {
}
if ($get_agent_alerts_agent_view) {
include_once $config['homedir'].'/include/functions_agents.php';
include_once $config['homedir'].'/operation/agentes/alerts_status.functions.php';
include_once $config['homedir'].'/include/functions_users.php';
$agent_a = check_acl($config['id_user'], 0, 'AR');
$agent_w = check_acl($config['id_user'], 0, 'AW');
$access = ($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR');
$free_search_alert = get_parameter('free_search_alert', '');
$all_groups = json_decode(io_safe_output(get_parameter('all_groups')));
$idAgent = (int) get_parameter('id_agent');
$filter = get_parameter('filter', 'all_enabled');
$url = 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$idAgent;
$sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none');
$selected = true;
$selectModuleUp = false;
$selectModuleDown = false;
$selectTemplateUp = false;
$selectTemplateDown = false;
$selectLastFiredUp = false;
$selectLastFiredDown = false;
switch ($sortField) {
case 'module':
switch ($sort) {
case 'up':
$selectModuleUp = $selected;
$order = [
'field' => 'agent_module_name',
'order' => 'ASC',
];
break;
case 'down':
$selectModuleDown = $selected;
$order = [
'field' => 'agent_module_name',
'order' => 'DESC',
];
break;
}
break;
case 'template':
switch ($sort) {
case 'up':
$selectTemplateUp = $selected;
$order = [
'field' => 'template_name',
'order' => 'ASC',
];
break;
case 'down':
$selectTemplateDown = $selected;
$order = [
'field' => 'template_name',
'order' => 'DESC',
];
break;
}
break;
case 'last_fired':
switch ($sort) {
case 'up':
$selectLastFiredUp = $selected;
$order = [
'field' => 'last_fired',
'order' => 'ASC',
];
break;
case 'down':
$selectLastFiredDown = $selected;
$order = [
'field' => 'last_fired',
'order' => 'DESC',
];
break;
}
break;
default:
$selectDisabledUp = '';
$selectDisabledDown = '';
$selectModuleUp = $selected;
$selectModuleDown = false;
$selectTemplateUp = false;
$selectTemplateDown = false;
$selectLastFiredUp = false;
$selectLastFiredDown = false;
$order = [
'field' => 'agent_module_name',
'order' => 'ASC',
];
break;
}
if ($free_search_alert != '') {
$whereAlertSimple = 'AND ('.'id_alert_template IN (
SELECT id
FROM talert_templates
WHERE name LIKE "%'.$free_search_alert.'%") OR '.'id_alert_template IN (
SELECT id
FROM talert_templates
WHERE id_alert_action IN (
SELECT id
FROM talert_actions
WHERE name LIKE "%'.$free_search_alert.'%")) OR '.'talert_template_modules.id IN (
SELECT id_alert_template_module
FROM talert_template_module_actions
WHERE id_alert_action IN (
SELECT id
FROM talert_actions
WHERE name LIKE "%'.$free_search_alert.'%")) OR '.'id_agent_module IN (
SELECT id_agente_modulo
FROM tagente_modulo
WHERE nombre LIKE "%'.$free_search_alert.'%") OR '.'id_agent_module IN (
SELECT id_agente_modulo
FROM tagente_modulo
WHERE alias LIKE "%'.$free_search_alert.'%")'.')';
} else {
$whereAlertSimple = '';
}
// Add checks for user ACL.
$groups = users_get_groups($config['id_user'], $access);
$id_groups = array_keys($groups);
if (empty($id_groups)) {
$whereAlertSimple .= ' AND (1 = 0) ';
} else {
$whereAlertSimple .= sprintf(
' AND id_agent_module IN (
SELECT tam.id_agente_modulo
FROM tagente_modulo tam
WHERE tam.id_agente IN (
SELECT
ta.id_agente
FROM
tagente ta
WHERE
ta.id_grupo IN (%s)
)
OR tam.id_agente IN (
SELECT
DISTINCT(tasg.id_agent)
FROM
tagent_secondary_group tasg
WHERE
tasg.id_group IN (%s)
)
) ',
implode(',', $id_groups),
implode(',', $id_groups)
);
}
$alerts = [];
$filter_alert = [];
if ($filter_standby == 'standby_on') {
$filter_alert['disabled'] = $filter;
$filter_alert['standby'] = '1';
} else if ($filter_standby == 'standby_off') {
$filter_alert['disabled'] = $filter;
$filter_alert['standby'] = '0';
} else {
$filter_alert['disabled'] = $filter;
}
$options_simple = ['order' => $order];
$alerts['alerts_simple'] = agents_get_alerts_simple($idAgent, $filter_alert, $options_simple, $whereAlertSimple, false, false, false, false, $strict_user, $tag_filter);
$countAlertsSimple = agents_get_alerts_simple($idAgent, $filter_alert, false, $whereAlertSimple, false, false, false, true, $strict_user, $tag_filter);
// Urls to sort the table.
$url_up_module = $url.'&sort_field=module&sort=up';
$url_down_module = $url.'&sort_field=module&sort=down';
$url_up_template = $url.'&sort_field=template&sort=up';
$url_down_template = $url.'&sort_field=template&sort=down';
$url_up_lastfired = $url.'&sort_field=last_fired&sort=up';
$url_down_lastfired = $url.'&sort_field=last_fired&sort=down';
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->cellpadding = '0';
$table->cellspacing = '0';
$table->size = [];
$table->head = [];
$table->align = [];
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->size[7] = '5%';
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW') || check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
$table->head[8] = __('Validate');
$table->align[8] = 'left';
$table->size[8] = '5%';
}
$table->head[0] = "<span title='".__('Policy')."'>".__('P.').'</span>';
$table->head[1] = "<span title='".__('Standby')."'>".__('S.').'</span>';
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') || check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
$table->head[2] = "<span title='".__('Force execution')."'>".__('F.').'</span>';
}
$table->head[3] = __('Module');
$table->head[4] = __('Template');
$table->head[5] = __('Action');
$table->head[6] = __('Last fired');
$table->head[7] = __('Status');
$table->align[7] = 'center';
$table->head[3] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
$table->head[4] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
$table->head[6] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
} else {
$table->size[6] = '5%';
if (check_acl($config['id_user'], $id_group, 'LW') || check_acl($config['id_user'], $id_group, 'LM')) {
$table->head[7] = __('Validate');
$table->align[7] = 'left';
$table->size[7] = '5%';
}
$table->head[0] = "<span title='".__('Standby')."'>".__('S.').'</span>';
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
$table->head[1] = "<span title='".__('Force execution')."'>".__('F.').'</span>';
}
$table->head[2] = __('Module');
$table->head[3] = __('Template');
$table->head[4] = __('Action');
$table->head[5] = __('Last fired');
$table->head[6] = __('Status');
$table->align[6] = 'center';
$table->head[2] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
$table->head[3] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
$table->head[5] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
}
$table->data = [];
$rowPair = true;
$iterator = 0;
foreach ($alerts['alerts_simple'] as $alert) {
$row = ui_format_alert_row($alert, false, $url, 'font-size: 9pt;');
$table->data[] = $row;
}
if (empty($table->data) === false) {
html_print_table($table);
} else {
ui_print_info_message(['no_close' => true, 'message' => __('No alerts found') ]);
}
}
if ($enable_alert) {
if (! check_acl($config['id_user'], 0, 'LW')) {
db_pandora_audit(
@ -501,7 +236,7 @@ if ($show_update_action_menu) {
$data .= '<td class="datos">';
$data .= ui_print_truncate_text(
$agent_alias,
'agent_small',
'agent_medium',
false,
true,
true,

View File

@ -92,6 +92,9 @@ $get_id_source_event = get_parameter('get_id_source_event');
$node_id = (int) get_parameter('node_id', 0);
$settings_modal = get_parameter('settings', 0);
$parameters_modal = get_parameter('parameters', 0);
// User private filter.
$current_filter = get_parameter('current_filter', 0);
$private_filter_event = get_parameter('private_filter_event', 0);
if ($get_comments === true) {
global $config;
@ -337,6 +340,14 @@ if ($save_event_filter) {
$values['custom_data'] = get_parameter('custom_data');
$values['custom_data_filter_type'] = get_parameter('custom_data_filter_type');
// Get private filter from user.
$private_filter = get_parameter_switch('private_filter_user', 0);
if ((int) $private_filter === 1) {
$values['private_filter_user'] = $config['id_user'];
} else {
$values['private_filter_user'] = null;
}
if (is_metaconsole() === true) {
$values['server_id'] = implode(',', get_parameter('server_id'));
}
@ -397,6 +408,17 @@ if ($update_event_filter) {
$values['custom_data'] = get_parameter('custom_data');
$values['custom_data_filter_type'] = get_parameter('custom_data_filter_type');
// Get private filter from user.
$private_filter = get_parameter('private_filter_user', 0);
$user_private_filter = events_get_event_filter($id);
if ((int) $private_filter === 1 && $user_private_filter['private_filter_user'] === null) {
$values['private_filter_user'] = $config['id_user'];
} else if ($private_filter === $user_private_filter['private_filter_user'] && $user_private_filter['private_filter_user'] !== $config['id_user']) {
$values['private_filter_user'] = $user_private_filter['private_filter_user'];
} else {
$values['private_filter_user'] = null;
}
if (is_metaconsole() === true) {
$values['server_id'] = implode(',', get_parameter('server_id'));
}
@ -712,8 +734,8 @@ if ($save_filter_modal) {
$table = new StdClass;
$table->id = 'save_filter_form';
$table->width = '100%';
$table->cellspacing = 4;
$table->cellpadding = 4;
$table->cellspacing = 5;
$table->cellpadding = 5;
$table->class = 'databox';
if (is_metaconsole() === true) {
$table->class = 'databox filters';
@ -732,7 +754,7 @@ if ($save_filter_modal) {
'filter_mode',
'new',
__('New filter'),
true,
((int) $current_filter === 0) ? true : false,
true
);
@ -740,7 +762,7 @@ if ($save_filter_modal) {
'filter_mode',
'update',
__('Update filter'),
false,
((int) $current_filter > 0) ? true : false,
true
);
@ -755,6 +777,7 @@ if ($save_filter_modal) {
$table->rowclass[2] = 'flex';
$table->rowclass[3] = 'flex';
$table->rowclass[4] = 'flex';
$table->rowclass[5] = 'flex';
$data[0] = '<b>'.__('Filter name').'</b>'.$jump;
$data[0] .= html_print_input_text('id_name', '', '', 15, 255, true);
if (is_metaconsole()) {
@ -801,9 +824,9 @@ if ($save_filter_modal) {
$data[0] .= html_print_select(
$_filters_update,
'overwrite_filter',
$current_filter,
'',
'',
'',
__('None'),
0,
true,
false,
@ -814,6 +837,31 @@ if ($save_filter_modal) {
$table->data[] = $data;
$table->rowclass[] = '';
$data = [];
$table->rowid[4] = 'update_filter_row2';
$table->data[] = $data;
$table->rowclass[] = '';
// Update user private filter.
$data = [];
$table->rowid[6] = 'private_filter_event_row1';
$data[0] = html_print_label_input_block(
__('Private'),
html_print_checkbox_switch(
'private_filter_event',
$private_filter_event,
$private_filter_event,
true,
false,
'checked_slide_events(this);',
true
)
);
$table->data[] = $data;
$table->rowclass[] = '';
html_print_table($table);
html_print_div(
@ -858,10 +906,19 @@ if ($save_filter_modal) {
?>
<script type="text/javascript">
function show_save_filter() {
if ($('#hidden-id_filter_event').val() == 0) {
$('#save_filter_row1').show();
$('#save_filter_row2').show();
$('#update_filter_row1').hide();
$('#button-update_filter').hide();
} else {
$('#save_filter_row1').hide();
$('#save_filter_row2').hide();
$('#button-save_filter').hide();
$('#update_filter_row1').show();
$('#button-update_filter').show();
}
// Filter save mode selector
$("[name='filter_mode']").click(function() {
if ($(this).val() == 'new') {
@ -936,7 +993,8 @@ function save_new_filter() {
"id_source_event": $("#text-id_source_event").val(),
"server_id": $("#server_id").val(),
"custom_data": $("#text-custom_data").val(),
"custom_data_filter_type": $("#custom_data_filter_type").val()
"custom_data_filter_type": $("#custom_data_filter_type").val(),
"private_filter_user": $("#checkbox-private_filter_event").val()
},
function (data) {
$("#info_box").hide();
@ -1015,7 +1073,8 @@ function save_update_filter() {
"id_source_event": $("#text-id_source_event").val(),
"server_id": $("#server_id").val(),
"custom_data": $("#text-custom_data").val(),
"custom_data_filter_type": $("#custom_data_filter_type").val()
"custom_data_filter_type": $("#custom_data_filter_type").val(),
"private_filter_user": $("#checkbox-private_filter_event").val()
},
function (data) {

View File

@ -0,0 +1,45 @@
<?php
/**
* Ajax script for Inventory
*
* @category Inventory
* @package Pandora FMS
* @subpackage Enterprises
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
check_login();
if (is_ajax() === true) {
$id_agent = get_parameter('id_agent', '0');
$id_server = get_parameter('id_server', '0');
if (is_metaconsole() === true) {
$agent_modules = [];
$server_name = metaconsole_get_names(['id' => $id_server]);
if (is_array($server_name) === true && count($server_name) > 0) {
$agent_modules = inventory_get_agent_modules($id_agent, 'all', $id_server, reset($server_name));
}
} else {
$agent_modules = inventory_get_agent_modules($id_agent);
}
echo json_encode($agent_modules);
}

View File

@ -0,0 +1,57 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Users
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
global $config;
// Includes.
require_once $config['homedir'].'/include/functions_notifications.php';
$change_label = get_parameter('change_label', 0);
if ($change_label === '1') {
$label = get_parameter('label', '');
$source = get_parameter('source', 0);
$user = get_parameter('user', '');
$value = get_parameter('value', 0) ? 1 : 0;
// Update the label value.
ob_clean();
$json = json_encode(
[
'result' => notifications_set_user_label_status(
$source,
$user,
$label,
$value
),
]
);
echo $json;
return;
}

View File

@ -252,6 +252,18 @@ $hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
echo $chart->render(true);
break;
case 'line_graph':
$params['pdf'] = true;
$params['options']['width'] = '100%';
$params['options']['height'] = 200;
$chart = get_build_setup_charts(
'LINE',
$params['options'],
$params['chart_data']
);
echo $chart->render(true);
break;
case 'slicebar':
// TO-DO Cambiar esto para que se pase por POST, NO SE PUEDE PASAR POR GET.
$params['graph_data'] = json_decode(io_safe_output($config[$params['tokem_config']]), true);

View File

@ -621,7 +621,8 @@ class ConsoleSupervisor
'small_operation_step_datos_purge' => 'Small Operation Step to purge old data',
'row_limit_csv' => 'Row limit in csv log',
'limit_parameters_massive' => 'Limit for bulk operations',
'block_size' => 'Block size for pagination',
'block_size' => 'User block size for pagination',
'global_block_size' => 'Global block size for pagination',
'short_module_graph_data' => 'Data precision',
'graph_precision' => 'Data precision in graphs',
];
@ -635,8 +636,14 @@ class ConsoleSupervisor
$message = '';
$limit_value = '';
$url = '';
if ($config[$variable] > $values->max) {
$message = 'Check the setting of %s, a value greater than %s is not recommended';
if ($variable === 'block_size') {
$message .= '. (User: '.$config['id_user'].')';
}
$limit_value = $values->max;
}
@ -647,19 +654,27 @@ class ConsoleSupervisor
if ($limit_value !== '' && $message !== '') {
if (is_metaconsole() === true) {
$this->notify(
[
'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable,
'title' => __('Incorrect config value'),
'message' => __(
$message,
$names[$variable],
$limit_value
),
'url' => '__url__index.php?sec=advanced&sec2=advanced/metasetup',
]
);
$url = '__url__index.php?sec=advanced&sec2=advanced/metasetup';
} else {
$url = '__url__/index.php?sec=general&sec2=godmode/setup/setup';
}
if ($variable === 'block_size') {
if (is_metaconsole() === true) {
$url = '__url__index.php?sec=gusuarios&sec2=godmode/users/configure_user&edit_user=1&pure=0&id_user='.$config['id_user'];
} else {
$url = '__url__/index.php?sec=gusuarios&sec2=godmode/users/configure_user&edit_user=1&pure=0&id_user='.$config['id_user'];
}
}
if ($variable === 'global_block_size') {
if (is_metaconsole() === true) {
$url = '__url__index.php?sec=advanced&sec2=advanced/metasetup&pure=0&tab=visual';
} else {
$url = '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup&section=vis';
}
}
$this->notify(
[
'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable,
@ -669,12 +684,11 @@ class ConsoleSupervisor
$names[$variable],
$limit_value
),
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup',
'url' => $url,
]
);
}
}
}
}
@ -703,7 +717,7 @@ class ConsoleSupervisor
$total_agents = db_get_value('count(*)', 'tagente');
if ($total_agents >= 200) {
if ($config['agentaccess'] !== 0) {
if ((int) $config['agentaccess'] !== 0) {
db_process_sql_update('tconfig', ['value' => 0], ['token' => 'agentaccess']);
$this->notify(
[

View File

@ -316,6 +316,8 @@ class Diagnostics extends Wizard
* Graph of the Free Disk Spool Dir module.
* Graph of the Free RAM module.
* Graph of the Queued Modules module.
* Graph of the Queued_Alerts.
* Graph of the Alert_Server_Status.
* Graph of the Status module.
* Graph of the System Load AVG module.
* Graph of the Execution Time module.
@ -366,6 +368,20 @@ class Diagnostics extends Wizard
'nameModule' => 'Queued_Modules',
'idAgent' => $agentIdMasterServer,
],
'chartQueuedAlerts' => [
'title' => __(
'Graph of the Queued Alerts total.'
),
'nameModule' => 'Queued_Alerts',
'idAgent' => $agentIdMasterServer,
],
'chartAlertServerStatus' => [
'title' => __(
'Graph of the Alert Server Status.'
),
'nameModule' => 'Alert_Server_Status',
'idAgent' => $agentIdMasterServer,
],
'chartStatus' => [
'title' => __('Graph of the Status module.'),
'nameModule' => 'Status',

View File

@ -960,11 +960,6 @@ class Tree
$agent['counters']['not_init'] = 0;
}
// Quiet image
if (isset($agent['quiet']) && $agent['quiet']) {
$agent['statusImageHTML'] = ui_print_status_sets('agent_no_monitors_ball.png', __('Quiet'), 1, ['is_tree_view' => 'yes', 'class' => 'status_balls', 'style' => 'background: '.COL_QUIET.';'], '', false);
}
// Children
if (empty($agent['children'])) {
$agent['children'] = [];

View File

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

View File

@ -2760,7 +2760,6 @@ 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 fav menu.
db_process_sql_delete(
'tfavmenu_user',

View File

@ -688,11 +688,67 @@ function alerts_get_alert_templates_types()
$types['onchange'] = __('On Change');
$types['always'] = __('Always');
$types['not_normal'] = __('Not normal status');
$types['complex'] = __('Complex alert');
return $types;
}
/**
* Get matemathical functions for complex alert templates.
*
* @return array Mathematical function for complex templates.
*/
function alerts_get_alert_templates_functions()
{
$functions = [];
$functions['avg'] = __('Avg.');
$functions['sum'] = __('Sum.');
$functions['max'] = __('Max.');
$functions['min'] = __('Min.');
return $functions;
}
/**
* Get conditions for complex alert templates.
*
* @return array Conditions for complex templates.
*/
function alerts_get_alert_templates_conditions()
{
$conditions = [];
$conditions['lower'] = __('&lt;');
$conditions['greater'] = __('&gt;');
$conditions['equal'] = __('=');
return $conditions;
}
/**
* Get time windows for complex alert templates.
*
* @return array Windows for complex templates.
*/
function alerts_get_alert_templates_windows()
{
$windows = [];
$windows['thirty_days'] = __('Last 30 days');
$windows['month'] = __('This month');
$windows['seven_days'] = __('Last 7 days');
$windows['week'] = __('This week');
$windows['one_day'] = __('Last 24 hours');
$windows['today'] = __('Today');
return $windows;
}
/**
* Get type name of an alert template.
*

View File

@ -1288,6 +1288,10 @@ function config_update_config()
$error_update[] = __('Default line menu items for the Services');
}
if (config_update_value('truncate_agent_at_end', get_parameter('truncate_agent_at_end'), true) === false) {
$error_update[] = __('Truncate agent text at end');
}
if (config_update_value('agent_size_text_small', get_parameter('agent_size_text_small'), true) === false) {
$error_update[] = __('Agent size text');
}
@ -1296,6 +1300,10 @@ function config_update_config()
$error_update[] = __('Agent size text');
}
if (config_update_value('truncate_module_at_end', get_parameter('truncate_module_at_end'), true) === false) {
$error_update[] = __('Truncate module text at end');
}
if (config_update_value('module_size_text_small', get_parameter('module_size_text_small'), true) === false) {
$error_update[] = __('Module size text');
}
@ -1478,7 +1486,7 @@ function config_update_config()
// --------------------------------------------------
// CUSTOM INTERVAL VALUES
// --------------------------------------------------
$interval_values = get_parameter('interval_values');
$interval_values = $config['interval_values'];
// Add new interval value if is provided.
$interval_value = (float) get_parameter('interval_value', 0);
@ -1520,6 +1528,7 @@ function config_update_config()
$interval_values = implode(',', $interval_values_array);
}
hd($interval_values, true);
if (config_update_value('interval_values', $interval_values, true) === false) {
$error_update[] = __('Delete interval');
}
@ -2565,6 +2574,10 @@ function config_process_config()
'max' => 200,
'min' => 10,
],
'global_block_size' => [
'max' => 200,
'min' => 10,
],
'short_module_graph_data' => [
'max' => 20,
'min' => 1,
@ -3526,6 +3539,10 @@ function config_process_config()
config_update_value('display_item_frame', 1);
}
if (!isset($config['truncate_agent_at_end'])) {
config_update_value('truncate_agent_at_end', 0);
}
if (!isset($config['agent_size_text_small'])) {
config_update_value('agent_size_text_small', 18);
}
@ -3534,6 +3551,10 @@ function config_process_config()
config_update_value('agent_size_text_medium', 50);
}
if (!isset($config['truncate_module_at_end'])) {
config_update_value('truncate_module_at_end', 0);
}
if (!isset($config['module_size_text_small'])) {
config_update_value('module_size_text_small', 25);
}

View File

@ -2567,6 +2567,10 @@ function db_get_column_type(string $table, string $column='')
*/
function db_validate_sql(string $sql, $server=false)
{
if ($server == 0) {
$server = false;
}
if ($server !== false && is_metaconsole() === true) {
$setup = metaconsole_get_connection($server);
if (metaconsole_connect($setup) !== NOERR) {

View File

@ -3357,7 +3357,7 @@ function events_get_event_filter_select($manage=true)
}
$sql = '
SELECT id_filter, id_name
SELECT id_filter, id_name, private_filter_user
FROM tevent_filter
WHERE id_group_filter IN (0, '.implode(',', array_keys($user_groups)).')';
@ -3368,9 +3368,22 @@ function events_get_event_filter_select($manage=true)
} else {
$result = [];
foreach ($event_filters as $event_filter) {
$permission = users_is_admin($config['id_user']);
if ($permission || $event_filter['private_filter_user'] === $config['id_user']) {
if ($event_filter['private_filter_user'] !== null) {
$filter_name = $event_filter['id_name'].' (P)';
} else {
$filter_name = $event_filter['id_name'];
}
$result[$event_filter['id_filter']] = $filter_name;
}
if ($event_filter['private_filter_user'] === null) {
$result[$event_filter['id_filter']] = $event_filter['id_name'];
}
}
}
return $result;
}

View File

@ -1577,10 +1577,16 @@ function graphic_combined_module(
$server_name = metaconsole_get_server_by_id($modules[0]['server']);
}
if (isset($params_combined['custom_period']) !== false && $params_combined['custom_period'] !== false) {
$period = $params_combined['custom_period'];
} else {
$period = $params['period'];
}
if ($params_combined['projection']) {
$output_projection = forecast_projection_graph(
$module_list[0],
$params['period'],
$period,
$params_combined['projection'],
false,
false,
@ -5376,9 +5382,11 @@ function graph_so_by_group($id_group, $width=300, $height=200, $recursive=true,
'SELECT COUNT(id_agente) AS count,
os.name
FROM tagente a
LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente
LEFT JOIN tconfig_os os ON a.id_os = os.id_os
WHERE a.id_grupo IN (%s)
WHERE a.id_grupo IN (%s) OR g.id_group IN (%s)
GROUP BY os.id_os',
implode(',', $id_groups),
implode(',', $id_groups)
);
@ -5460,7 +5468,7 @@ function graph_events_agent_by_group($id_group, $width=300, $height=200, $noWate
}
}
$filter_groups = ' AND te.id_grupo IN ('.implode(',', $id_groups).') ';
$filter_groups = ' AND (te.id_grupo IN ('.implode(',', $id_groups).') OR g.id_group IN ('.implode(',', $id_groups).'))';
// This will give the distinct id_agente, give the id_grupo that goes
// with it and then the number of times it occured. GROUP BY statement
@ -5469,6 +5477,7 @@ function graph_events_agent_by_group($id_group, $width=300, $height=200, $noWate
'SELECT DISTINCT(id_agente) AS id_agente,
COUNT(id_agente) AS count
FROM tevento te
LEFT JOIN tagent_secondary_group g ON g.id_agent = te.id_agente
WHERE 1=1 AND estado = 0
%s %s
GROUP BY id_agente

View File

@ -2501,7 +2501,9 @@ function groups_get_heat_map_agents(array $id_group, float $width=0, float $heig
$id_group = [$id_group];
}
$sql = 'SELECT * FROM tagente WHERE id_grupo IN('.implode(',', $id_group).')';
$sql = 'SELECT * FROM tagente a
LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente
WHERE a.id_grupo IN ('.implode(',', $id_group).') OR g.id_group IN ('.implode(',', $id_group).')';
$all_agents = db_get_all_rows_sql($sql);
if (empty($all_agents)) {
@ -2654,8 +2656,8 @@ function tactical_groups_get_agents_and_monitoring($id_groups, $data='')
if ($data === '') {
$data = [
'total_agents' => groups_agents_total_counters($id_groups, false)['total'],
'monitor_total' => groups_get_total_monitors($id_groups, [], [], false, false, false, false),
'total_agents' => groups_agents_total_counters($id_groups, true)['total'],
'monitor_total' => groups_get_total_monitors($id_groups, [], [], false, false, false, true),
];
}
@ -2719,7 +2721,7 @@ function tactical_groups_get_stats_alerts($id_groups, $data='')
}
$urls = [];
$urls['monitor_alerts'] = $config['homeurl'].'index.php?sec=estado&amp;sec2=operation/agentes/alerts_status&amp;refr=60&ag_group='.$id_groups[0];
$urls['monitor_alerts'] = $config['homeurl'].'index.php?sec=estado&amp;sec2=operation/agentes/alerts_status&amp;refr=60&disabled=all&ag_group='.$id_groups[0];
$urls['monitor_alerts_fired'] = $config['homeurl'].'index.php?sec=estado&amp;sec2=operation/agentes/alerts_status&amp;refr=60&disabled=fired&ag_group='.$id_groups[0];
// Alerts table.
@ -2790,11 +2792,11 @@ function groups_get_stats_modules_status($id_groups, $graph_width=250, $graph_he
if ($data === '') {
$data = [
'monitor_critical' => groups_get_critical_monitors($id_groups, [], [], false, false, false, false),
'monitor_warning' => groups_get_warning_monitors($id_groups, [], [], false, false, false, false),
'monitor_ok' => groups_get_normal_monitors($id_groups, [], [], false, false, false, false),
'monitor_unknown' => groups_get_unknown_monitors($id_groups, [], [], false, false, false, false),
'monitor_not_init' => groups_get_not_init_monitors($id_groups, [], [], false, false, false, false),
'monitor_critical' => groups_get_critical_monitors($id_groups, [], [], false, false, false, true),
'monitor_warning' => groups_get_warning_monitors($id_groups, [], [], false, false, false, true),
'monitor_ok' => groups_get_normal_monitors($id_groups, [], [], false, false, false, true),
'monitor_unknown' => groups_get_unknown_monitors($id_groups, [], [], false, false, false, true),
'monitor_not_init' => groups_get_not_init_monitors($id_groups, [], [], false, false, false, true),
];
}

View File

@ -3303,7 +3303,7 @@ function html_print_input_image($name, $src, $value, $style='', $return=false, $
// If metaconsole is activated and image doesn't exists try to search on normal console.
if (is_metaconsole() === true) {
if (false === @file_get_contents($src, 0, null, 0, 1)) {
if ($src !== null && false === @file_get_contents($src, 0, null, 0, 1)) {
$src = '../../'.$src;
}
}
@ -7266,6 +7266,8 @@ function html_print_select_date_range(
$date_init = date('Y/m/d', strtotime($date_end.' -1 days'));
}
$date_init = date('Y/m/d', strtotime($date_init));
if ($time_init === '') {
$time_init = date('H:i:s');
}
@ -7382,11 +7384,15 @@ function html_print_select_date_range(
$('#".$name."_default').hide();
$('#".$name."_extend').hide();
$('#hidden-custom_date').val('1');
$('.filter_label_position_before').addClass('filter_label_position_after');
} else if ($(this).val() === 'custom') {
$('#".$name."_range').hide();
$('#".$name."_default').hide();
$('#".$name."_extend').show();
$('#hidden-custom_date').val('2');
$('.filter_label_position_before').removeClass('filter_label_position_after');
} else {
$('.filter_label_position_before').removeClass('filter_label_position_after');
}
});
@ -7395,14 +7401,29 @@ function html_print_select_date_range(
});
// To get position must to be showed, hide elements return 0 on offset function.
var def_state_range = $('#".$name."_range').is(':visible');
var def_state_default = $('#".$name."_default').is(':visible');
var def_state_extend = $('#".$name."_extend').is(':visible');
$('#".$name."_range').show();
$('#".$name."_default').hide();
$('#".$name."_extend').hide();
position_top_init = $('#text-date_init').offset().top + $('#text-date_init').outerHeight();
position_top_end = $('#text-date_end').offset().top + $('#text-date_end').outerHeight();
if(def_state_range){
$('#".$name."_range').show();
} else {
$('#".$name."_range').hide();
$('#".$name."_extend').hide();
}
if(def_state_default){
$('#".$name."_default').show();
} else {
$('#".$name."_default').hide();
}
if(def_state_extend){
$('#".$name."_extend').show();
} else {
$('#".$name."_extend').hide();
}
});
var position_top_init = 0;

View File

@ -701,6 +701,7 @@ function modules_update_agent_module(
}
// Disable action requires a special function
$result = false;
if (isset($values['disabled'])) {
$result_disable = modules_change_disabled($id, $values['disabled']);
@ -709,7 +710,9 @@ function modules_update_agent_module(
$result_disable = true;
}
if (empty($values) === false) {
$result = @db_process_sql_update('tagente_modulo', $values, $where);
}
if ($result == false) {
if ($result_disable === ERR_GENERIC) {

View File

@ -635,6 +635,12 @@ function notifications_get_user_label_status($source, $user, $label)
array_keys(users_get_groups($user)),
array_keys(notifications_get_group_sources_for_select($source['id']))
);
// Clean default common groups error for mesagges.
if ($common_groups[0] === 0) {
unset($common_groups[0]);
}
// No group found, return no permissions.
$value = empty($common_groups) ? false : $source[$label];
return notifications_build_user_enable_return($value, false);
@ -760,9 +766,10 @@ function notifications_print_global_source_configuration($source)
}
// Generate the title.
$html_title = "<div class='global-config-notification-title'>";
$html_title = '<h2 style="margin-bottom: auto;">'.$source['description'].'</h2>';
$html_title .= "<div class='global-config-notification-title'>";
$html_title .= html_print_switch($switch_values);
$html_title .= '<h2>'.$source['description'].'</h2>';
$html_title .= '<h2>'.__('Enable user configuration').'</h2>';
$html_title .= '</div>';
// Generate the html for title.

View File

@ -159,7 +159,10 @@ function reporting_make_reporting_data(
$force_width_chart=null,
$force_height_chart=null,
$pdf=false,
$from_template=false
$from_template=false,
$filter_type='',
$custom_date_end='',
$custom_period=false
) {
global $config;
@ -194,8 +197,7 @@ function reporting_make_reporting_data(
if (empty($contents)) {
return reporting_check_structure_report($report);
}
};
$metaconsole_on = is_metaconsole();
$index_content = 0;
@ -562,7 +564,10 @@ function reporting_make_reporting_data(
$type,
$force_width_chart,
$force_height_chart,
$pdf
$pdf,
$filter_type,
$custom_date_end,
$custom_period
);
break;
@ -935,6 +940,57 @@ function reporting_make_reporting_data(
);
break;
case 'top_n_agents_sh':
$report['contents'][] = reporting_top_n_agents_sh(
$report,
$content
);
break;
case 'top_n_checks_failed':
$report['contents'][] = reporting_top_n_checks_failed(
$report,
$content
);
break;
case 'top_n_categories_checks':
$report['contents'][] = reporting_top_n_categories_checks(
$report,
$content
);
break;
case 'vul_by_cat':
$report['contents'][] = reporting_vul_by_categories(
$report,
$content,
$type
);
break;
case 'list_checks':
$report['contents'][] = reporting_list_checks(
$report,
$content
);
break;
case 'scoring':
$report['contents'][] = reporting_scoring(
$report,
$content
);
break;
case 'evolution':
$report['contents'][] = reporting_evolution_hardening(
$report,
$content,
$type
);
break;
default:
// Default.
break;
@ -6804,7 +6860,10 @@ function reporting_projection_graph(
$type='dinamic',
$force_width_chart=null,
$force_height_chart=null,
$pdf=false
$pdf=false,
$filter_type='',
$custom_date_end='',
$custom_period=false
) {
global $config;
@ -6870,6 +6929,7 @@ function reporting_projection_graph(
$return['agent_name_db'] = $agent_name_db;
$return['agent_name'] = $agent_name;
$return['module_name'] = $module_name;
$return['datetime'] = $report['datetime'];
set_time_limit(500);
@ -6890,8 +6950,24 @@ function reporting_projection_graph(
'return_img_base_64' => true,
];
$top_n_value = $content['top_n_value'];
if ($filter_type === 'this_week') {
$current_date = date('Y/m/d H:i:s');
$monday = date('Y/m/d H:i:s', strtotime('last monday'));
$sunday = date('Y/m/d H:i:s', strtotime($monday.' +6 days'));
$top_n_value = (strtotime($sunday) - strtotime($current_date));
} else if ($filter_type === 'this_month') {
$current_date = date('Y/m/d H:i:s');
$last_of_month = date('Y/m/d', strtotime('last day of this month'));
$top_n_value = (strtotime($last_of_month) - strtotime($current_date));
} else if ($filter_type === 'chose_range') {
$current_date = date('Y/m/d H:i:s');
$top_n_value = (strtotime($custom_date_end) - strtotime($current_date));
}
$params_combined = [
'projection' => $content['top_n_value'],
'projection' => $top_n_value,
'custom_period' => $custom_period,
];
if ($pdf === true) {

View File

@ -26,6 +26,7 @@
* GNU General Public License for more details.
* ============================================================================
*/
use PandoraFMS\Enterprise\Metaconsole\Node;
require_once $config['homedir'].'/include/functions.php';
require_once $config['homedir'].'/include/functions_db.php';
@ -119,10 +120,15 @@ function reporting_html_header(
}
function html_do_report_info($report)
function html_do_report_info($report, $custom_date_end=false, $custom_period=false)
{
global $config;
if ($custom_period !== false && $custom_date_end !== false) {
$report['datetime'] = strtotime($custom_date_end);
$report['period'] = $custom_period;
}
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$background_color = '#222';
} else {
@ -170,10 +176,10 @@ function html_do_report_info($report)
*
* @return array
*/
function reporting_html_print_report($report, $mini=false, $report_info=1)
function reporting_html_print_report($report, $mini=false, $report_info=1, $custom_date_end=false, $custom_period=false)
{
if ($report_info == 1) {
html_do_report_info($report);
html_do_report_info($report, $custom_date_end, $custom_period);
}
foreach ($report['contents'] as $key => $item) {
@ -226,6 +232,12 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
$label = '';
}
if ($custom_date_end !== false) {
$to = strtotime($custom_date_end);
} else {
$to = $item['date']['to'];
}
reporting_html_header(
$table,
$mini,
@ -234,7 +246,7 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
$item['date']['period'],
$item['date']['date'],
$item['date']['from'],
$item['date']['to'],
$to,
$label
);
@ -463,6 +475,34 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
case 'ncm':
reporting_html_ncm_config($table, $item);
break;
case 'top_n_agents_sh':
reporting_html_top_n_agents_sh($table, $item);
break;
case 'top_n_checks_failed':
reporting_html_top_n_checks_failed($table, $item);
break;
case 'top_n_categories_checks':
reporting_html_top_n_categories_checks($table, $item);
break;
case 'vul_by_cat':
reporting_vul_by_cat_graph($table, $item);
break;
case 'list_checks':
reporting_html_list_checks($table, $item);
break;
case 'scoring':
reporting_html_scoring($table, $item);
break;
case 'evolution':
reporting_evolution_graph($table, $item);
break;
}
if ($item['type'] == 'agent_module') {
@ -478,6 +518,280 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
}
/**
* Function to print the security hardening evolution.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
*
* @return void
*/
function reporting_evolution_graph($table, $item)
{
$table->rowclass[0] = '';
$table->colspan['chart']['cell'] = 3;
$table->cellstyle['chart']['cell'] = 'text-align: center;';
$table->data['chart']['cell'] = $item['chart'];
}
/**
* Function to print the agents scoring.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_scoring($table, $item, $pdf=0)
{
global $config;
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->width = '99%';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Date').'</b>';
$table1->head[1] = '<b>'.__('Agent').'</b>';
$table1->head[2] = '<b>'.__('Score').'</b>';
$row = 1;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][1] = date($config['date_format'], $check['date']);
$table1->data[$row][2] = $check['agent'];
$table1->data[$row][3] = $check['scoring'].' %';
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML checks filtered by agent and category.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_list_checks($table, $item, $pdf=0)
{
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 4;
$table1 = new stdClass();
$table1->width = '99%';
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Id').'</b>';
$table1->head[1] = '<b>'.__('Title').'</b>';
$table1->head[2] = '<b>'.__('Category').'</b>';
$table1->head[3] = '<b>'.__('Status').'</b>';
$row = 2;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][0] = $check['id'];
$table1->data[$row][1] = $check['title'];
$table1->data[$row][2] = $check['category'];
$table1->data[$row][3] = $check['status'];
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML top checks failed by category
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_top_n_categories_checks($table, $item, $pdf=0)
{
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->width = '99%';
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Id').'</b>';
$table1->head[1] = '<b>'.__('Category').'</b>';
$table1->head[2] = '<b>'.__('Total Failed').'</b>';
$row = 2;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][0] = $check['id'];
$table1->data[$row][1] = $check['category'];
$table1->data[$row][2] = $check['total'];
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML top checks failed.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_top_n_checks_failed($table, $item, $pdf=0)
{
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->width = '99%';
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->headstyle[1] = 'width: 10%; text-align: center;';
$table1->style[2] = 'text-align: center;';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Title').'</b>';
$table1->head[1] = '<b>'.__('Total Failed').'</b>';
$table1->head[2] = '<b>'.__('Description').'</b>';
$row = 2;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][1] = $check['title'];
$table1->data[$row][2] = $check['total'];
$table1->data[$row][3] = $check['description'];
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML top categories in graph.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
*
* @return void
*/
function reporting_vul_by_cat_graph($table, $item)
{
$table->rowclass[0] = '';
$table->colspan['chart']['cell'] = 3;
$table->cellstyle['chart']['cell'] = 'text-align: center;';
$table->data['chart']['cell'] = $item['chart'];
}
/**
* Function to print HTML top n agents from security hardening.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_top_n_agents_sh($table, $item, $pdf=0)
{
global $config;
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->headstyle = [];
$table1->width = '99%';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Agent').'</b>';
$table1->head[1] = '<b>'.__('Last audit scan').'</b>';
$table1->head[2] = '<b>'.__('Score').'</b>';
$row = 2;
foreach ($item['data'] as $key => $agent) {
$table1->data[$row][0] = $agent['alias'];
$table1->data[$row][1] = date($config['date_format'], $agent['utimestamp']);
$table1->data[$row][2] = $agent['datos'].' %';
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table, true);
}
}
/**
* Function to print to HTML SLA report.
*
@ -2582,23 +2896,51 @@ function reporting_html_group_report($table, $item, $pdf=0)
$table->colspan['group_report']['cell'] = 3;
$table->cellstyle['group_report']['cell'] = 'text-align: center;';
$metaconsole_connected = false;
if (is_metaconsole() === true) {
if (is_metaconsole() === true && $item['server_name'] != '0') {
$connection = metaconsole_get_connection($item['server_name']);
if (metaconsole_connect($connection) == NOERR) {
$metaconsole_connected = true;
}
}
$all_group_id = [];
$group_events = [];
$group_os = [];
if ($item['subtitle'] === 'All') {
$group_id = [];
$all_group_id = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo');
if (is_metaconsole() === true && $item['server_name'] === 'all' || $item['server_name'] === '0') {
$nodes = metaconsole_get_connections();
foreach ($nodes as $node) {
try {
$nd = new Node($node['id']);
$nd->connect();
foreach ($all_group_id as $group) {
$group_id[] = $group['id_grupo'];
$all_group_id_node = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo');
$group_events_node = db_get_all_rows_sql(
'SELECT COUNT(te.id_evento) as count_events, ta.alias
FROM tevento as te
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente
GROUP BY te.id_agente'
);
$group_os_node = db_get_all_rows_sql(
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
FROM tconfig_os as os
INNER JOIN tagente as ta ON ta.id_os = os.id_os GROUP by os.name'
);
$all_group_id = array_merge($all_group_id, $all_group_id_node);
$group_events = array_merge($group_events, $group_events_node);
$group_os = array_merge($group_os, $group_os_node);
} catch (\Exception $e) {
$nd->disconnect();
$modules_regex_node = [];
} finally {
$nd->disconnect();
}
$description = __('Data view of all groups');
$icon = '';
}
} else {
$all_group_id = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo');
$group_events = db_get_all_rows_sql(
'SELECT COUNT(te.id_evento) as count_events, ta.alias
@ -2606,14 +2948,87 @@ function reporting_html_group_report($table, $item, $pdf=0)
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente
GROUP BY te.id_agente'
);
$group_os = db_get_all_rows_sql(
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
FROM tconfig_os as os
INNER JOIN tagente as ta ON ta.id_os = os.id_os GROUP by os.name'
);
}
$group_id = [];
foreach ($all_group_id as $group) {
$group_id[] = $group['id_grupo'];
}
$description = __('Data view of all groups');
$icon = '';
} else {
$group_id = db_get_value('id_grupo', 'tgrupo', 'nombre', $item['subtitle']);
if (is_metaconsole() === true && $item['server_name'] === 'all' || $item['server_name'] === '0') {
$nodes = metaconsole_get_connections();
foreach ($nodes as $node) {
try {
$nd = new Node($node['id']);
$nd->connect();
$group_id_node = db_get_value('id_grupo', 'tgrupo', 'nombre', $item['subtitle']);
$description = db_get_value('description', 'tgrupo', 'id_grupo', $group_id_node);
$icon_url = db_get_value('icon', 'tgrupo', 'id_grupo', $group_id_node);
$icon = html_print_image(
'images/'.$icon_url,
true,
[
'title' => $item['subtitle'],
'class' => 'main_menu_icon invert_filter',
]
);
$childrens = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo WHERE parent = '.$group_id_node);
$total_agents = db_get_all_rows_sql('SELECT COUNT(id_agente) as total FROM tagente where id_grupo = '.$group_id_node);
if ($childrens !== false && (int) $total_agents[0]['total'] !== $item['data']['group_stats']['total_agents']) {
$array_group_id = [];
$array_group_id[] = $group_id_node;
foreach ($childrens as $group) {
$array_group_id[] = $group['id_grupo'];
}
$group_id_node = $array_group_id;
$explode_group_id = implode(',', $group_id_node);
} else {
$explode_group_id = $group_id_node;
}
$group_events_node = db_get_all_rows_sql(
'SELECT COUNT(te.id_evento) as count_events, ta.alias
FROM tevento as te
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente WHERE te.id_grupo IN ('.$explode_group_id.')
GROUP BY te.id_agente'
);
$group_os_node = db_get_all_rows_sql(
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
FROM tconfig_os as os
INNER JOIN tagente as ta ON ta.id_os = os.id_os
WHERE ta.id_grupo IN ('.$explode_group_id.') GROUP by os.name'
);
if (is_array($group_events_node) === true) {
$group_events = array_merge($group_events, $group_events_node);
}
if (is_array($group_os_node) === true) {
$group_os = array_merge($group_os, $group_os_node);
}
} catch (\Exception $e) {
$nd->disconnect();
} finally {
$nd->disconnect();
}
}
} else {
$description = db_get_value('description', 'tgrupo', 'id_grupo', $group_id);
$icon_url = db_get_value('icon', 'tgrupo', 'id_grupo', $group_id);
$icon = html_print_image(
@ -2655,6 +3070,7 @@ function reporting_html_group_report($table, $item, $pdf=0)
WHERE ta.id_grupo IN ('.$explode_group_id.') GROUP by os.name'
);
}
}
if ($metaconsole_connected === true) {
metaconsole_restore_db();
@ -2764,9 +3180,11 @@ function reporting_html_group_report($table, $item, $pdf=0)
$options = [];
$labels = [];
foreach ($group_os as $value) {
$data[$value['name_os']] = $value['count_os'];
$data[$value['name_os']] += $value['count_os'];
if (array_search($value['name_os'], $labels) === false) {
$labels[] = io_safe_output($value['name_os']);
}
}
$options = [
'width' => $graph_width,

View File

@ -963,6 +963,43 @@ function reports_get_report_types($template=false, $not_editor=false)
'name' => __('Network configuration changes'),
];
if (enterprise_installed() === true) {
$types['top_n_agents_sh'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N agents with the worst score'),
];
$types['top_n_checks_failed'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N most frequent failed checks'),
];
$types['top_n_categories_checks'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N checks failed by category'),
];
$types['vul_by_cat'] = [
'optgroup' => __('Security hardening'),
'name' => __('Vulnerabilities by category'),
];
$types['list_checks'] = [
'optgroup' => __('Security hardening'),
'name' => __('List of checks'),
];
$types['scoring'] = [
'optgroup' => __('Security hardening'),
'name' => __('Scoring by date'),
];
$types['evolution'] = [
'optgroup' => __('Security hardening'),
'name' => __('Evolution'),
];
}
return $types;
}

View File

@ -283,6 +283,10 @@ function servers_get_performance($filter=[])
}
foreach ($counts as $c) {
if (empty($c['modules']) === true) {
continue;
}
switch ($c['server_type']) {
case SERVER_TYPE_DATA:
$data['total_local_modules'] = $c['modules'];
@ -292,7 +296,7 @@ function servers_get_performance($filter=[])
case SERVER_TYPE_SNMP:
case SERVER_TYPE_ENTERPRISE_ICMP:
case SERVER_TYPE_ENTERPRISE_SNMP:
$data['total_network_modules'] = $c['modules'];
$data['total_network_modules'] += $c['modules'];
break;
case SERVER_TYPE_PLUGIN:

View File

@ -708,6 +708,13 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$row['data'] = human_time_description_raw($agent['intervalo']);
$table->data['interval'] = $row;
if (isset($agent['quiet']) && $agent['quiet']) {
$row = [];
$row['title'] = __('Quiet mode enabled');
$row['data'] = ui_print_help_tip(__('This agent would not raise events or alerts'), true);
$table->data['quiet'] = $row;
}
// Comments.
$row = [];
$row['title'] = __('Description');

View File

@ -99,23 +99,27 @@ function ui_print_truncate_text(
$forced_title=false
) {
global $config;
$truncate_at_end = false;
if (is_string($numChars)) {
switch ($numChars) {
case 'agent_small':
$numChars = $config['agent_size_text_small'];
$truncate_at_end = (bool) $config['truncate_agent_at_end'];
break;
case 'agent_medium':
$numChars = $config['agent_size_text_medium'];
$truncate_at_end = (bool) $config['truncate_agent_at_end'];
break;
case 'module_small':
$numChars = $config['module_size_text_small'];
$truncate_at_end = (bool) $config['truncate_module_at_end'];
break;
case 'module_medium':
$numChars = $config['module_size_text_medium'];
$truncate_at_end = (bool) $config['truncate_module_at_end'];
break;
case 'description':
@ -147,6 +151,13 @@ function ui_print_truncate_text(
// '/2' because [...] is in the middle of the word.
$half_length = intval(($numChars - 3) / 2);
if ($truncate_at_end === true) {
// Recover the html entities to avoid XSS attacks.
$truncateText = ($text_has_entities) ? io_safe_input(substr($text_html_decoded, 0, $numChars)) : substr($text_html_decoded, 0, $numChars);
if (strlen($text_html_decoded) > $numChars) {
$truncateText .= '...';
}
} else {
// Depending on the strange behavior of mb_strimwidth() itself,
// the 3rd parameter is not to be $numChars but the length of
// original text (just means 'large enough').
@ -168,6 +179,7 @@ function ui_print_truncate_text(
// Recover the html entities to avoid XSS attacks.
$truncateText = ($text_has_entities) ? io_safe_input($truncateText).$suffix.io_safe_input($truncateText2) : $truncateText.$suffix.$truncateText2;
}
if ($showTextInTitle) {
if ($style === null) {
@ -597,12 +609,20 @@ function ui_print_timestamp($unixtime, $return=false, $option=[])
$tag = 'span';
}
if (empty($option['style']) === true) {
$style = 'class="'.($option['class'] ?? 'nowrap').'"';
if (empty($option['class']) === false) {
$class = 'class="nowrap '.$option['class'].'"';
} else {
$style = 'style="'.$option['style'].'"';
$class = 'class="nowrap"';
}
if (empty($option['style']) === false) {
$style = 'style="'.$option['style'].'"';
} else {
$style = 'style=""';
}
$style .= ' '.$class;
if (empty($option['prominent']) === false) {
$prominent = $option['prominent'];
} else {
@ -1474,6 +1494,7 @@ function ui_format_alert_row(
$actionText .= ui_print_help_tip(__('The default actions will be executed every time that the alert is fired and no other action is executed'), true);
// Is possible manage actions if have LW permissions in the agent group of the alert module.
if (is_metaconsole() === true) {
if (check_acl($config['id_user'], $id_group, 'LM')) {
$actionText .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&delete_action=1&id_alert='.$alert['id'].'&id_agent='.$agente['alias'].'&id_action='.$action['original_id'].'" onClick="if (!confirm(\' '.__('Are you sure you want to delete alert action?').'\')) return false;">'.html_print_image(
'images/delete.svg',
@ -1501,6 +1522,7 @@ function ui_format_alert_row(
);
$actionText .= html_print_input_hidden('id_agent_module', $alert['id_agent_module'], true);
}
}
$actionText .= '<div id="update_action-div-'.$alert['id'].'" class="invisible">';
$actionText .= '</div>';
@ -1634,7 +1656,7 @@ function ui_format_alert_row(
$data[$index['actions']] .= '<tr class="datos2">';
$data[$index['actions']] .= '<td class="w50p">'.html_print_label_input_block(
__('Agent'),
ui_print_truncate_text($agente['alias'], 'agent_small', false, true, true, '[&hellip;]')
ui_print_truncate_text($agente['alias'], 'agent_medium', false, true, true, '[&hellip;]')
).'</td>';
$data[$index['actions']] .= '<td class="w50p">'.html_print_label_input_block(
__('Module'),
@ -3913,6 +3935,11 @@ function ui_print_datatable(array $parameters)
$parameters['toggle_collapsed'] = true;
}
$parameters['startDisabled'] = false;
if (isset($parameters['start_disabled']) && $parameters['start_disabled'] === true) {
$parameters['startDisabled'] = true;
}
$columns_tmp = [];
foreach ($parameters['columns'] as $k_column => $v_column) {
if (isset($parameters['columns'][$k_column]['text']) === true) {
@ -4126,7 +4153,7 @@ function ui_print_datatable(array $parameters)
// Base table.
$table = '<table id="'.$table_id.'" ';
$table .= 'class="'.$parameters['class'].'"';
$table .= 'class="invisible '.$parameters['class'].'"';
$table .= 'style="box-sizing: border-box;'.$parameters['style'].'">';
$table .= '<thead><tr class="datatables_thead_tr">';
@ -4200,13 +4227,18 @@ function ui_print_datatable(array $parameters)
$info_msg_arr['message'] = $emptyTable;
$info_msg_arr['div_class'] = 'info_box_container invisible_important datatable-msg-info-'.$table_id;
$spinner = '<div id="'.$table_id.'-spinner" class="spinner-fixed"><span></span><span></span><span></span><span></span></div>';
$info_msg_arr_filter = [];
$info_msg_arr_filter['message'] = __('Please apply a filter to display the data.');
$info_msg_arr_filter['div_class'] = 'info_box_container invisible_important datatable-msg-info-filter-'.$table_id;
// TODO This widget should take a return: ui_print_info_message($info_msg_arr, '', true)
$info_msg = '<div>'.ui_print_info_message($info_msg_arr).'</div>';
$spinner = '<div id="'.$table_id.'-spinner" class="invisible spinner-fixed"><span></span><span></span><span></span><span></span></div>';
$info_msg = '<div>'.ui_print_info_message($info_msg_arr, '', true).'</div>';
$info_msg_filter = '<div>'.ui_print_info_message($info_msg_arr_filter, true).'</div>';
$err_msg = '<div id="error-'.$table_id.'"></div>';
$output = $info_msg.$err_msg.$filter.$extra.$spinner.$table.$js;
$output = $info_msg.$info_msg_filter.$err_msg.$filter.$extra.$spinner.$table.$js;
if (is_ajax() === false) {
ui_require_css_file('datatables.min', 'include/styles/js/');
ui_require_css_file('tables');

View File

@ -498,8 +498,12 @@ function radar_graph(
$chart_data,
$options
) {
if (count($chart_data[0]['data']) > 0) {
$chart = get_build_setup_charts('RADAR', $options, $chart_data);
return $chart->render(true, true);
} else {
return graph_nodata_image([]);
}
}
@ -515,6 +519,26 @@ function line_graph(
$chart_data,
$options
) {
if (empty($chart_data) === true) {
if (isset($options['ttl']) === true
&& (int) $options['ttl'] === 2
) {
$options['base64'] = true;
}
return graph_nodata_image($options);
}
if (isset($options['ttl']) === true && (int) $options['ttl'] === 2) {
$params = [
'chart_data' => $chart_data,
'options' => $options,
'return_img_base_64' => true,
];
return generator_chart_to_pdf('line_graph', $params);
}
$chart = get_build_setup_charts('LINE', $options, $chart_data);
return $chart->render(true, true);
}

View File

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

View File

@ -653,7 +653,8 @@ $("[data-button=export]").click(function(e) {
});
});
$("#button-export-modal").click(function(e) {
// Export graph.
function exportCustomGraph() {
const filter = parseInt($("#export-filter-id").val());
const group = parseInt($("#export-group-id").val());
@ -682,8 +683,19 @@ $("#button-export-modal").click(function(e) {
}
}
});
} else {
confirmDialog({
title: titleExportError,
message: messageExportError,
hideCancelButton: true,
onAccept: function() {
$(
"button.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close"
).click();
}
});
}
}
// Remove graph.
function removeGraph(e) {

View File

@ -25,7 +25,15 @@ function progress_task_list(id, title) {
draggable: true,
closeOnEscape: true,
width: 800,
height: 600,
height: "auto",
buttons: [
{
text: "OK",
click: function() {
$(this).dialog("close");
}
}
],
close: function() {
if (xhr != null) xhr.abort();
if (timeoutRef != null) clearTimeout(timeoutRef);
@ -35,13 +43,17 @@ function progress_task_list(id, title) {
// Function var.
var handleFetchTaskList = function(err, data) {
if (err) {
console.error(err);
let err_text = err.toString();
err_text = err_text.replace("Error: ", "");
err_text =
"<b>Error</b><br/>" + err_text[0].toUpperCase() + err_text.substring(1);
$elem.html(err_text);
}
if (data.error) {
// TODO: Show info about the problem.
$elem.html(data.error);
} else {
$elem.html(data.html);
if (data) {
let split_data = data.split('{"html":');
data = '{"html":' + split_data[1];
data = JSON.parse(data);
$elem.html(data.html + " " + split_data[0]);
}
if (!$elem.dialog("isOpen")) $elem.dialog("open");
@ -71,7 +83,7 @@ function fetchTaskList(id, callback) {
},
type: "POST",
url: $("#ajax-url").val(),
dataType: "json",
dataType: "text",
success: function(data) {
callback(null, data);
},

View File

@ -256,7 +256,7 @@ class InventoryWidget extends Widget
'arguments' => [
'name' => 'free_search',
'type' => 'text',
'class' => 'w100p',
'class' => 'w96p',
'input_class' => 'flex-row',
'value' => $values['freeSearch'],
'return' => true,
@ -612,7 +612,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -642,8 +642,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
'images/arrow_down_green.png',
'images/arrow_right_green.png',
false,
@ -666,8 +666,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
);
}
@ -682,7 +682,10 @@ class InventoryWidget extends Widget
'',
'',
false,
false
false,
'',
'white-box-content',
'box-flat white_table_graph w96p'
);
}
} else {
@ -729,7 +732,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -759,8 +762,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
'images/arrow_down_green.png',
'images/arrow_right_green.png',
false,
@ -782,8 +785,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
);
}
@ -895,7 +898,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -925,8 +928,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
'images/arrow_down_green.png',
'images/arrow_right_green.png',
false,
@ -947,7 +950,10 @@ class InventoryWidget extends Widget
'',
'',
false,
false
false,
'',
'white-box-content',
'box-flat white_table_graph w96p'
);
}
} else {
@ -986,7 +992,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -1022,7 +1028,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -1049,7 +1055,7 @@ class InventoryWidget extends Widget
$id_agente = $inventory_id_agent;
$agentes = [];
$data = [];
$class = 'info_table w100p';
$class = 'info_table w96p';
$style = 'width: 100%; font-size: 100px !important;';
$ordering = true;
$searching = false;

View File

@ -663,11 +663,14 @@ class Group extends Entity
ultimo_contacto_remoto,
fired_count
FROM tagente t
LEFT JOIN tagent_secondary_group g ON g.id_agent = t.id_agente
WHERE disabled = 0 AND
total_count <> notinit_count AND
id_grupo IN (%s)
(id_grupo IN (%s) OR id_group IN (%s))
%s %s',
implode(',', $id_groups),
implode(',', $id_groups),
$order,
$pagination
);
@ -686,11 +689,13 @@ class Group extends Entity
ultimo_contacto_remoto,
fired_count
FROM tagente t
LEFT JOIN tagent_secondary_group g ON g.id_agent = t.id_agente
WHERE disabled = 0 AND
total_count <> notinit_count AND
id_grupo IN (%s)
(id_grupo IN (%s) OR id_group IN (%s))
%s',
implode(',', $id_groups),
implode(',', $id_groups),
$order,
);

View File

@ -565,3 +565,7 @@ div.container-filter-buttons {
justify-content: space-between;
align-items: center;
}
.ui-state-active {
border-radius: 0px !important;
}

View File

@ -4,7 +4,6 @@
.ui-dialog .ui-corner-all .ui-widget {
border-radius: 0;
margin: 0;
padding: 0;
border: none;
}
@ -217,7 +216,7 @@ a.ui-state-default > span:hover {
color: #000;
}
.ui-widget-header {
height: 20px !important;
height: fit-content !important;
}
.ui-dialog .ui-widget-header {
margin: 3px 3px 0px 3px;

View File

@ -239,6 +239,11 @@
background-size: 18px;
}
.icon_security {
background: url(../../images/menu/security.svg) no-repeat 50% 50%;
background-size: 18px;
}
.icon_oper-agents {
background: url(../../images/menu/monitoring.svg) no-repeat 50% 50%;
background-size: 18px;

View File

@ -5089,7 +5089,7 @@ div#dialog_messages table th:last-child {
position: absolute;
cursor: pointer;
top: 5px;
left: 0;
left: 5px;
right: 0;
bottom: 0;
background-color: #ccc;
@ -12566,3 +12566,21 @@ tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input {
.ui-date-range-in > a {
background-color: #81b92e3b !important;
}
.div-report_export_filter {
left: 0em;
top: 0em;
position: relative;
}
.button-export_filter {
position: relative;
left: 17em;
top: -38px;
width: 30%;
}
.filter_label_position_after {
position: relative;
top: -92px;
}

View File

@ -31,6 +31,26 @@
margin: 10px;
}
.col-md-1 {
width: 15%;
margin: 10px;
}
.col-md-2 {
width: 30%;
margin: 10px;
}
.col-md-7 {
width: 40%;
margin: 10px;
}
.col-md-9 {
width: 63%;
margin: 10px;
}
.text-fail {
font-size: 18px;
color: #e63c52;
@ -75,7 +95,7 @@
margin-right: 10px;
}
.issues-audit {
.resume-audit {
margin: 11px 12px 0px 18px;
}
@ -88,7 +108,15 @@
margin: 21px auto;
}
.time-line {
.custom-filter label {
font-size: 13px !important;
margin-right: 10px;
}
#time-line-graph {
height: 300px;
}
.time-line,
#time-line-graph {
max-height: 300px;
}
.summary_categories {
@ -96,8 +124,8 @@
margin: 20px;
}
#list_total_resume .sorting_asc {
background-image: none;
.sorting_asc {
background-image: none !important;
}
#form_list_resume {
@ -105,31 +133,67 @@
align-items: flex-end;
}
#form_list_total_resume {
#form_list_total_resume,
#form_list_total_failed {
display: flex;
align-items: flex-end;
}
.dt-buttons {
display: flex;
margin-top: 10px;
}
#date-result {
padding-left: 4px !important;
}
.total-agents {
font-weight: 800;
font-size: 40px;
text-align: center;
}
.avg-scoring {
font-size: 25px;
font-weight: 700;
line-height: normal;
}
.separator-bar {
font-size: 50px;
}
#filter-range-date {
width: 90%;
margin: 0 auto;
align-items: flex-end;
}
#filter-category > div,
#filter-group > div {
display: flex;
align-items: center;
}
@media (max-width: 1500px) {
.col-md-3 {
width: 40%;
}
.col-md-1 {
width: 20%;
}
.col-md-2 {
width: 45%;
}
.col-md-6 {
width: 88%;
}
.issues-audit {
.col-md-7 {
width: 80%;
}
.resume-audit {
justify-content: center;
}
.time-line {
.time-line,
#time-line-graph {
max-height: 230px;
}
}

View File

@ -45,6 +45,7 @@ div.container-button-play > button#button-start-search {
#tabs-sound-modal ul.tabs-sound-modal-options li.ui-tabs-active {
border-bottom: 2px solid #82b92e;
border-radius: 0px !important;
}
#tabs-sound-modal ul.wizard li label {

View File

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

View File

@ -349,12 +349,6 @@ if (is_metaconsole() === true) {
}
}
$alert_action = empty(alerts_get_alert_actions_filter()) === false
? alerts_get_alert_actions_filter()
: ['' => __('No actions')];
ob_start();
if ($agent_view_page === true) {
@ -407,7 +401,7 @@ if ($agent_view_page === true) {
[
'id' => 'alerts_status_datatable',
'class' => 'info_table',
'style' => 'width: 99%;',
'style' => 'width: 100%;',
'columns' => $columns,
'column_names' => $column_names,
'no_sortable_columns' => $no_sortable_columns,
@ -439,6 +433,7 @@ if ($agent_view_page === true) {
$strict_user
),
],
'start_disabled' => true,
]
);
}

View File

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

View File

@ -201,6 +201,10 @@ $search_recursive_groups = get_parameter(
'filter[search_recursive_groups]',
($filter['search_recursive_groups'] ?? '')
);
$search_recursive_groups = get_parameter(
'filter[private_filter_event]',
($filter['private_filter_event'] ?? '')
);
$id_group_filter = get_parameter(
'filter[id_group_filter]',
($filter['id_group'] ?? '')
@ -509,10 +513,22 @@ if (is_ajax() === true) {
$tmp->evento = str_replace('"', '', io_safe_output($tmp->evento));
$event_text = $tmp->evento;
if (strlen($tmp->evento) >= 40) {
$tmp->evento = ui_print_truncate_text(
$tmp->evento,
40,
$config['item_title_size_text'],
false,
true,
false,
'&hellip;',
true,
true,
);
if (empty($tmp->module_name) === false) {
$tmp->module_name = ui_print_truncate_text(
$tmp->module_name,
'module_medium',
false,
true,
false,
@ -523,11 +539,9 @@ if (is_ajax() === true) {
}
if (empty($tmp->module_name) === false) {
$tmp->module_name = io_safe_output($tmp->module_name);
if (strlen($tmp->module_name) >= 20) {
$tmp->module_name = ui_print_truncate_text(
$tmp->module_name,
20,
'module_medium',
false,
true,
false,
@ -536,7 +550,6 @@ if (is_ajax() === true) {
true,
);
}
}
if (empty($tmp->comments) === false) {
$tmp->comments = ui_print_comments($tmp->comments, 20);
@ -564,11 +577,9 @@ if (is_ajax() === true) {
}
}
$tmp->agent_name = io_safe_output($tmp->agent_name);
if (strlen($tmp->agent_name) >= 10) {
$tmp->agent_name = ui_print_truncate_text(
$tmp->agent_name,
10,
'agent_medium',
false,
true,
false,
@ -576,7 +587,6 @@ if (is_ajax() === true) {
true,
true,
);
}
$tmp->id_extra = io_safe_output($tmp->id_extra);
if (strlen($tmp->id_extra) >= 10) {
@ -944,10 +954,11 @@ if (is_ajax() === true) {
// Module name.
$tmp->id_agentmodule = $tmp->module_name;
/*
if (strlen($tmp->id_agentmodule) >= 10) {
$tmp->id_agentmodule = ui_print_truncate_text(
$tmp->id_agentmodule,
10,
'module_small',
false,
true,
false,
@ -955,7 +966,7 @@ if (is_ajax() === true) {
true,
true,
);
}
}*/
// Options.
// Show more.
@ -1327,6 +1338,7 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false
$filter_only_alert = $filter['filter_only_alert'];
$search_secondary_groups = ($filter['search_secondary_groups'] ?? 0);
$private_filter_event = ($filter['private_filter_user'] ?? 0);
$search_recursive_groups = ($filter['search_recursive_groups'] ?? 0);
$id_group_filter = $filter['id_group_filter'];
$date_from = $filter['date_from'];
@ -1879,6 +1891,9 @@ if (enterprise_hook(
* Load filter form.
*/
// User private filter process.
$inputs[] = html_print_input_hidden('id_filter_event', $load_filter_id, true);
// Group.
if ($id_group === null) {
$id_group = 0;
@ -1912,7 +1927,7 @@ $data = html_print_checkbox_switch(
$in_group = '<div class="display-initial">';
$in_group .= $data;
$in_group .= '<label class="vert-align-bottom pdd_r_20px">';
$in_group .= '<label class="vert-align-bottom pdd_r_15px">';
$in_group .= __('Group recursion');
$in_group .= ui_print_help_tip(
__('WARNING: This could cause a performace impact.'),
@ -2063,6 +2078,8 @@ $in = '<div class="filter_input"><label>'.__('Severity').'</label>';
$in .= $data.'</div>';
$inputs[] = $in;
// User private filter.
$inputs[] = html_print_input_hidden('private_filter_event', $private_filter_event, true);
// Trick view in table.
$inputs[] = '<div class="w100p pdd_t_15px"></div>';
@ -3356,7 +3373,8 @@ $(document).ready( function() {
data: {
page: 'include/ajax/events',
save_filter_modal: 1,
current_filter: $('#latest_filter_id').val()
current_filter: $('#hidden-id_filter_event').val(),
private_filter_event: $('#hidden-private_filter_event').val()
},
success: function (data){
$('#save-modal-filter')

View File

@ -31,6 +31,7 @@ global $config;
require_once '../../include/config.php';
require_once '../../include/functions.php';
require_once '../../include/functions_db.php';
require_once '../../include/functions_events.php';
require_once '../../include/auth/mysql.php';
require_once $config['homedir'].'/include/class/HTML.class.php';

View File

@ -32,55 +32,65 @@ use PandoraFMS\Enterprise\Metaconsole\Node;
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_inventory.php';
// Get different date to search the report.
$utimestamp = (int) get_parameter('date_end', 0);
$datetime_end = strtotime($utimestamp.' '.$time_end);
// Calculate new inteval for all reports.
$date_end = get_parameter('date_end', 0);
$time_end = get_parameter('time_end');
$datetime_end = strtotime($date_end.' '.$time_end);
$custom_date = get_parameter('custom_date', 0);
$date = get_parameter('date', SECONDS_1DAY);
$date_text = get_parameter('date_text', SECONDS_1DAY);
$date_init_less = (strtotime(date('Y-m-j')) - SECONDS_1DAY);
$range = get_parameter('utimestamp', SECONDS_1DAY);
$date_text = get_parameter('utimestamp_text', SECONDS_1DAY);
$date_init_less = (strtotime(date('Y/m/d')) - SECONDS_1DAY);
$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
$datetime_init = strtotime($date_init.' '.$time_init);
if ($custom_date === '1') {
if ($datetime_init >= $datetime_end) {
$datetime_init = $date_init_less;
}
$date_init = date('Y/m/d H:i:s', $datetime_init);
$date_end = date('Y/m/d H:i:s', $datetime_end);
$period = ($datetime_end - $datetime_init);
} else if ($custom_date === '2') {
$date_units = get_parameter('date_units');
$utimestamp = date('Y/m/d H:i:s');
$date_start = date('Y/m/d H:i:s', (strtotime($utimestamp) - ($date_text * $date_units)));
$period = (strtotime($utimestamp) - strtotime($date_start));
} else if (in_array($date, ['this_week', 'this_month', 'past_week', 'past_month'])) {
if ($date === 'this_week') {
$date_units = get_parameter('utimestamp_units');
$date_end = date('Y/m/d H:i:s');
$date_init = date('Y/m/d H:i:s', (strtotime($date_end) - ((int) $date_text * (int) $date_units)));
$period = (strtotime($date_end) - strtotime($date_init));
} else if (in_array($range, ['this_week', 'this_month', 'past_week', 'past_month'])) {
if ($range === 'this_week') {
$monday = date('Y/m/d', strtotime('last monday'));
$sunday = date('Y/m/d', strtotime($monday.' +6 days'));
$period = (strtotime($sunday) - strtotime($monday));
$date_init = $monday;
$utimestamp = $sunday;
} else if ($date === 'this_month') {
$utimestamp = date('Y/m/d', strtotime('last day of this month'));
$date_end = $sunday;
} else if ($range === 'this_month') {
$date_end = date('Y/m/d', strtotime('last day of this month'));
$first_of_month = date('Y/m/d', strtotime('first day of this month'));
$period = (strtotime($utimestamp) - strtotime($first_of_month));
} else if ($date === 'past_month') {
$utimestamp = date('Y/m/d', strtotime('last day of previous month'));
$date_init = $first_of_month;
$period = (strtotime($date_end) - strtotime($first_of_month));
} else if ($range === 'past_month') {
$date_end = date('Y/m/d', strtotime('last day of previous month'));
$first_of_month = date('Y/m/d', strtotime('first day of previous month'));
$period = (strtotime($utimestamp) - strtotime($first_of_month));
} else if ($date === 'past_week') {
$utimestamp = date('Y-m-d', strtotime('sunday', strtotime('last week')));
$first_of_week = date('Y-m-d', strtotime('monday', strtotime('last week')));
$period = (strtotime($utimestamp) - strtotime($first_of_week));
$date_init = $first_of_month;
$period = (strtotime($date_end) - strtotime($first_of_month));
} else if ($range === 'past_week') {
$date_end = date('Y/m/d', strtotime('sunday', strtotime('last week')));
$first_of_week = date('Y/m/d', strtotime('monday', strtotime('last week')));
$date_init = $first_of_week;
$period = (strtotime($date_end) - strtotime($first_of_week));
}
} else {
$utimestamp = date('Y/m/d H:i:s');
$date_start = date('Y/m/d H:i:s', (strtotime($utimestamp) - $date));
$period = (strtotime($utimestamp) - strtotime($date_start));
$date_end = date('Y/m/d H:i:s');
$date_init = date('Y/m/d H:i:s', (strtotime($date_end) - $range));
$period = (strtotime($date_end) - strtotime($date_init));
}
$date_init = strtotime($date_init);
$utimestamp = strtotime($date_end);
if (is_ajax() === true) {
$get_csv_url = (bool) get_parameter('get_csv_url');
$get_data_basic_info = (bool) get_parameter('get_data_basic_info');
@ -383,7 +393,6 @@ $inventory_id_group = (int) get_parameter('id_group');
$inventory_search_string = (string) get_parameter('search_string');
$order_by_agent = (bool) get_parameter('order_by_agent');
$export = (string) get_parameter('export');
$utimestamp = (int) get_parameter('utimestamp');
$submit_filter = (bool) get_parameter('srcbutton');
$pagination_url_parameters = [
@ -665,14 +674,13 @@ $params['return'] = true;
$params['show_helptip'] = true;
$params['input_name'] = 'agent';
$params['value'] = $inventory_agent;
$params['selectbox_id'] = 'module_inventory_general_view';
$params['javascript_is_function_select'] = true;
$params['javascript_function_action_after_select'] = 'this.form.submit';
$params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent';
$params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $inventory_id_agent;
$params['javascript_function_action_after_select'] = 'loadModulesFromAgent';
if ($is_metaconsole === true) {
$params['print_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-autocomplete_id_server';
@ -734,10 +742,10 @@ if (is_metaconsole() === false) {
'utimestamp',
true,
get_parameter('utimestamp', SECONDS_1DAY),
$date_init,
$time_init,
date('Y/m/d'),
date('H:i:s'),
date('Y/m/d', $date_init),
date('H:i:s', $date_init),
date('Y/m/d', $utimestamp),
date('H:i:s', $utimestamp),
$date_text
)
);
@ -1354,7 +1362,7 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
/* <![CDATA[ */
$(document).ready (function () {
<?php if (is_metaconsole() === true) : ?>
active_inventory_submit();
//active_inventory_submit();
<?php endif; ?>
$("#id_group").click (
function () {
@ -1432,5 +1440,38 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
closeText: '<?php echo __('Close'); ?>'
});*/
});
function loadModulesFromAgent(e){
const id_agent = $('#hidden-autocomplete_id_agent').val();
const text_agent = $('#text-agent').val();
let server = 0;
if($('#hidden-autocomplete_id_server').length > 0) {
server = $('#hidden-autocomplete_id_server').val();
}
if(text_agent === 'All') return;
jQuery.ajax ({
data: {
id_agent,
page: 'include/ajax/inventory.ajax',
id_server: server
},
type: "POST",
url: action="<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
dataType: "json",
success: function (data) {
if (data) {
console.log(data);
$("#module_inventory_general_view").empty();
$("#module_inventory_general_view").append ($("<option value=basic>Basic info</option>"));
$("#module_inventory_general_view").append ($("<option value=0>All</option>"));
jQuery.each (data, function (id, value) {
$("#module_inventory_general_view").append ($("<option value=" + id + ">" + value + "</option>"));
});
}
}
});
}
/* ]]> */
</script>

View File

@ -443,6 +443,8 @@ if ($access_console_node === true) {
$menu_operation['network']['sub'] = $sub;
}
enterprise_hook('security_menu');
// End networkview.
// Reports read.
if (check_acl($config['id_user'], 0, 'RR') || check_acl($config['id_user'], 0, 'RW') || check_acl($config['id_user'], 0, 'RM')) {

View File

@ -636,7 +636,7 @@ $data[2] = html_print_submit_button(
'class' => 'mini w30p',
'icon' => 'next',
'style' => 'margin-left: 208px; width: 130px;',
'onclick' => '',
'onclick' => 'exportCustomGraph()',
],
true
);
@ -937,6 +937,10 @@ const titleExport = "<?php echo __('Export to custom graph'); ?>";
const titleExportConfirm = "<?php echo __('Exported successfully'); ?>";
const messageExportConfirm = "<?php echo __('graphs have been created in Custom graphs'); ?>";
const titleExportError = "<?php echo __('Error to export'); ?>";
const messageExportError = "<?php echo __('Filter cannot be None'); ?>";
const titleRemoveConfirm = "<?php echo __('Delete graph'); ?>";
const messageRemoveConfirm = "<?php echo __('Do you want to delete the graph? Remember to save the changes.'); ?>";
</script>

View File

@ -60,12 +60,29 @@ $datetime_end = strtotime($date_end.' '.$time_end);
$custom_date = get_parameter('custom_date', 0);
$date = get_parameter('date', SECONDS_1DAY);
$date_text = get_parameter('date_text', SECONDS_1DAY);
$custom_date_end = '';
$filter_type = '';
$custom_period = false;
if ($custom_date === '1') {
if ($date === 'chose_range') {
$date_init = get_parameter('date_init', 0);
$date_init = explode(' ', $date_init);
$date_init = $date_init[0];
$date_init .= ' '.get_parameter('time_init', '00:00:00');
$custom_date_end = get_parameter('date_end', 0);
$custom_date_end .= ' '.get_parameter('time_end', '00:00:00');
$date_end = date('Y/m/d H:i:s');
$period = (strtotime($date_end) - strtotime($date_init));
$custom_period = (strtotime($custom_date_end) - strtotime($date_init));
$filter_type = 'chose_range';
} else {
if ($datetime_init >= $datetime_end) {
$datetime_init = $date_init_less;
}
$period = ($datetime_end - $datetime_init);
}
} else if ($custom_date === '2') {
$date_units = get_parameter('date_units');
$date_end = date('Y/m/d H:i:s');
@ -73,16 +90,18 @@ if ($custom_date === '1') {
$period = (strtotime($date_end) - strtotime($date_start));
} else if (in_array($date, ['this_week', 'this_month', 'past_week', 'past_month'])) {
if ($date === 'this_week') {
$monday = date('Y/m/d', strtotime('last monday'));
$sunday = date('Y/m/d', strtotime($monday.' +6 days'));
$period = (strtotime($sunday) - strtotime($monday));
$date_init = $monday;
$date_end = $sunday;
// Last monday.
$date_init = date('Y/m/d H:i:s', strtotime('last monday'));
// $date_end = date('Y/m/d H:i:s', strtotime($date_init.' +6 days'));
$date_end = date('Y/m/d H:i:s');
$period = (strtotime($date_end) - strtotime($date_init));
$filter_type = 'this_week';
} else if ($date === 'this_month') {
$date_end = date('Y/m/d', strtotime('last day of this month'));
// $date_end = date('Y/m/d', strtotime('last day of this month'));
$date_end = date('Y/m/d H:i:s');
$first_of_month = date('Y/m/d', strtotime('first day of this month'));
$period = (strtotime($date_end) - strtotime($first_of_month));
$filter_type = 'this_month';
} else if ($date === 'past_month') {
$date_end = date('Y/m/d', strtotime('last day of previous month'));
$first_of_month = date('Y/m/d', strtotime('first day of previous month'));
@ -197,7 +216,7 @@ if (check_acl_restricted_all($config['id_user'], $report_group, 'RW')) {
$options['view'] = [
'active' => true,
'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$id_report.'&pure='.$pure.'">'.html_print_image(
'images/eye.png',
'images/see-details@svg.svg',
true,
[
'title' => __('View report'),
@ -265,10 +284,9 @@ ui_print_standard_header(
// ------------------------ INIT FORM -----------------------------------
$table2 = new stdClass();
$table2->id = 'controls_table';
$table2->size[2] = '50%';
$table2->size[3] = '50%';
$table2->style[0] = 'text-align:center';
$table2->style[1] = 'text-align:center';
$table2->size[2] = '20%';
$table2->style[3] = 'position:absolute !important; left: auto !important;';
// $table2->style[3] = 'position:absolute !important; right: 1em !important;';
$table2->styleTable = 'border:none';
if (defined('METACONSOLE')) {
@ -294,11 +312,19 @@ if ($html_menu_export === ENTERPRISE_NOT_HOOK) {
$html_menu_export = '';
}
if ((bool) is_metaconsole() === true) {
$table2->data[0][2] = html_print_label_input_block(
__('Date').':<br>',
html_print_select_date_range('date', true, get_parameter('date', SECONDS_1DAY), $date_init, $time_init, date('Y/m/d'), date('H:i:s'), $date_text)
__('Date').' ',
html_print_select_date_range('date', true, get_parameter('date', SECONDS_1DAY), $date_init, $time_init, date('Y/m/d'), date('H:i:s'), $date_text),
);
} else {
$table2->data[0][2] = html_print_label_input_block(
__('Date').' ',
html_print_select_date_range('date', true, get_parameter('date', SECONDS_1DAY), $date_init, $time_init, date('Y/m/d'), date('H:i:s'), $date_text),
['label_class' => 'filter_label_position_before']
);
}
$table2->data[0][3] = $html_menu_export;
@ -307,6 +333,7 @@ $searchForm = '<form method="post" action="'.$url.'&pure='.$config['pure'].'" cl
$searchForm .= html_print_table($table2, true);
$searchForm .= html_print_input_hidden('id_report', $id_report, true);
if ((bool) is_metaconsole() === true) {
$Actionbuttons .= html_print_submit_button(
__('Update'),
'date_submit',
@ -314,9 +341,24 @@ $Actionbuttons .= html_print_submit_button(
[
'mode' => 'mini',
'icon' => 'next',
'style' => 'position: absolute; top: 60px;',
],
true
);
} else {
$Actionbuttons .= html_print_submit_button(
__('Update'),
'date_submit',
false,
[
'mode' => 'mini',
'icon' => 'next',
'style' => 'position: absolute; top: 20px;',
],
true
);
}
$searchForm .= html_print_div(
[
@ -353,13 +395,20 @@ $report = reporting_make_reporting_data(
$date_end,
$time,
$period,
'dinamic'
'dinamic',
null,
null,
false,
false,
$filter_type,
$custom_date_end,
$custom_period
);
for ($i = 0; $i < count($report['contents']); $i++) {
$report['contents'][$i]['description'] = str_replace('&#x0d;&#x0a;', '<br/>', $report['contents'][$i]['description']);
}
reporting_html_print_report($report, false, $config['custom_report_info']);
reporting_html_print_report($report, false, $config['custom_report_info'], $custom_date_end, $custom_period);
echo '<div id="loading" class="center">';
@ -402,13 +451,16 @@ $(document).ready (function () {
$("#string_to").show();
$('#string_from').show();
$("#string_items").hide();
console.log($(".filter_label_position_before").html());
} else {
$("#string_to").hide();
$('#string_from').hide();
$("#string_items").show();
}
});
$('#div-report_export').addClass('div-report_export_filter');
$('#button-export').addClass('button-export_filter ');
$('#report_export_menu').removeClass('right');
});
</script>

View File

@ -97,29 +97,12 @@ $filename = (string) get_parameter('filename');
$date_mode = get_parameter('date_mode', 'none');
$period = null;
switch ($date_mode) {
case 'none':
case 'end_time':
// Get different date to search the report.
$date = (string) get_parameter('date', date('Y-m-j'));
$time = (string) get_parameter('time', date('h:iA'));
break;
case 'init_and_end_time':
// Get different date to search the report.
$date = (string) get_parameter('date', date('Y-m-j'));
$time = (string) get_parameter('time', date('h:iA'));
// Calculations in order to modify init date of the report
$date_init_less = (strtotime(date('Y-m-j')) - SECONDS_1DAY);
$date_init = get_parameter('date_init', date('Y-m-j', $date_init_less));
$time_init = get_parameter('time_init', date('h:iA'));
$datetime_init = strtotime($date_init.' '.$time_init);
$period = (strtotime($date.' '.$time) - $datetime_init);
break;
$date_init = get_parameter('date_init', '');
if (empty($date_init) === false) {
$date_end = get_parameter('date_end', time());
$period = ($date_end - $date_init);
$date = date('Y-m-d', $date_end);
$time = date('H:i:s', $date_end);
}

View File

@ -15,6 +15,7 @@ global $config;
enterprise_include_once('include/functions_policies.php');
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_reporting.php';
$searchAgents = get_parameter('search_agents', 0);
$stringSearchSQL = get_parameter('stringSearchSQL');

View File

@ -36,33 +36,11 @@ require_once $config['homedir'].'/include/functions_notifications.php';
$headerTitle = __('User notifications');
require $config['homedir'].'/operation/users/user_edit_header.php';
if (get_parameter('change_label', 0)) {
$label = get_parameter('label', '');
$source = get_parameter('source', 0);
$user = get_parameter('user', '');
$value = get_parameter('value', 0) ? 1 : 0;
// Update the label value.
ob_clean();
echo json_encode(
[
'result' => notifications_set_user_label_status(
$source,
$user,
$label,
$value
),
]
);
return;
}
echo '<div id="user-notifications-wrapper" class="white_box table_div table_three_columns padding-2">
<div class="table_thead">
<div class="table_th"></div>
<div class="table_th">'.__('Enable').'</div>
<div class="table_th">'.__('Also receive an email').'</div>
<div class="table_th">'.__('Console notifications').'</div>
<div class="table_th">'.__('E-mail notifications').'</div>
</div>';
$sources = notifications_get_all_sources();
@ -109,13 +87,12 @@ html_print_input_hidden('id_user', $id);
event.preventDefault();
var check = document.getElementById(event.target.id);
if (check === null) return;
var match = /notifications-user-([0-9]+)-label-(.*)/
.exec(event.target.id);
jQuery.post ("ajax.php",
{
"page" : "operation/users/user_edit_notifications",
//"page" : "operation/users/user_edit_notifications",
"page" : 'include/ajax/notifications.ajax',
"change_label" : 1,
"label" : match[2],
"source" : match[1],
@ -148,4 +125,5 @@ html_print_input_hidden('id_user', $id);
);
}
}());
</script>

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.773.3
%define release 230907
%define release 230925
# User and Group under which Apache is running
%define httpd_name httpd
@ -23,7 +23,7 @@ Group: Productivity/Networking/Web/Utilities
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /var/www/html
BuildRoot: %{_tmppath}/%{name}
BuildArch: noarch
BuildArch: x86_64
AutoReq: 0
Requires: %{httpd_name} >= 2.0.0
Requires: php >= 8.0
@ -109,3 +109,5 @@ fi
%{prefix}/pandora_console
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_console
%attr(0644, root, root) %{_sysconfdir}/logrotate.d/pandora_console
%defattr(0744,%{httpd_user},%{httpd_group},0755)
%{prefix}/pandora_console/attachment/discovery

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.773.3
%define release 230907
%define release 230925
# User and Group under which Apache is running
%define httpd_name httpd
@ -23,7 +23,7 @@ Group: Productivity/Networking/Web/Utilities
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /opt/rh/httpd24/root/var/www/html
BuildRoot: %{_tmppath}/%{name}
BuildArch: noarch
BuildArch: x86_64
AutoReq: 0
Requires: httpd24-httpd
Requires: httpd24-mod_php >= 7.2
@ -93,3 +93,5 @@ fi
%{prefix}/pandora_console
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_console
%attr(0644, root, root) %{_sysconfdir}/logrotate.d/pandora_console
%defattr(0744,%{httpd_user},%{httpd_group},0755)
%{prefix}/pandora_console/attachment/discovery

View File

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

View File

@ -485,11 +485,14 @@ CREATE TABLE IF NOT EXISTS `talert_templates` (
`field18` TEXT,
`field19` TEXT,
`field20` TEXT,
`type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always', 'not_normal'),
`type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always', 'not_normal', 'complex'),
`value` VARCHAR(255) DEFAULT '',
`matches_value` TINYINT DEFAULT 0,
`max_value` DOUBLE DEFAULT NULL,
`min_value` DOUBLE DEFAULT NULL,
`time_window` ENUM ('thirty_days','this_month','seven_days','this_week','one_day','today'),
`math_function` ENUM ('avg', 'min', 'max', 'sum'),
`condition` ENUM ('lower', 'greater', 'equal'),
`time_threshold` INT NOT NULL DEFAULT 0,
`max_alerts` INT UNSIGNED NOT NULL DEFAULT 1,
`min_alerts` INT UNSIGNED NOT NULL DEFAULT 0,
@ -1302,6 +1305,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`custom_data` VARCHAR(500) DEFAULT '',
`custom_data_filter_type` TINYINT UNSIGNED DEFAULT 0,
`owner_user` TEXT,
`private_filter_user` TEXT,
PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
@ -1674,6 +1678,9 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`macros_definition` TEXT,
`render_definition` TEXT,
`use_prefix_notation` TINYINT UNSIGNED NOT NULL DEFAULT 1,
`cat_security_hardening` INT NOT NULL DEFAULT 0,
`ignore_skipped` INT NOT NULL DEFAULT 0,
`status_of_check` TINYTEXT,
PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE
@ -2911,6 +2918,7 @@ CREATE TABLE IF NOT EXISTS `tservice` (
`is_favourite` TINYINT NOT NULL DEFAULT 0,
`enable_sunburst` TINYINT NOT NULL DEFAULT 0,
`asynchronous` TINYINT NOT NULL DEFAULT 0,
`enable_horizontal_tree` TINYINT NOT NULL DEFAULT 0,
`rca` TEXT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,32 @@ if ($issues) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
} elseif (!headers_sent()) {
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
require_once __DIR__.'/../../include/functions_ui.php';
$url = str_replace('/var/www/html/', '', __DIR__);
$url = str_replace('/vendor/composer', '', $url);
echo '<link rel="stylesheet" type="text/css" href="include/styles/pandora.css">';
?>
<style>
body {
display: block;
}
</style>
<?php
echo '<div style="height:100%;min-height: 100%;display:flex;align-items:center;justify-content:center;background: linear-gradient(74deg, #02020255 36%, transparent 36%), url('.$url.'/../images/backgrounds/background_pandora_console_keys.jpg);">';
echo '<center><div align="middle" class="license_databox w600px pdd_10px" style="background-color: white;">';
echo '<img style="width: 600px" src="images/custom_logo/logo-default-pandorafms.png"><h2> Composer detected issues in your platform:</h2>';
echo '<div class="w90p height_100px" style="text-align:left;font-size: larger">';
echo sprintf(
'PandoraFMS requires PHP 8.0 to work properly and the version %s has been detected. Please update the PHP version of the system. More info %s. The latest version with PHP 7.4 support is PandoraFMS 767 hope LTS.',
PHP_VERSION,
'<a style="font-size: initial;" target="_blank" href="https://pandorafms.com/manual/en/documentation/07_technical_annexes/18_php_8">here</a>'
);
echo '</div></div></center></div>';
}
}
trigger_error(

View File

@ -8,6 +8,7 @@ use POSIX qw(strftime);
use PandoraFMS::DB;
use constant DATASERVER => 0;
use constant ALERTSERVER => 21;
use Scalar::Util qw(looks_like_number);
@ -160,6 +161,18 @@ sub pandora_self_monitoring ($$) {
$queued_modules = 0;
}
my $queued_alerts = get_db_value ($dbh, "SELECT count(id) FROM talert_execution_queue");
if (!defined($queued_alerts)) {
$queued_alerts = 0;
}
my $alert_server_status = get_db_value ($dbh, "SELECT status FROM tserver WHERE server_type = ?", ALERTSERVER);
if (!defined($alert_server_status || $alert_server_status eq "") ) {
$alert_server_status = 0;
}
my $dbmaintance;
if ($RDBMS eq 'postgresql') {
$dbmaintance = trim(get_db_value ($dbh,
@ -194,6 +207,18 @@ sub pandora_self_monitoring ($$) {
$xml_output .=" <data>$queued_modules</data>\n";
$xml_output .=" </module>\n";
$xml_output .=" <module>\n";
$xml_output .=" <name>Queued_Alerts</name>\n";
$xml_output .=" <type>generic_data</type>\n";
$xml_output .=" <data>$queued_alerts</data>\n";
$xml_output .=" </module>\n";
$xml_output .=" <module>\n";
$xml_output .=" <name>Alert_Server_Status</name>\n";
$xml_output .=" <type>generic_proc</type>\n";
$xml_output .=" <data>$alert_server_status</data>\n";
$xml_output .=" </module>\n";
$xml_output .=" <module>\n";
$xml_output .=" <name>Agents_Unknown</name>\n";
$xml_output .=" <type>generic_data</type>\n";

View File

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

View File

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

View File

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

View File

@ -127,6 +127,7 @@ use JSON qw(decode_json encode_json);
use MIME::Base64;
use Text::ParseWords;
use Math::Trig; # Math functions
use constant ALERTSERVER => 21;
# Debugging
#use Data::Dumper;
@ -704,6 +705,49 @@ sub pandora_evaluate_alert ($$$$$$$;$$$$) {
}
}
if($alert-> {'type'} eq "complex") {
my @allowed_functions = ("sum", "min", "max", "avg");
my %condition_map = (
lower => '<',
greater => '>',
equal => '==',
);
my %time_windows_map = (
thirty_days => sub { return time - 30 * 24 * 60 * 60 },
this_month => sub { return timelocal(0, 0, 0, 1, (localtime)[4, 5]) },
seven_days => sub { return time - 7 * 24 * 60 * 60 },
this_week => sub { return time - ((localtime)[6] % 7) * 24 * 60 * 60 },
one_day => sub { return time - 1 * 24 * 60 * 60 },
today => sub { return timelocal(0, 0, 0, (localtime)[3, 4, 5]) },
);
my $function = $alert-> {'math_function'};
my $condition = $condition_map{$alert->{'condition'}};
my $window = $time_windows_map{$alert->{'time_window'}};
my $value = defined $alert->{'value'} && $alert->{'value'} ne "" ? $alert->{'value'} : 0;
if((grep { $_ eq $function } @allowed_functions) == 1 && defined($condition) && defined($window)){
my $query = "SELECT IFNULL($function(datos), 0) AS $function
FROM tagente_datos
WHERE id_agente_modulo = ? AND utimestamp > ?";
my $historical_value = get_db_value($dbh, $query, $alert->{"id_agent_module"}, $window->());
my $activate_alert = 0;
if($function eq "avg"){
# Check if the received value meets the condition compared to the avg.
$activate_alert = eval("$data $condition $historical_value");
}else{
# Check if the hiscorical value meets the condition compared to the val.
$activate_alert = eval("$historical_value $condition $value");
}
# Return $status if the alert is not activated
return $status if !$activate_alert;
}
}
return $status if ($last_status != 1 && $alert->{'type'} eq 'critical');
return $status if ($last_status != 2 && $alert->{'type'} eq 'warning');
return $status if ($last_status != 3 && $alert->{'type'} eq 'unknown');
@ -5687,7 +5731,7 @@ sub pandora_server_statistics ($$) {
$server->{"modules_total"} = get_db_value ($dbh, "SELECT COUNT(tagent_module_inventory.id_agent_module_inventory) FROM tagente, tagent_module_inventory WHERE tagente.disabled=0 AND tagent_module_inventory.id_agente = tagente.id_agente");
# Calculate lag
$lag_row = get_db_single_row ($dbh, "SELECT COUNT(tagent_module_inventory.id_agent_module_inventory) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - tagent_module_inventory.interval) AS lag
$lag_row = get_db_single_row ($dbh, "SELECT COUNT(tagent_module_inventory.id_agent_module_inventory) AS `module_lag`, AVG(UNIX_TIMESTAMP() - utimestamp - tagent_module_inventory.interval) AS `lag`
FROM tagente, tagent_module_inventory
WHERE utimestamp > 0
AND tagent_module_inventory.id_agente = tagente.id_agente
@ -5736,8 +5780,8 @@ sub pandora_server_statistics ($$) {
if ($server->{"server_type"} != DATASERVER){
$lag_row = get_db_single_row (
$dbh,
"SELECT COUNT(tam.id_agente_modulo) AS module_lag,
AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS lag
"SELECT COUNT(tam.id_agente_modulo) AS `module_lag`,
AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS `lag`
FROM (
SELECT tagente_estado.last_execution_try, tagente_estado.current_interval, tagente_estado.id_agente_modulo
FROM tagente_estado
@ -5762,8 +5806,8 @@ sub pandora_server_statistics ($$) {
else {
$lag_row = get_db_single_row (
$dbh,
"SELECT COUNT(tam.id_agente_modulo) AS module_lag,
AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS lag
"SELECT COUNT(tam.id_agente_modulo) AS `module_lag`,
AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS `lag`
FROM (
SELECT tagente_estado.last_execution_try, tagente_estado.current_interval, tagente_estado.id_agente_modulo
FROM tagente_estado
@ -6133,6 +6177,18 @@ sub pandora_self_monitoring ($$) {
$queued_modules = 0;
}
my $queued_alerts = get_db_value ($dbh, "SELECT count(id) FROM talert_execution_queue");
if (!defined($queued_alerts)) {
$queued_alerts = 0;
}
my $alert_server_status = get_db_value ($dbh, "SELECT status FROM tserver WHERE server_type = ?", ALERTSERVER);
if (!defined($alert_server_status) || $alert_server_status eq "") {
$alert_server_status = 0;
}
my $pandoradb = 0;
my $pandoradb_tstamp = get_db_value ($dbh, "SELECT `value` FROM tconfig WHERE token = 'db_maintance'");
if (!defined($pandoradb_tstamp) || $pandoradb_tstamp == 0) {
@ -6159,6 +6215,18 @@ sub pandora_self_monitoring ($$) {
$xml_output .=" <data>$queued_modules</data>";
$xml_output .=" </module>";
$xml_output .=" <module>\n";
$xml_output .=" <name>Queued_Alerts</name>\n";
$xml_output .=" <type>generic_data</type>\n";
$xml_output .=" <data>$queued_alerts</data>\n";
$xml_output .=" </module>\n";
$xml_output .=" <module>\n";
$xml_output .=" <name>Alert_Server_Status</name>\n";
$xml_output .=" <type>generic_proc</type>\n";
$xml_output .=" <data>$alert_server_status</data>\n";
$xml_output .=" </module>\n";
$xml_output .=" <module>";
$xml_output .=" <name>Agents_Unknown</name>";
$xml_output .=" <type>generic_data</type>";

View File

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

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_server
%define version 7.0NG.773.3
%define release 230907
%define release 230925
Summary: Pandora FMS Server
Name: %{name}
@ -18,7 +18,7 @@ Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Prefix: %{_datadir}
BuildRoot: %{_tmppath}/%{name}-buildroot
BuildArchitectures: noarch
BuildArchitectures: x86_64
AutoReq: 0
Provides: %{name}-%{version}
Requires(pre): shadow-utils
@ -59,6 +59,7 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/netflow
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/sflow
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/trans
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/commands
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/pandora/
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf.d/
@ -68,6 +69,23 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/pandora/.ssh
mkdir -p $RPM_BUILD_ROOT/usr/lib/perl5/
# Copy open discovery plugins to data_in
if [ -d "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery" ]; then
echo ">Installing the open discovery scripts to $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery..."
for disco_folder in $(ls "discovery/"); do
if [ -d "discovery/"$disco_folder ]; then
if [ -d "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder" ]; then
rm -Rf "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder"
fi
cp -Rf "discovery/"$disco_folder "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder"
chmod -R 770 "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder"
fi
done
else
echo ">ERROR: Failed to copy open discovery scripts to $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery - Folder not found"
fi
# All binaries go to %{_bindir}
cp -aRf bin/pandora_server $RPM_BUILD_ROOT%{_bindir}/
cp -aRf bin/pandora_exec $RPM_BUILD_ROOT%{_bindir}/

View File

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

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.773.3"
PI_BUILD="230907"
PI_BUILD="230925"
MODE=$1
if [ $# -gt 1 ]; then
@ -341,6 +341,23 @@ install () {
chown apache:$GROUPNAME $DESTDIR$PANDORA_SPOOL/data_in/customer_key 2>/dev/null
# Copy open discovery plugins to data_in
if [ -d "$DESTDIR$PANDORA_SPOOL/data_in/discovery" ]; then
echo ">Installing the open discovery scripts to $DESTDIR$PANDORA_SPOOL/data_in/discovery..."
for disco_folder in $(ls "discovery/"); do
if [ -d "discovery/"$disco_folder ]; then
if [ -d "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder" ]; then
rm -Rf "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder"
fi
cp -Rf "discovery/"$disco_folder "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder"
chmod -R 770 "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder"
fi
done
else
echo ">ERROR: Failed to copy open discovery scripts to $DESTDIR$PANDORA_SPOOL/data_in/discovery/discovery - Folder not found"
fi
echo "Creating setup directory in $PANDORA_CFG_DIR"
mkdir -p $DESTDIR$PANDORA_CFG_DIR 2> /dev/null
if [ -f "$DESTDIR$PANDORA_CFG_FILE" ]

View File

@ -148,153 +148,3 @@ be67e5298c830c0bb582556f
b03831cce718125cb9612c07
5465b26fd45d86b059066cc2
5351de84d2fd638b138ba27b
6c63000157aed37fa8c0c022
8d3c18c7fbe518694c6bdb22
615ec092b6f63bb14a2bb42e
61de25cf8e12926c28aeffdc
2b96bc1c8f6f81a5437b61bf
ba1f4fcf3954e0efe5d68c83
ee5bd3e1a937b90562677f1d
0cf18ae18b0c680d00cb4d2e
abf72b0d66f90bd6e67c43c6
f263d033bb07e0b8cd405224
418ddf02720649b40db2dd67
01d1a735aa980326d385ea65
0cc3860bb0a3fd5822b25ea4
b0b89dbebfab05fafd6cf9dd
2fcbb999444db5c0c77c2ec2
f49a97b3531b8ab8d487c7a7
ffb66d5003620e2fa47ef8ea
04da742ab6c99b5c44f9f0cc
dc310a9d42d7c367671ffbf9
b0f5c4ee8d327449ef2103e6
5bd2ce604ed7c820169f0ac2
57f874a6e41baa5a1196b15f
b43142736205ad1011f4a5a6
50cf8523e5090251516eecb0
ebad61d47be209696f9d41aa
66bc5976a98266560d1867ff
3c37fc452e9ad36cd7adcb1a
4ac8c3db63a69ce883f3fcf5
6c89e2bb90b9ab95f4adde3c
917de5ece0a5ef663a8f44e7
b50eba76cf29aca3cf696d7e
74264c913ac1e141db78708a
2b6c93011f62cffb5c085886
700617c377952010272b9522
dac10c8ddf7c45e55d8028af
053328a6ff4f2773eebe76fe
2d7390260285c272688ae1e8
fa30c9ee6fb1e2f00d7ccb77
0ca6db378a05246f30c8b820
9ad6f959de166cc1475040ea
23b4702f4dfb350085e77482
4198a8ab80780c5d9b0d82d5
baebd530dfc47ac77ea42d2a
636d2ab4e018b5542e429f5e
40ae44193af360eea68b6f0b
dd47b39e494a62a4f5b6bef8
240339c9dcd159595c1edbf3
0f11840efe364ca6bbb17f43
8522e203fb4b53e2bd6d6f82
f134d9b501fa40b17993beee
d0483306f2f972aacfb4fcea
926ee4e0a80455cfee517f8b
c188a327bc66df4878cb3e8b
c874083c1d932bb4ade6d028
be2271d8da327f97e05c1c60
9ca7451d3f261682ec717547
9eb46e2a5fd072c5267d7432
41e8f3f7733f87e16b773bad
f642220cd19f84154e4dd972
fe3d9f6433883332b464b7ca
3e9648ccf60b1fa712ea8590
b7da7292e9418889bc957bd7
fb4a392d386eca19eec9215e
34188e4a6590877b2dbb67b0
e233cb364659dea13dee1fd8
757b8330465df34879414b7d
5e0f80102fee69d0742934b2
d72124afc78e9b3f91550497
21c77bfe67c6e99f73323f42
afa8ce345db6300882858f93
886cc8b32ed80f4c69edb990
64ea275ce73ef4070cefca19
c676f1ffe5bdce4e1d3643ed
baca61ab59568605e3ec8899
1610892c53a071ed02d20c75
3321fb7111d74e532932d262
29583747ac9fbf0bf21c1574
f51210b47a6e847dcfb52f94
63c95735ba96c65d2d45b23d
679c4e3acb15ebec6ecc7529
42da0760b02d50c6587a8c31
e42de775dcfcc3c950c1cff5
ae5791cf265badebd39c78d9
f66c123309525eeb81b47e92
7cddc2b9ed6b4df83c72fcbe
e69cc74632fdaa06f76f708a
7cfd19c2eeaef2c0537332be
d27cdcea69f4e49fbae06f4d
bdfaa2ec52319f0e6533e826
d59452cdfce11e21682a791f
cbb74f2d35d54557abdbc2da
369a4e6f128475bc9f87ef42
90bf992a98d0b768cbc50520
1fea663421dae7b418b9b15f
f9fc5505565c43cebc1545f9
d02a8f77fbb2b7f384a99949
279ff35e17c7f6b6a043fde7
9cf7725d3a97d9aa9e529ce6
1f465b328b349502c0953b2d
283fad60fa48ea2075a0e516
ef5d9e841a02665c54d8fa7f
b6023425cb4a1503726b3135
7fb8a1a734c24cc22a5c75eb
da38d78e83c9288e4cd60cca
2a928a6498ae8e0b29675c25
d2194ab5b0e48c2c1f213860
53acafcd86a61ce55688ebef
65608eeebc7d9fe2912635ed
fafb0273e3b04deb1edb2628
baf07d1f28416da065b6771f
c2ee8e58209102fdd0bb341c
f8e92e00670f65c29c4617c9
a83661705134029ae344176d
fc02c24e172d12a29b17eede
2632f143ffe3f64e63e4ba32
847120de4b72f59263d160f1
5be36ff5b668eb93823974b2
cdd8fe5081225519b5fc28af
53569cbaedb9265839290a6c
decca89ea0e8944fd93fcd24
4b10511d840b7f5129ed6190
5c4a1904de5f90f4d5dd749a
49c47514c3308df82fcd6b79
15af3e182c00000eea12f8e5
a9645c4a43ad211d9ae9a406
dcffa4e5eee8f966b1edcdaf
75b25f796f1e392f45c3a737
0ad5f0b96946ebcabd0457e9
2f9128177cab74e0bad61189
49ed14b81e0a166ccf335b4a
dfe100788326c45dfb84579c
2616f38caef9decae47e5023
99b2d0eb14ac19d1cfedd86e
fb1d4c42ea70fad330b5c5ee
b6c560867faa3b41b1f5d4fa
1167fb22e86098ef684eb702
a2e2c2ee8ec87d4e5d59eb22
b228beac094e16a0fa3cb528
ea0de9aad68deed0a4df3e71
e50cb420497d928ef9827800
3bb39890ca4a6da941e01782
73391f2914465c3f2335e24a
f8b2f512cc0cbc024e2cd377
4f816b0d36c934b44dbd5bc0
817edf1e2637fef229752a5f
4466f97959df7247f7410fbe
cc85c727080e9d6eb75ef513
7e27f012167ed8bedc4bd635
98a445ff41a81a0a752aff25
3b339e213dd613c4efd878c1

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.773.3 Build 230907";
my $version = "7.0NG.773.3 Build 230925";
# Pandora server configuration
my %conf;

View File

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

View File

@ -1095,7 +1095,7 @@ Protocol description and more info at: L<< https://pandorafms.com/manual/en/docu
=head1 COPYRIGHT
Copyright (c) 2005-2023 Pandora FMS.
Copyright (c) 2005-2010 Artica Soluciones Tecnologicas S.L
=cut