resolved conflict

This commit is contained in:
Daniel Maya 2023-09-21 18:04:15 +02:00
commit d4e2fb4fea
48 changed files with 966 additions and 95 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.773.3-230920
Version: 7.0NG.773.3-230921
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-230920"
pandora_version="7.0NG.773.3-230921"
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 => '230920';
use constant AGENT_BUILD => '230921';
# 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 230920
%define release 230921
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 230920
%define release 230921
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 230920
%define release 230921
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230920}
{230921}
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 230920")
#define PANDORA_VERSION ("7.0NG.773.3 Build 230921")
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 230920))"
VALUE "ProductVersion", "(7.0NG.773.3(Build 230921))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.773.3-230920
Version: 7.0NG.773.3-230921
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-230920"
pandora_version="7.0NG.773.3-230921"
package_pear=0
package_pandora=1

View File

@ -23,6 +23,12 @@ UPDATE tagente_modulo SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
UPDATE tpolicy_modules SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
UPDATE tnetwork_component SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
ALTER TABLE 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 ,
CHANGE COLUMN `start_date_defined` `date` VARCHAR(45) NULL DEFAULT NULL ,

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

@ -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

@ -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

@ -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

@ -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 = 'PC230920';
$build_version = 'PC230921';
$pandora_version = 'v7.0NG.773.3';
// Do not overwrite default timezone set if defined.

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

@ -7397,14 +7397,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();
$('#".$name."_range').hide();
$('#".$name."_extend').hide();
$('#".$name."_default').show();
if(def_state_range){
$('#".$name."_range').show();
} else {
$('#".$name."_range').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

@ -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

@ -4233,8 +4233,7 @@ function ui_print_datatable(array $parameters)
$spinner = '<div id="'.$table_id.'-spinner" class="invisible spinner-fixed"><span></span><span></span><span></span><span></span></div>';
// TODO This widget should take a return: ui_print_info_message($info_msg_arr, '', true)
$info_msg = '<div>'.ui_print_info_message($info_msg_arr).'</div>';
$info_msg = '<div>'.ui_print_info_message($info_msg_arr, '', true).'</div>';
$info_msg_filter = '<div>'.ui_print_info_message($info_msg_arr_filter, true).'</div>';

View File

@ -498,8 +498,12 @@ function radar_graph(
$chart_data,
$options
) {
$chart = get_build_setup_charts('RADAR', $options, $chart_data);
return $chart->render(true, true);
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([]);
}
}

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

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

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

@ -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 = '230920';
$build = '230921';
$banner = "v$version Build $build";
error_reporting(0);

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

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.773.3
%define release 230920
%define release 230921
# 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 230920
%define release 230921
# 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 230920
%define release 230921
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -484,11 +484,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,

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.773.3-230920
Version: 7.0NG.773.3-230921
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-230920"
pandora_version="7.0NG.773.3-230921"
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 = "230920";
my $pandora_build = "230921";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -704,6 +704,49 @@ sub pandora_evaluate_alert ($$$$$$$;$$$$) {
return $status if (valid_regex ($alert->{'value'}) == 1 && $data =~ m/$alert->{'value'}/i);
}
}
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');
@ -736,7 +779,7 @@ sub pandora_evaluate_alert ($$$$$$$;$$$$) {
if(defined ($agent)) {
pandora_mark_agent_for_alert_update ($dbh, $agent->{'id_agente'});
}
return 0; #Launch the alert
}

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 = "230920";
my $pandora_build = "230921";
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 230920
%define release 230921
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 230920
%define release 230921
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.773.3"
PI_BUILD="230920"
PI_BUILD="230921"
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

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.773.3 Build 230920";
my $version = "7.0NG.773.3 Build 230921";
# 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 230920";
my $version = "7.0NG.773.3 Build 230921";
# save program name for logging
my $progname = basename($0);