mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-24 10:30:05 +02:00
Merge branch 'develop' into ent-8458-heatmap-view
This commit is contained in:
commit
f34e8fead7
@ -1,11 +1,12 @@
|
||||
FROM pandorafms/pandorafms-base
|
||||
FROM pandorafms/pandorafms-base:centos7
|
||||
|
||||
# Build variables.
|
||||
ARG BRANCH=develop
|
||||
ARG DB_PASS=pandora
|
||||
|
||||
# Clone the Pandora FMS repo.
|
||||
RUN git clone --depth 1 -b "$BRANCH" https://github.com/pandorafms/pandorafms.git /tmp/pandorafms
|
||||
RUN git clone --depth 1 -b "$BRANCH" https://github.com/pandorafms/pandorafms.git /tmp/pandorafms || \
|
||||
git clone --depth 1 -b develop https://github.com/pandorafms/pandorafms.git /tmp/pandorafms
|
||||
|
||||
# Install the Pandora FMS Server.
|
||||
RUN cd /tmp/pandorafms/pandora_server && \
|
||||
@ -21,21 +22,27 @@ RUN cd /tmp/pandorafms/pandora_agents/unix && \
|
||||
RUN sed -i "s/#ServerName.*/ServerName localhost:80/" /etc/httpd/conf/httpd.conf
|
||||
|
||||
# Install the Pandora FMS Console.
|
||||
RUN service mysqld start && \
|
||||
/usr/bin/mysqladmin -u root password "$DB_PASS" && \
|
||||
service httpd start && \
|
||||
cp -r /tmp/pandorafms/pandora_console /var/www/html && \
|
||||
chown -R apache.apache /var/www/html/pandora_console/ && \
|
||||
python /tmp/pandorafms/tests/install_console.py
|
||||
RUN rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql && \
|
||||
mkdir -p /var/log/mysql/ && chown mysql. /var/log/mysql && \
|
||||
chown mysql. -R /var/lib/mysql && \
|
||||
sudo -u mysql mysqld --initialize --explicit_defaults_for_timestamp && \
|
||||
sudo -u mysql mysqld --daemonize & \
|
||||
sleep 50 && \
|
||||
mysql_default_pass=$(cat /var/log/mysqld.log | grep "temporary password" | awk '{print $NF}') && \
|
||||
mysqladmin -u root -p"$mysql_default_pass" --user=root password 'pandora' && \
|
||||
httpd -k start && \
|
||||
cp -r /tmp/pandorafms/pandora_console /var/www/html && \
|
||||
chown -R apache.apache /var/www/html/pandora_console/ && \
|
||||
python /tmp/pandorafms/tests/install_console.py
|
||||
|
||||
# Redirect HTTP requests to / to the Pandora FMS Console.
|
||||
RUN echo '<meta http-equiv="refresh" content="0;url=/pandora_console">' > /var/www/html/index.html
|
||||
|
||||
# Create the entrypoint script.
|
||||
RUN echo -e '#/bin/bash\n \
|
||||
service mysqld start &&\n \
|
||||
service httpd start &&\n \
|
||||
service crond start &&\n \
|
||||
sudo -u mysql mysqld --daemonize &&\n \
|
||||
httpd -k start &&\n \
|
||||
/usr/sbin/crond &&\n \
|
||||
/etc/init.d/pandora_agent_daemon start && \
|
||||
/etc/init.d/pandora_server start && \
|
||||
tail -f /var/log/pandora/pandora_server.log' \
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.760-220221
|
||||
Version: 7.0NG.760-220307
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.760-220221"
|
||||
pandora_version="7.0NG.760-220307"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -39,7 +39,7 @@ BEGIN {
|
||||
|
||||
use File::Copy;
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
################################################################################
|
||||
# Erase blank spaces before and after the string
|
||||
@ -312,7 +312,7 @@ BEGIN {
|
||||
$YAML = 1;
|
||||
}
|
||||
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
our @ISA = ("Exporter");
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw( ) ] );
|
||||
@ -1003,7 +1003,7 @@ use IO::Socket;
|
||||
use Sys::Syslog;
|
||||
use Time::Local;
|
||||
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
# Agent XML data
|
||||
my $Xml;
|
||||
@ -1015,7 +1015,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.760';
|
||||
use constant AGENT_BUILD => '220221';
|
||||
use constant AGENT_BUILD => '220307';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.760
|
||||
%define release 220221
|
||||
%define release 220307
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.760
|
||||
%define release 220221
|
||||
%define release 220307
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -42,6 +42,8 @@ pidof_pandora () {
|
||||
elif [ "$OS_NAME" = "SunOS" ]
|
||||
then
|
||||
ZONENAME_CMD="/bin/zonename"
|
||||
# Has to be run from sources. The binary version inserts blanks between
|
||||
# $DAEMON and $PANDORA_PATH.
|
||||
TRUNCATED_DAEMON=`echo "$DAEMON $PANDORA_PATH" | cut -c1-20`
|
||||
if [ -x $ZONENAME_CMD ]
|
||||
then
|
||||
@ -59,7 +61,7 @@ pidof_pandora () {
|
||||
then
|
||||
# Virtuozzo/OpenVZ
|
||||
local _pid _ctid _pids
|
||||
_pids=`ps -Af | grep "$DAEMON $PANDORA_PATH" | grep -v grep | awk '{ print $2 }'`
|
||||
_pids=`ps -Af | grep "$DAEMON" | grep "$PANDORA_PATH" | grep -v grep | awk '{ print $2 }'`
|
||||
[ "$_pids" ] && for _pid in $_pids
|
||||
do
|
||||
_ctid=`/usr/sbin/vzpid $_pid | awk '$1 == '$_pid' { print $2 }'`
|
||||
@ -71,9 +73,9 @@ pidof_pandora () {
|
||||
done
|
||||
elif [ "$OS_NAME" = "AIX" ]; then
|
||||
# AIX
|
||||
PANDORA_PID=`ps -ef | grep "$DAEMON $PANDORA_PATH" | grep -v grep | awk '{ print $2 }'`
|
||||
PANDORA_PID=`ps -ef | grep "$DAEMON" | grep "$PANDORA_PATH" | grep -v grep | awk '{ print $2 }'`
|
||||
else
|
||||
PANDORA_PID=`ps -Afw | grep "$DAEMON $PANDORA_PATH" | grep -v grep | awk '{ print $2 }'`
|
||||
PANDORA_PID=`ps -Afw | grep "$DAEMON" | grep "$PANDORA_PATH" | grep -v grep | awk '{ print $2 }'`
|
||||
fi
|
||||
|
||||
echo $PANDORA_PID
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.760"
|
||||
PI_BUILD="220221"
|
||||
PI_BUILD="220307"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -14,7 +14,7 @@ use strict;
|
||||
use LWP::Simple;
|
||||
use LWP::UserAgent;
|
||||
use MIME::Base64;
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
use PandoraFMS::Tools;
|
||||
|
||||
# Init
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{220221}
|
||||
{220307}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -11,7 +11,7 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use File::Basename;
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
use PandoraFMS::PluginTools;
|
||||
use PandoraFMS::Omnishell;
|
||||
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.760 Build 220221")
|
||||
#define PANDORA_VERSION ("7.0NG.760 Build 220307")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.760(Build 220221))"
|
||||
VALUE "ProductVersion", "(7.0NG.760(Build 220307))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.760-220221
|
||||
Version: 7.0NG.760-220307
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.760-220221"
|
||||
pandora_version="7.0NG.760-220307"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -5,17 +5,28 @@ CREATE INDEX `IDX_tservice_element` ON `tservice_element`(`id_service`,`id_agent
|
||||
ALTER TABLE `tusuario` ADD COLUMN `local_user` tinyint(1) unsigned NOT NULL DEFAULT 0;
|
||||
ALTER TABLE tevent_response ADD COLUMN display_command tinyint(1) default 0;
|
||||
|
||||
ALTER TABLE `talert_execution_queue`
|
||||
DROP COLUMN `id_alert_template_module`,
|
||||
DROP COLUMN `alert_mode`,
|
||||
DROP COLUMN `extra_macros`,
|
||||
MODIFY COLUMN `data` LONGTEXT;
|
||||
|
||||
ALTER TABLE `talert_templates` ADD COLUMN `schedule` TEXT;
|
||||
ALTER TABLE `tevent_alert` ADD COLUMN `schedule` TEXT;
|
||||
|
||||
SOURCE procedures/alertTemplates.sql;
|
||||
CALL `migrateRanges`();
|
||||
DROP PROCEDURE `migrateRanges`;
|
||||
|
||||
SOURCE procedures/alertEvents.sql;
|
||||
CALL `migrateEventRanges`();
|
||||
DROP PROCEDURE `migrateEventRanges`;
|
||||
|
||||
ALTER TABLE `tautoconfig` ADD COLUMN `disabled` TINYINT DEFAULT 0;
|
||||
|
||||
UPDATE `tpolicy_groups` SET `policy_applied`=0;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tpolicy_group_agents` (
|
||||
`id` SERIAL,
|
||||
`id_policy` INT UNSIGNED,
|
||||
`id_agent` INT UNSIGNED,
|
||||
`direct` TINYINT UNSIGNED DEFAULT 0,
|
||||
FOREIGN KEY (`id_policy`) REFERENCES `tpolicies`(`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
COMMIT;
|
||||
|
@ -1,40 +0,0 @@
|
||||
|
||||
CREATE PROCEDURE migrateEventRanges()
|
||||
BEGIN
|
||||
DECLARE done INT DEFAULT FALSE;
|
||||
DECLARE i INT;
|
||||
DECLARE r TEXT;
|
||||
DECLARE cur1 CURSOR FOR SELECT `id` FROM `tevent_alert`;
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||
|
||||
UPDATE `tevent_alert` SET `schedule` = '{"monday":_1_,"tuesday":_2_,"wednesday":_3_,"thursday":_4_,"friday":_5_,"saturday":_6_,"sunday":_7_}';
|
||||
UPDATE `tevent_alert` SET `time_from` = "00:00:00", `time_to` = "00:00:00" WHERE `time_from` = `time_to`;
|
||||
|
||||
OPEN cur1;
|
||||
read_loop: LOOP
|
||||
FETCH cur1 INTO i;
|
||||
|
||||
IF done THEN
|
||||
LEAVE read_loop;
|
||||
END IF;
|
||||
|
||||
SELECT concat('[{"start":"', `time_from`, '","end":"', `time_to`, '"}]') into r FROM `tevent_alert` WHERE `id` = i;
|
||||
|
||||
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_1_", r) WHERE `monday` > 0 AND `id` = i;
|
||||
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_2_", r) WHERE `tuesday` > 0 AND `id` = i;
|
||||
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_3_", r) WHERE `wednesday` > 0 AND `id` = i;
|
||||
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_4_", r) WHERE `thursday` > 0 AND `id` = i;
|
||||
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_5_", r) WHERE `friday` > 0 AND `id` = i;
|
||||
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_6_", r) WHERE `saturday` > 0 AND `id` = i;
|
||||
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_7_", r) WHERE `sunday` > 0 AND `id` = i;
|
||||
|
||||
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_1_", '""') WHERE `monday` = 0 AND `id` = i;
|
||||
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_2_", '""') WHERE `tuesday` = 0 AND `id` = i;
|
||||
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_3_", '""') WHERE `wednesday` = 0 AND `id` = i;
|
||||
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_4_", '""') WHERE `thursday` = 0 AND `id` = i;
|
||||
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_5_", '""') WHERE `friday` = 0 AND `id` = i;
|
||||
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_6_", '""') WHERE `saturday` = 0 AND `id` = i;
|
||||
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_7_", '""') WHERE `sunday` = 0 AND `id` = i;
|
||||
END LOOP;
|
||||
CLOSE cur1;
|
||||
END ;
|
@ -1,40 +0,0 @@
|
||||
|
||||
CREATE PROCEDURE migrateRanges()
|
||||
BEGIN
|
||||
DECLARE done INT DEFAULT FALSE;
|
||||
DECLARE i INT;
|
||||
DECLARE r TEXT;
|
||||
DECLARE cur1 CURSOR FOR SELECT `id` FROM `talert_templates`;
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||
|
||||
UPDATE `talert_templates` SET `schedule` = '{"monday":_1_,"tuesday":_2_,"wednesday":_3_,"thursday":_4_,"friday":_5_,"saturday":_6_,"sunday":_7_}';
|
||||
UPDATE `talert_templates` SET `time_from` = "00:00:00", `time_to` = "00:00:00" WHERE `time_from` = `time_to`;
|
||||
|
||||
OPEN cur1;
|
||||
read_loop: LOOP
|
||||
FETCH cur1 INTO i;
|
||||
|
||||
IF done THEN
|
||||
LEAVE read_loop;
|
||||
END IF;
|
||||
|
||||
SELECT concat('[{"start":"', `time_from`, '","end":"', `time_to`, '"}]') into r FROM `talert_templates` WHERE `id` = i;
|
||||
|
||||
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_1_", r) WHERE `monday` > 0 AND `id` = i;
|
||||
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_2_", r) WHERE `tuesday` > 0 AND `id` = i;
|
||||
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_3_", r) WHERE `wednesday` > 0 AND `id` = i;
|
||||
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_4_", r) WHERE `thursday` > 0 AND `id` = i;
|
||||
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_5_", r) WHERE `friday` > 0 AND `id` = i;
|
||||
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_6_", r) WHERE `saturday` > 0 AND `id` = i;
|
||||
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_7_", r) WHERE `sunday` > 0 AND `id` = i;
|
||||
|
||||
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_1_", '""') WHERE `monday` = 0 AND `id` = i;
|
||||
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_2_", '""') WHERE `tuesday` = 0 AND `id` = i;
|
||||
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_3_", '""') WHERE `wednesday` = 0 AND `id` = i;
|
||||
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_4_", '""') WHERE `thursday` = 0 AND `id` = i;
|
||||
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_5_", '""') WHERE `friday` = 0 AND `id` = i;
|
||||
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_6_", '""') WHERE `saturday` = 0 AND `id` = i;
|
||||
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_7_", '""') WHERE `sunday` = 0 AND `id` = i;
|
||||
END LOOP;
|
||||
CLOSE cur1;
|
||||
END ;
|
@ -213,6 +213,20 @@ CREATE TABLE IF NOT EXISTS `tpolicy_groups` (
|
||||
UNIQUE (`id_policy`, `id_group`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tpolicy_group_agents`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tpolicy_group_agents` (
|
||||
`id` SERIAL,
|
||||
`id_policy` INT UNSIGNED,
|
||||
`id_agent` INT UNSIGNED,
|
||||
`direct` TINYINT UNSIGNED DEFAULT 0,
|
||||
FOREIGN KEY (`id_policy`) REFERENCES `tpolicies`(`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tdashboard`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -4124,14 +4138,11 @@ ALTER TABLE `tperfil` ADD COLUMN `network_config_management`tinyint(1) NOT NULL
|
||||
-- Table `talert_execution_queue`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `talert_execution_queue` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_alert_template_module` int(10) unsigned NOT NULL,
|
||||
`alert_mode` tinyint(1) NOT NULL,
|
||||
`data` mediumtext NOT NULL,
|
||||
`extra_macros` text,
|
||||
`utimestamp` bigint(20) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`data` LONGTEXT,
|
||||
`utimestamp` BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
UPDATE `tlanguage` SET `name` = 'Deutsch' WHERE `id_language` = 'de';
|
||||
|
@ -30,7 +30,6 @@
|
||||
global $config;
|
||||
|
||||
enterprise_include('godmode/agentes/configurar_agente.php');
|
||||
enterprise_include('include/functions_policies.php');
|
||||
enterprise_include_once('include/functions_modules.php');
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_cron.php';
|
||||
@ -307,23 +306,6 @@ if ($create_agent) {
|
||||
|
||||
$agent_created_ok = true;
|
||||
|
||||
$tpolicy_group_old = db_get_all_rows_sql(
|
||||
'SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = '.$grupo
|
||||
);
|
||||
|
||||
if ($tpolicy_group_old) {
|
||||
foreach ($tpolicy_group_old as $key => $old_group) {
|
||||
db_process_sql_insert(
|
||||
'tpolicy_agents',
|
||||
[
|
||||
'id_policy' => $old_group['id_policy'],
|
||||
'id_agent' => $id_agente,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$info = '{"Name":"'.$nombre_agente.'",
|
||||
"IP":"'.$direccion_agente.'",
|
||||
"Group":"'.$grupo.'",
|
||||
@ -1117,12 +1099,6 @@ if ($update_agent) {
|
||||
// Force an update of the agent cache.
|
||||
}
|
||||
|
||||
$group_old = db_get_sql('SELECT id_grupo FROM tagente WHERE id_agente ='.$id_agente);
|
||||
$tpolicy_group_old = db_get_all_rows_sql(
|
||||
'SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = '.$group_old
|
||||
);
|
||||
|
||||
$result = db_process_sql_update('tagente', $values, ['id_agente' => $id_agente]);
|
||||
|
||||
if ($result === false && $update_custom_result == false) {
|
||||
@ -1161,59 +1137,6 @@ if ($update_agent) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($tpolicy_group_old) {
|
||||
foreach ($tpolicy_group_old as $key => $value) {
|
||||
$tpolicy_agents_old = db_get_sql(
|
||||
'SELECT * FROM tpolicy_agents
|
||||
WHERE id_policy = '.$value['id_policy'].' AND id_agent = '.$id_agente
|
||||
);
|
||||
|
||||
if ($tpolicy_agents_old) {
|
||||
$result2 = db_process_sql_update(
|
||||
'tpolicy_agents',
|
||||
['pending_delete' => 1],
|
||||
[
|
||||
'id_agent' => $id_agente,
|
||||
'id_policy' => $value['id_policy'],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tpolicy_group = db_get_all_rows_sql(
|
||||
'SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = '.$grupo
|
||||
);
|
||||
|
||||
if ($tpolicy_group) {
|
||||
foreach ($tpolicy_group as $key => $value) {
|
||||
$tpolicy_agents = db_get_sql(
|
||||
'SELECT * FROM tpolicy_agents
|
||||
WHERE id_policy = '.$value['id_policy'].' AND id_agent ='.$id_agente
|
||||
);
|
||||
|
||||
if (!$tpolicy_agents) {
|
||||
db_process_sql_insert(
|
||||
'tpolicy_agents',
|
||||
[
|
||||
'id_policy' => $value['id_policy'],
|
||||
'id_agent' => $id_agente,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$result3 = db_process_sql_update(
|
||||
'tpolicy_agents',
|
||||
['pending_delete' => 0],
|
||||
[
|
||||
'id_agent' => $id_agente,
|
||||
'id_policy' => $value['id_policy'],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$info = '{
|
||||
"id_agente":"'.$id_agente.'",
|
||||
"alias":"'.$alias.'",
|
||||
|
@ -533,10 +533,10 @@ if ($search != '') {
|
||||
$search_sql .= ')';
|
||||
} else {
|
||||
$search_sql = sprintf(
|
||||
' AND ( nombre
|
||||
LIKE "%%%s%%" OR alias
|
||||
LIKE "%%%s%%" OR comentarios LIKE "%%%s%%"
|
||||
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%")',
|
||||
' AND ( nombre
|
||||
LIKE "%%%s%%" OR alias
|
||||
LIKE "%%%s%%" OR comentarios LIKE "%%%s%%"
|
||||
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%"))',
|
||||
$search,
|
||||
$search,
|
||||
$search,
|
||||
|
@ -639,20 +639,20 @@ $table->data[5][1] = "
|
||||
<tr><td>".ui_get_using_system_timezone_warning().'</td></tr>
|
||||
<tr>
|
||||
<td>'.__('Type Periodicity:').' '.html_print_select(
|
||||
[
|
||||
'weekly' => __('Weekly'),
|
||||
'monthly' => __('Monthly'),
|
||||
],
|
||||
'type_periodicity',
|
||||
$type_periodicity,
|
||||
'change_type_periodicity();',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
[
|
||||
'weekly' => __('Weekly'),
|
||||
'monthly' => __('Monthly'),
|
||||
],
|
||||
'type_periodicity',
|
||||
$type_periodicity,
|
||||
'change_type_periodicity();',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
)."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -672,31 +672,31 @@ $table->data[5][1] = "
|
||||
<tr>
|
||||
<td>".__('From day:').'</td>
|
||||
<td>'.html_print_select(
|
||||
$days,
|
||||
'periodically_day_from',
|
||||
$periodically_day_from,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
$days,
|
||||
'periodically_day_from',
|
||||
$periodically_day_from,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
).'</td>
|
||||
<td>'.__('To day:').'</td>
|
||||
<td>'.html_print_select(
|
||||
$days,
|
||||
'periodically_day_to',
|
||||
$periodically_day_to,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
$days,
|
||||
'periodically_day_to',
|
||||
$periodically_day_to,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
).'</td>
|
||||
<td>'.ui_print_help_tip(__('The end day must be higher than the start day'), true).'</td>
|
||||
</tr>
|
||||
@ -705,26 +705,26 @@ $table->data[5][1] = "
|
||||
<tr>
|
||||
<td>'.__('From hour:').'</td>
|
||||
<td>'.html_print_input_text(
|
||||
'periodically_time_from',
|
||||
$periodically_time_from,
|
||||
'',
|
||||
7,
|
||||
7,
|
||||
true,
|
||||
$disabled_in_execution
|
||||
'periodically_time_from',
|
||||
$periodically_time_from,
|
||||
'',
|
||||
7,
|
||||
7,
|
||||
true,
|
||||
$disabled_in_execution
|
||||
).ui_print_help_tip(
|
||||
__('The end time must be higher than the start time'),
|
||||
true
|
||||
).'</td>
|
||||
<td>'.__('To hour:').'</td>
|
||||
<td>'.html_print_input_text(
|
||||
'periodically_time_to',
|
||||
$periodically_time_to,
|
||||
'',
|
||||
7,
|
||||
7,
|
||||
true,
|
||||
$disabled_in_execution
|
||||
'periodically_time_to',
|
||||
$periodically_time_to,
|
||||
'',
|
||||
7,
|
||||
7,
|
||||
true,
|
||||
$disabled_in_execution
|
||||
).ui_print_help_tip(
|
||||
__('The end time must be higher than the start time'),
|
||||
true
|
||||
@ -1008,13 +1008,13 @@ $table->data['module'][1] = "
|
||||
<td class='cell_delete_button' style='text-align: right; width:10%;' id=''>".'<a class="link_delete"
|
||||
onclick="if(!confirm(\''.__('Are you sure?').'\')) return false;"
|
||||
href="">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'border' => '0',
|
||||
'alt' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'border' => '0',
|
||||
'alt' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>'."</td>
|
||||
</tr>
|
||||
<tr class='datos2' id='add_modules_row'>
|
||||
|
@ -345,7 +345,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
$field_values,
|
||||
'',
|
||||
55,
|
||||
255,
|
||||
1000,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
|
@ -61,50 +61,7 @@ if (defined('LAST_STEP') === false) {
|
||||
}
|
||||
|
||||
// Default events calendar.
|
||||
$default_events_calendar = [
|
||||
'monday' => [
|
||||
[
|
||||
'start' => '00:00:00',
|
||||
'end' => '00:00:00',
|
||||
],
|
||||
],
|
||||
'tuesday' => [
|
||||
[
|
||||
'start' => '00:00:00',
|
||||
'end' => '00:00:00',
|
||||
],
|
||||
],
|
||||
'wednesday' => [
|
||||
[
|
||||
'start' => '00:00:00',
|
||||
'end' => '00:00:00',
|
||||
],
|
||||
],
|
||||
'thursday' => [
|
||||
[
|
||||
'start' => '00:00:00',
|
||||
'end' => '00:00:00',
|
||||
],
|
||||
],
|
||||
'friday' => [
|
||||
[
|
||||
'start' => '00:00:00',
|
||||
'end' => '00:00:00',
|
||||
],
|
||||
],
|
||||
'saturday' => [
|
||||
[
|
||||
'start' => '00:00:00',
|
||||
'end' => '00:00:00',
|
||||
],
|
||||
],
|
||||
'sunday' => [
|
||||
[
|
||||
'start' => '00:00:00',
|
||||
'end' => '00:00:00',
|
||||
],
|
||||
],
|
||||
];
|
||||
$default_events_calendar = default_events_calendar($id, 'talert_templates');
|
||||
|
||||
if ($duplicate_template === true) {
|
||||
$source_id = (int) get_parameter('source_id');
|
||||
@ -370,7 +327,12 @@ function update_template($step)
|
||||
|
||||
$result = alerts_update_alert_template($id, $values);
|
||||
} else if ($step == 2) {
|
||||
$schedule = get_parameter('schedule');
|
||||
$schedule = io_safe_output(get_parameter('schedule', []));
|
||||
json_decode($schedule, true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$special_day = (int) get_parameter('special_day');
|
||||
$threshold = (int) get_parameter('threshold');
|
||||
$max_alerts = (int) get_parameter('max_alerts');
|
||||
@ -389,12 +351,7 @@ function update_template($step)
|
||||
}
|
||||
|
||||
$values = [
|
||||
'schedule' => json_encode(
|
||||
json_decode(
|
||||
io_safe_output($schedule),
|
||||
true
|
||||
)
|
||||
),
|
||||
'schedule' => $schedule,
|
||||
'special_day' => $special_day,
|
||||
'time_threshold' => $threshold,
|
||||
'id_alert_action' => $default_action,
|
||||
@ -485,7 +442,6 @@ $type = '';
|
||||
$value = '';
|
||||
$max = '';
|
||||
$min = '';
|
||||
|
||||
$schedule = json_encode(
|
||||
$default_events_calendar
|
||||
);
|
||||
@ -614,7 +570,9 @@ if ($id && ! $create_template) {
|
||||
$min = $template['min_value'];
|
||||
$matches = $template['matches_value'];
|
||||
|
||||
$schedule = $template['schedule'];
|
||||
$schedule = json_encode(
|
||||
$default_events_calendar
|
||||
);
|
||||
$special_day = (int) $template['special_day'];
|
||||
$max_alerts = $template['max_alerts'];
|
||||
$min_alerts = $template['min_alerts'];
|
||||
|
@ -218,14 +218,9 @@ if ($update_agents) {
|
||||
$old_interval_value = db_get_value_filter('intervalo', 'tagente', ['id_agente' => $id_agent]);
|
||||
|
||||
if (!empty($values)) {
|
||||
$group_old = false;
|
||||
$disabled_old = false;
|
||||
if ($values['id_grupo'] || isset($values['disabled'])) {
|
||||
$values_old = db_get_row_filter('tagente', ['id_agente' => $id_agent], ['id_grupo', 'disabled']);
|
||||
if ($values_old['id_grupo']) {
|
||||
$group_old = $values_old['id_grupo'];
|
||||
}
|
||||
|
||||
if (isset($values['disabled'])) {
|
||||
$disabled_old = $values_old['disabled'];
|
||||
}
|
||||
@ -274,74 +269,6 @@ if ($update_agents) {
|
||||
alerts_validate_alert_agent($id_agent);
|
||||
}
|
||||
}
|
||||
|
||||
if ($group_old || $result) {
|
||||
if ($group_old && $group_old != null) {
|
||||
$tpolicy_group_old = db_get_all_rows_sql(
|
||||
'SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = '.$group_old
|
||||
);
|
||||
} else {
|
||||
$tpolicy_group_old = db_get_all_rows_sql('SELECT id_policy FROM tpolicy_groups');
|
||||
}
|
||||
|
||||
if ($tpolicy_group_old) {
|
||||
foreach ($tpolicy_group_old as $key => $value) {
|
||||
$tpolicy_agents_old = db_get_sql(
|
||||
'SELECT * FROM tpolicy_agents
|
||||
WHERE id_policy = '.$value['id_policy'].' AND id_agent = '.$id_agent
|
||||
);
|
||||
|
||||
if ($tpolicy_agents_old) {
|
||||
$result2 = db_process_sql_update(
|
||||
'tpolicy_agents',
|
||||
['pending_delete' => 1],
|
||||
[
|
||||
'id_agent' => $id_agent,
|
||||
'id_policy' => $value['id_policy'],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($values['id_grupo'] && $values['id_grupo'] != null) {
|
||||
$tpolicy_group_new = db_get_all_rows_sql(
|
||||
'SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = '.$values['id_grupo']
|
||||
);
|
||||
} else {
|
||||
$tpolicy_group_new = db_get_all_rows_sql('SELECT id_policy FROM tpolicy_groups');
|
||||
}
|
||||
|
||||
if ($tpolicy_group_new) {
|
||||
foreach ($tpolicy_group_new as $key => $value) {
|
||||
$tpolicy_agents_new = db_get_sql(
|
||||
'SELECT * FROM tpolicy_agents
|
||||
WHERE id_policy = '.$value['id_policy'].' AND id_agent ='.$id_agent
|
||||
);
|
||||
|
||||
if (!$tpolicy_agents_new) {
|
||||
db_process_sql_insert(
|
||||
'tpolicy_agents',
|
||||
[
|
||||
'id_policy' => $value['id_policy'],
|
||||
'id_agent' => $id_agent,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$result3 = db_process_sql_update(
|
||||
'tpolicy_agents',
|
||||
['pending_delete' => 0],
|
||||
[
|
||||
'id_agent' => $id_agent,
|
||||
'id_policy' => $value['id_policy'],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$info = [];
|
||||
|
@ -4004,23 +4004,23 @@ function print_SLA_list($width, $action, $idItem=null)
|
||||
],
|
||||
]
|
||||
);
|
||||
if (!empty($services_tmp)
|
||||
&& $services_tmp != ENTERPRISE_NOT_HOOK
|
||||
) {
|
||||
foreach ($services_tmp as $service) {
|
||||
$check_module_sla = modules_check_agentmodule_exists(
|
||||
$service['sla_id_module']
|
||||
);
|
||||
$check_module_sla_value = modules_check_agentmodule_exists(
|
||||
$service['sla_value_id_module']
|
||||
);
|
||||
if ($check_module_sla
|
||||
&& $check_module_sla_value
|
||||
if (!empty($services_tmp)
|
||||
&& $services_tmp != ENTERPRISE_NOT_HOOK
|
||||
) {
|
||||
$services[$service['id']] = $service['name'];
|
||||
foreach ($services_tmp as $service) {
|
||||
$check_module_sla = modules_check_agentmodule_exists(
|
||||
$service['sla_id_module']
|
||||
);
|
||||
$check_module_sla_value = modules_check_agentmodule_exists(
|
||||
$service['sla_value_id_module']
|
||||
);
|
||||
if ($check_module_sla
|
||||
&& $check_module_sla_value
|
||||
) {
|
||||
$services[$service['id']] = $service['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<td class="sla_list_service_col">';
|
||||
echo html_print_select(
|
||||
|
@ -289,11 +289,16 @@ if (is_array($config) === true
|
||||
&& (bool) $config['history_db_enabled'] === true
|
||||
) {
|
||||
ob_start();
|
||||
$password = $config['history_db_pass'];
|
||||
if (function_exists('io_output_password') === true) {
|
||||
$password = io_output_password($config['history_db_pass']);
|
||||
}
|
||||
|
||||
$dbhHistory = db_connect(
|
||||
$config['history_db_host'],
|
||||
$config['history_db_name'],
|
||||
$config['history_db_user'],
|
||||
io_output_password($config['history_db_pass']),
|
||||
$password,
|
||||
$config['history_db_port']
|
||||
);
|
||||
ob_get_clean();
|
||||
@ -312,6 +317,11 @@ $insecure = false;
|
||||
$pandora_url = ui_get_full_url('godmode/um_client', false, false, false);
|
||||
|
||||
if (is_array($config) === true) {
|
||||
$allowOfflinePatches = false;
|
||||
if (isset($config['allow_offline_patches']) === true) {
|
||||
$allowOfflinePatches = (bool) $config['allow_offline_patches'];
|
||||
}
|
||||
|
||||
if (isset($config['secure_update_manager']) === false) {
|
||||
$config['secure_update_manager'] = null;
|
||||
}
|
||||
@ -425,6 +435,7 @@ $ui = new Manager(
|
||||
'remote_config' => $remote_config,
|
||||
'propagate_updates' => $is_metaconsole,
|
||||
'proxy' => $proxy,
|
||||
'allowOfflinePatches' => $allowOfflinePatches,
|
||||
'set_maintenance_mode' => function () {
|
||||
if (function_exists('config_update_value') === true) {
|
||||
config_update_value('maintenance_mode', 1);
|
||||
|
@ -84,6 +84,13 @@ class Manager
|
||||
*/
|
||||
private $authCode;
|
||||
|
||||
/**
|
||||
* Allow install offline packages not following current version.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $allowOfflinePatches = false;
|
||||
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
@ -144,6 +151,10 @@ class Manager
|
||||
$settings['offline'] = true;
|
||||
}
|
||||
|
||||
if (isset($settings['allowOfflinePatches']) === true) {
|
||||
$this->allowOfflinePatches = (bool) $settings['allowOfflinePatches'];
|
||||
}
|
||||
|
||||
$this->umc = new Client($settings);
|
||||
}
|
||||
|
||||
@ -228,18 +239,19 @@ class Manager
|
||||
View::render(
|
||||
'offline',
|
||||
[
|
||||
'version' => $this->umc->getVersion(),
|
||||
'mr' => $this->umc->getMR(),
|
||||
'error' => $this->umc->getLastError(),
|
||||
'asset' => function ($rp) {
|
||||
'version' => $this->umc->getVersion(),
|
||||
'mr' => $this->umc->getMR(),
|
||||
'error' => $this->umc->getLastError(),
|
||||
'asset' => function ($rp) {
|
||||
echo $this->getUrl($rp);
|
||||
},
|
||||
'authCode' => $this->authCode,
|
||||
'ajax' => $this->ajaxUrl,
|
||||
'ajaxPage' => $this->ajaxPage,
|
||||
'progress' => $this->umc->getUpdateProgress(),
|
||||
'running' => $this->umc->isRunning(),
|
||||
'insecure' => $this->umc->isInsecure(),
|
||||
'authCode' => $this->authCode,
|
||||
'ajax' => $this->ajaxUrl,
|
||||
'ajaxPage' => $this->ajaxPage,
|
||||
'progress' => $this->umc->getUpdateProgress(),
|
||||
'running' => $this->umc->isRunning(),
|
||||
'insecure' => $this->umc->isInsecure(),
|
||||
'allowOfflinePatches' => $this->allowOfflinePatches,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* exported form_upload */
|
||||
/* global $,ajax,cleanExit,preventExit,umConfirm,umErrorMsg */
|
||||
/* global texts,ajaxPage,insecureMode */
|
||||
/* global ImSureWhatImDoing */
|
||||
|
||||
/**
|
||||
*
|
||||
@ -204,7 +205,9 @@ function form_upload(url, auth, current_package) {
|
||||
|
||||
let number_update = res.version;
|
||||
let server_update = res.server_update;
|
||||
let current_version = parseFloat(current_package);
|
||||
let target_version = Math.round(parseFloat(current_package)) + 1;
|
||||
let target_patch = parseFloat(current_package) + 0.1;
|
||||
|
||||
if (number_update === null) {
|
||||
umConfirm({
|
||||
@ -221,7 +224,31 @@ function form_upload(url, auth, current_package) {
|
||||
cancelUpdate();
|
||||
}
|
||||
});
|
||||
} else if (Math.round(parseFloat(number_update)) != target_version) {
|
||||
} else if (
|
||||
parseFloat(number_update) != target_version &&
|
||||
parseFloat(number_update) != target_patch &&
|
||||
parseFloat(number_update) != current_version
|
||||
) {
|
||||
if (ImSureWhatImDoing == undefined || ImSureWhatImDoing == false) {
|
||||
umConfirm({
|
||||
message:
|
||||
'<span class="warning"></span><p>' +
|
||||
(server_update
|
||||
? texts.notGoingToInstallUnoficialServerWarning
|
||||
: texts.notGoingToInstallUnoficialWarning) +
|
||||
"</p>",
|
||||
title: texts.warning,
|
||||
size: 535,
|
||||
onAccept: function() {
|
||||
location.reload();
|
||||
},
|
||||
onDeny: function() {
|
||||
cancelUpdate();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
umConfirm({
|
||||
message:
|
||||
'<span class="warning"></span><p>' +
|
||||
|
@ -181,7 +181,7 @@ class ClientTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
// Load the conf.
|
||||
try {
|
||||
$this->conf = new \Config('client/conf/test.ini');
|
||||
$this->conf = new \Config(__DIR__.'/../conf/test.ini');
|
||||
} catch (\Exception $e) {
|
||||
$this->fail($e->getMessage());
|
||||
}
|
||||
|
@ -83,7 +83,9 @@
|
||||
'fileList': "<?php echo __('Files included in this package'); ?>",
|
||||
'ignoresign': "<?php echo __('Ignore'); ?>",
|
||||
'verifysigntitle': "<?php echo __('Verify package signature'); ?>",
|
||||
'verifysigns': "<?php echo __('Copy into the textarea the signature validation token you can retrieve from %s and press OK to verify the package, press ignore to avoid signature verification', 'https://support.pandorafms.com'); ?>"
|
||||
'verifysigns': "<?php echo __('Copy into the textarea the signature validation token you can retrieve from %s and press OK to verify the package, press ignore to avoid signature verification', 'https://support.pandorafms.com'); ?>",
|
||||
'notGoingToInstallUnoficialServerWarning': "<?php echo __('This server update does not correspond with current console version and is not going to be installed unless patches are allowed. Please enable patches in update manager settings.'); ?>",
|
||||
'notGoingToInstallUnoficialWarning': "<?php echo __('This update does not correspond with next version of %s and is not going to be installed unless patches are allowed. Please enable patches in update manager settings.', get_product_name()); ?>",
|
||||
}
|
||||
|
||||
var insecureMode = <?php echo ($insecure === true) ? 'true' : 'false'; ?>;
|
||||
@ -96,4 +98,6 @@
|
||||
);
|
||||
}
|
||||
|
||||
var ImSureWhatImDoing = <?php echo (false === $allowOfflinePatches) ? 'false' : 'true'; ?>;
|
||||
|
||||
</script>
|
||||
|
@ -93,6 +93,10 @@ if (!$action_update_url_update_manager) {
|
||||
'update_manager_proxy_password',
|
||||
$config['update_manager_proxy_password']
|
||||
);
|
||||
$allow_offline_patches = get_parameter_switch(
|
||||
'allow_offline_patches',
|
||||
$config['allow_offline_patches']
|
||||
);
|
||||
|
||||
if ($action_update_url_update_manager) {
|
||||
$result = config_update_value(
|
||||
@ -134,6 +138,13 @@ if (!$action_update_url_update_manager) {
|
||||
);
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
$result = config_update_value(
|
||||
'allow_offline_patches',
|
||||
$allow_offline_patches
|
||||
);
|
||||
}
|
||||
|
||||
if ($result && license_free()) {
|
||||
$result = config_update_value(
|
||||
'identification_reminder',
|
||||
@ -154,6 +165,7 @@ if (!$action_update_url_update_manager) {
|
||||
$update_manager_proxy_port = get_parameter('update_manager_proxy_port', '');
|
||||
$update_manager_proxy_user = get_parameter('update_manager_proxy_user', '');
|
||||
$update_manager_proxy_password = get_parameter('update_manager_proxy_password', '');
|
||||
$allow_offline_patches = get_parameter_switch('allow_offline_patches', false);
|
||||
|
||||
|
||||
if ($action_update_url_update_manager) {
|
||||
@ -196,6 +208,13 @@ if (!$action_update_url_update_manager) {
|
||||
);
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
$result = config_update_value(
|
||||
'allow_offline_patches',
|
||||
$allow_offline_patches
|
||||
);
|
||||
}
|
||||
|
||||
if ($result && license_free()) {
|
||||
$result = config_update_value('identification_reminder', $identification_reminder);
|
||||
}
|
||||
@ -288,33 +307,39 @@ $table->data[5][1] = html_print_input_password(
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[6][0] = __('Allow no-consecutive patches:');
|
||||
$table->data[6][1] = html_print_switch(
|
||||
[
|
||||
'name' => 'allow_offline_patches',
|
||||
'value' => $allow_offline_patches,
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
|
||||
$table->data[6][0] = __('Registration ID:');
|
||||
$table->data[6][1] = '<i>'.$config['pandora_uid'].'</i>';
|
||||
$table->data[7][0] = __('Registration ID:');
|
||||
$table->data[7][1] = '<i>'.$config['pandora_uid'].'</i>';
|
||||
|
||||
if (update_manager_verify_registration() === true && users_is_admin()) {
|
||||
$table->data[7][0] = __('Cancel registration:');
|
||||
$table->data[7][1] = '<a href="';
|
||||
$table->data[8][0] = __('Cancel registration:');
|
||||
$table->data[8][1] = '<a href="';
|
||||
if ((bool) is_metaconsole() === true) {
|
||||
$table->data[7][1] .= ui_get_full_url(
|
||||
$table->data[8][1] .= ui_get_full_url(
|
||||
'index.php?sec=advanced&sec2=advanced/metasetup&pure=0&tab=update_manager_setup&um_disconnect_console=1'
|
||||
);
|
||||
} else {
|
||||
$table->data[7][1] .= ui_get_full_url(
|
||||
$table->data[8][1] .= ui_get_full_url(
|
||||
'index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=setup&um_disconnect_console=1'
|
||||
);
|
||||
}
|
||||
|
||||
$table->data[7][1] .= '" onclick="if(confirm(\'Are you sure?\')) {return true;} else { return false; }">'.__('Unregister').'</a>';
|
||||
$table->data[8][1] .= '" onclick="if(confirm(\'Are you sure?\')) {return true;} else { return false; }">'.__('Unregister').'</a>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (license_free()) {
|
||||
$config['identification_reminder'] = isset($config['identification_reminder']) ? $config['identification_reminder'] : 1;
|
||||
$table->data[8][0] = __('Pandora FMS community reminder').ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this Pandora instance'), true);
|
||||
$table->data[8][1] = __('Yes').' '.html_print_radio_button('identification_reminder', 1, '', $config['identification_reminder'], true).' ';
|
||||
$table->data[8][1] .= __('No').' '.html_print_radio_button('identification_reminder', 0, '', $config['identification_reminder'], true);
|
||||
$table->data[9][0] = __('Pandora FMS community reminder').ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this Pandora instance'), true);
|
||||
$table->data[9][1] = __('Yes').' '.html_print_radio_button('identification_reminder', 1, '', $config['identification_reminder'], true).' ';
|
||||
$table->data[9][1] .= __('No').' '.html_print_radio_button('identification_reminder', 0, '', $config['identification_reminder'], true);
|
||||
}
|
||||
|
||||
html_print_input_hidden('action_update_url_update_manager', 1);
|
||||
|
@ -1386,8 +1386,26 @@ class AgentWizard extends HTML
|
||||
$modulesActivated = $tmp;
|
||||
}
|
||||
|
||||
foreach (array_keys($data) as $k) {
|
||||
foreach ($modulesActivated as $key => $value) {
|
||||
/*
|
||||
* Before changing anything inside those loops take in mind, if you
|
||||
* change the module definition at interface level, those are the
|
||||
* values wich will be applied to final module.
|
||||
*
|
||||
* There is no 'parse first default then specific' or similar.
|
||||
*
|
||||
* $modulesActivated has the modules to be created with the information
|
||||
* retrieved from those specific modules.
|
||||
*
|
||||
* Only inherites from 'default' if you made no changes on module
|
||||
* definition (at javascript level before calling this function).
|
||||
*/
|
||||
|
||||
foreach ($modulesActivated as $key => $value) {
|
||||
foreach (array_keys($data) as $k) {
|
||||
if (isset($data[$k]) === false || $data[$k] === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$valueStr = preg_replace('/\//', '\/', $value);
|
||||
|
||||
if (empty(preg_match('/-'.$valueStr.'$/', $k)) === false
|
||||
@ -1401,114 +1419,151 @@ class AgentWizard extends HTML
|
||||
|
||||
if ($data['wizard_section'] === 'snmp_interfaces_explorer') {
|
||||
if (isset($data['module-active-'.$key]) === false
|
||||
|| $data['module-active-'.$key] == 0
|
||||
|| (bool) $data['module-active-'.$key] === false
|
||||
) {
|
||||
if (empty(preg_match('/module-name-set/', $k)) === false) {
|
||||
if (preg_match('/module-name-set/', $k) > 0) {
|
||||
$result[$value]['name'] = $data['module-default_name-'.$key];
|
||||
} else if (empty(preg_match('/module-description-set/', $k)) === false) {
|
||||
$result[$value]['description'] = $data['module-default_description-'.$key];
|
||||
} else if (empty(preg_match('/module-value/', $k)) === false) {
|
||||
$result[$value]['value'] = $data['module-value-'.$key];
|
||||
} else if (empty(preg_match('/module-macros/', $k)) === false) {
|
||||
$result[$value]['macros'] = $data['module-macros-'.$key];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-id_plugin/', $k)) === false) {
|
||||
$result[$value]['id_plugin'] = $data['module-id_plugin-'.$key];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-id_modulo/', $k)) === false) {
|
||||
$result[$value]['id_modulo'] = $data['module-id_modulo-'.$key];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-unit/', $k)) === false) {
|
||||
$result[$value]['unit'] = $data['module-unit-'.$key];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-warning-min/', $k)) === false) {
|
||||
$result[$value]['warningMin'] = $data['module-warning-min-0_0-0'];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-warning-max/', $k)) === false) {
|
||||
$result[$value]['warningMax'] = $data['module-warning-max-0_0-0'];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-critical-min/', $k)) === false) {
|
||||
$result[$value]['criticalMin'] = $data['module-critical-min-0_0-0'];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-critical-max/', $k)) === false) {
|
||||
$result[$value]['criticalMax'] = $data['module-critical-max-0_0-0'];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-critical-inv/', $k)) === false) {
|
||||
if (isset($data['module-critical-inv-0_0-0'])) {
|
||||
$result[$value]['criticalInv'] = $data['module-critical-inv-0_0-0_sent'];
|
||||
}
|
||||
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-warning-inv/', $k)) === false) {
|
||||
if (isset($data['module-warning-inv-0_0-0'])) {
|
||||
$result[$value]['warningInv'] = $data['module-warning-inv-0_0-0_sent'];
|
||||
}
|
||||
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-warning-perc/', $k)) === false) {
|
||||
if (isset($data['module-warning-perc-0_0-0'])) {
|
||||
$result[$value]['warningPerc'] = $data['module-warning-perc-0_0-0_sent'];
|
||||
}
|
||||
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-critical-perc/', $k)) === false) {
|
||||
if (isset($data['module-critical-perc-0_0-0'])) {
|
||||
$result[$value]['criticalPerc'] = $data['module-critical-perc-0_0-0_sent'];
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
preg_match('/^(.*).*?_(\d+)-+(\d+)$/', $k, $matches);
|
||||
$k = $matches[1].'_'.$matches[2].'-'.$matches[3];
|
||||
if (preg_match('/module-description-set/', $k) > 0) {
|
||||
$result[$value]['description'] = $data['module-description-set-'.$key];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/module-value/', $k) > 0) {
|
||||
$result[$value]['value'] = $data['module-value-'.$key];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/module-macros/', $k) > 0) {
|
||||
$result[$value]['macros'] = $data['module-macros-'.$key];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/module-id_plugin/', $k) > 0) {
|
||||
$result[$value]['id_plugin'] = $data['module-id_plugin-'.$key];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/module-id_modulo/', $k) > 0) {
|
||||
$result[$value]['id_modulo'] = $data['module-id_modulo-'.$key];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/module-unit/', $k) > 0) {
|
||||
$result[$value]['unit'] = $data['module-unit-'.$key];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/module-warning-min/', $k) > 0
|
||||
&& '' !== $data['module-warning-min-'.$key]
|
||||
) {
|
||||
$result[$value]['warningMin'] = $data['module-warning-min-'.$key];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/module-warning-max/', $k) > 0
|
||||
&& '' !== $data['module-warning-max-'.$key]
|
||||
) {
|
||||
$result[$value]['warningMax'] = $data['module-warning-max-'.$key];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/module-critical-min/', $k) > 0
|
||||
&& '' !== $data['module-critical-min-'.$key]
|
||||
) {
|
||||
$result[$value]['criticalMin'] = $data['module-critical-min-'.$key];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/module-critical-max/', $k) > 0
|
||||
&& '' !== $data['module-critical-max-'.$key]
|
||||
) {
|
||||
$result[$value]['criticalMax'] = $data['module-critical-max-'.$key];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/module-critical-inv/', $k) > 0
|
||||
&& isset($data['module-critical-inv-'.$key]) === true
|
||||
) {
|
||||
$result[$value]['criticalInv'] = $data['module-critical-inv-'.$key.'_sent'];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/module-warning-inv/', $k) > 0
|
||||
&& isset($data['module-warning-inv-'.$key]) === true
|
||||
) {
|
||||
$result[$value]['warningInv'] = $data['module-warning-inv-'.$key.'_sent'];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/module-warning-perc/', $k) > 0
|
||||
&& isset($data['module-warning-perc-'.$key]) === true
|
||||
) {
|
||||
$result[$value]['warningPerc'] = $data['module-warning-perc-'.$key.'_sent'];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/module-critical-perc/', $k) > 0
|
||||
&& isset($data['module-critical-perc-'.$key]) === true
|
||||
) {
|
||||
$result[$value]['criticalPerc'] = $data['module-critical-perc-'.$key.'_sent'];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/^(.*).*?_(\d+)-+(\d+)$/', $k, $matches) > 0) {
|
||||
$k = $matches[1].'_'.$matches[2].'-'.$matches[3];
|
||||
}
|
||||
} else {
|
||||
if (empty(preg_match('/module-value/', $k)) === false) {
|
||||
if (preg_match('/module-value/', $k) > 0
|
||||
&& empty($data[$k]) === false
|
||||
) {
|
||||
$result[$value]['value'] = $data[$k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty(preg_match('/-'.$valueStr.'_sent$/', $k)) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (empty(preg_match('/module-warning-min/', $k)) === false) {
|
||||
// Specific customization only if switch is active.
|
||||
if (preg_match('/module-warning-min/', $k) > 0) {
|
||||
$result[$value]['warningMin'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-warning-max/', $k)) === false) {
|
||||
} else if (preg_match('/module-warning-max/', $k) > 0) {
|
||||
$result[$value]['warningMax'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-critical-min/', $k)) === false) {
|
||||
} else if (preg_match('/module-critical-min/', $k) > 0) {
|
||||
$result[$value]['criticalMin'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-critical-max/', $k)) === false) {
|
||||
} else if (preg_match('/module-critical-max/', $k) > 0) {
|
||||
$result[$value]['criticalMax'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-critical-inv/', $k)) === false) {
|
||||
} else if (preg_match('/module-critical-inv/', $k) > 0) {
|
||||
$result[$value]['criticalInv'] = $data[$k.'_sent'];
|
||||
} else if (empty(preg_match('/module-warning-inv/', $k)) === false) {
|
||||
} else if (preg_match('/module-warning-inv/', $k) > 0) {
|
||||
$result[$value]['warningInv'] = $data[$k.'_sent'];
|
||||
} else if (empty(preg_match('/module-warning-perc/', $k)) === false) {
|
||||
} else if (preg_match('/module-warning-perc/', $k) > 0) {
|
||||
$result[$value]['warningPerc'] = $data[$k.'_sent'];
|
||||
} else if (empty(preg_match('/module-critical-perc/', $k)) === false) {
|
||||
} else if (preg_match('/module-critical-perc/', $k) > 0) {
|
||||
$result[$value]['criticalPerc'] = $data[$k.'_sent'];
|
||||
} else if (empty(preg_match('/module-type/', $k)) === false) {
|
||||
} else if (preg_match('/module-type/', $k) > 0) {
|
||||
$result[$value]['moduleType'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-unit/', $k)) === false) {
|
||||
} else if (preg_match('/module-unit/', $k) > 0) {
|
||||
$result[$value]['unit'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-scan_type/', $k)) === false) {
|
||||
} else if (preg_match('/module-scan_type/', $k) > 0) {
|
||||
$result[$value]['scan_type'] = (int) $data[$k];
|
||||
} else if (empty(preg_match('/module-execution_type/', $k)) === false) {
|
||||
} else if (preg_match('/module-execution_type/', $k) > 0) {
|
||||
$result[$value]['execution_type'] = (int) $data[$k];
|
||||
} else if (($data['wizard_section'] !== 'snmp_interfaces_explorer') && (empty(preg_match('/module-value/', $k)) === false)) {
|
||||
} else if (($data['wizard_section'] !== 'snmp_interfaces_explorer')
|
||||
&& preg_match('/module-value/', $k) > 0
|
||||
) {
|
||||
$result[$value]['value'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-macros/', $k)) === false) {
|
||||
} else if (preg_match('/module-macros/', $k) > 0) {
|
||||
$result[$value]['macros'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-name-oid/', $k)) === false) {
|
||||
} else if (preg_match('/module-name-oid/', $k) > 0) {
|
||||
$result[$value]['nameOid'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-query_class/', $k)) === false) {
|
||||
} else if (preg_match('/module-query_class/', $k) > 0) {
|
||||
$result[$value]['queryClass'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-query_key_field/', $k)) === false) {
|
||||
} else if (preg_match('/module-query_key_field/', $k) > 0) {
|
||||
$result[$value]['queryKeyField'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-scan_filters/', $k)) === false) {
|
||||
} else if (preg_match('/module-scan_filters/', $k) > 0) {
|
||||
$result[$value]['scanFilters'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-query_filters/', $k)) === false) {
|
||||
} else if (preg_match('/module-query_filters/', $k) > 0) {
|
||||
$result[$value]['queryFilters'] = $data[$k];
|
||||
} else {
|
||||
$result[$value][$k] = $data[$k];
|
||||
@ -5971,19 +6026,19 @@ class AgentWizard extends HTML
|
||||
|
||||
if($(checkbox).prop('checked', true)) {
|
||||
if(checkbox_name.match(/warning-inv/gm) !== null) {
|
||||
$('#checkbox-module-warning-perc-'+uniqueId).prop('checked', false);
|
||||
$('#checkbox-module-warning-perc-'+uniqueId.replace('/','\\/')).prop('checked', false);
|
||||
}
|
||||
|
||||
if(checkbox_name.match(/critical-inv/gm) !== null) {
|
||||
$('#checkbox-module-critical-perc-'+uniqueId).prop('checked', false);
|
||||
$('#checkbox-module-critical-perc-'+uniqueId.replace('/','\\/')).prop('checked', false);
|
||||
}
|
||||
|
||||
if(checkbox_name.match(/warning-perc/gm) !== null) {
|
||||
$('#checkbox-module-warning-inv-'+uniqueId).prop('checked', false);
|
||||
$('#checkbox-module-warning-inv-'+uniqueId.replace('/','\\/')).prop('checked', false);
|
||||
}
|
||||
|
||||
if(checkbox_name.match(/critical-perc/gm) !== null) {
|
||||
$('#checkbox-module-critical-inv-'+uniqueId).prop('checked', false);
|
||||
$('#checkbox-module-critical-inv-'+uniqueId.replace('/','\\/')).prop('checked', false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC220221';
|
||||
$build_version = 'PC220307';
|
||||
$pandora_version = 'v7.0NG.760';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -3395,3 +3395,120 @@ function alerts_get_templates_name_array($array_ids)
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Default values events calendar templates.
|
||||
*
|
||||
* @param integer $id ID.
|
||||
* @param string $table Name table.
|
||||
*
|
||||
* @return array Data Events.
|
||||
*/
|
||||
function default_events_calendar($id, $table)
|
||||
{
|
||||
$result = [
|
||||
'monday' => [
|
||||
[
|
||||
'start' => '00:00:00',
|
||||
'end' => '00:00:00',
|
||||
],
|
||||
],
|
||||
'tuesday' => [
|
||||
[
|
||||
'start' => '00:00:00',
|
||||
'end' => '00:00:00',
|
||||
],
|
||||
],
|
||||
'wednesday' => [
|
||||
[
|
||||
'start' => '00:00:00',
|
||||
'end' => '00:00:00',
|
||||
],
|
||||
],
|
||||
'thursday' => [
|
||||
[
|
||||
'start' => '00:00:00',
|
||||
'end' => '00:00:00',
|
||||
],
|
||||
],
|
||||
'friday' => [
|
||||
[
|
||||
'start' => '00:00:00',
|
||||
'end' => '00:00:00',
|
||||
],
|
||||
],
|
||||
'saturday' => [
|
||||
[
|
||||
'start' => '00:00:00',
|
||||
'end' => '00:00:00',
|
||||
],
|
||||
],
|
||||
'sunday' => [
|
||||
[
|
||||
'start' => '00:00:00',
|
||||
'end' => '00:00:00',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$days = [
|
||||
'monday',
|
||||
'tuesday',
|
||||
'wednesday',
|
||||
'thursday',
|
||||
'friday',
|
||||
'saturday',
|
||||
'sunday',
|
||||
];
|
||||
|
||||
// Check Exists.
|
||||
if (empty($id) === false) {
|
||||
$sql_default_alert = sprintf(
|
||||
'SELECT `id`,
|
||||
`name`,
|
||||
`time_from`,
|
||||
`time_to`,
|
||||
`monday`,
|
||||
`tuesday`,
|
||||
`wednesday`,
|
||||
`thursday`,
|
||||
`friday`,
|
||||
`saturday`,
|
||||
`sunday`,
|
||||
`schedule`
|
||||
FROM %s
|
||||
WHERE id = %d',
|
||||
$table,
|
||||
$id
|
||||
);
|
||||
|
||||
$r = db_get_row_sql($sql_default_alert);
|
||||
if ($r != false) {
|
||||
// Check Exist schedule.
|
||||
if (empty($r['schedule']) === false) {
|
||||
$result = json_decode(io_safe_output($r['schedule']), true);
|
||||
} else {
|
||||
// Compatibility mode old.
|
||||
$result = [];
|
||||
foreach ($days as $day) {
|
||||
if ((int) $r[$day] === 1) {
|
||||
$start = $r['time_from'];
|
||||
$to = $r['time_to'];
|
||||
if ($r['time_from'] === $r['time_to']) {
|
||||
$start = '00:00:00';
|
||||
$to = '00:00:00';
|
||||
}
|
||||
|
||||
$result[$day][0] = [
|
||||
'start' => $start,
|
||||
'end' => $to,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -1535,10 +1535,6 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
|
||||
'disabled',
|
||||
]
|
||||
);
|
||||
$tpolicy_group_old = db_get_all_rows_sql(
|
||||
'SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = '.$values_old['id_grupo']
|
||||
);
|
||||
|
||||
$return = db_process_sql_update(
|
||||
'tagente',
|
||||
@ -1577,59 +1573,6 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ($tpolicy_group_old) {
|
||||
foreach ($tpolicy_group_old as $key => $value) {
|
||||
$tpolicy_agents_old = db_get_sql(
|
||||
'SELECT * FROM tpolicy_agents
|
||||
WHERE id_policy = '.$value['id_policy'].' AND id_agent = '.$id_agent
|
||||
);
|
||||
|
||||
if ($tpolicy_agents_old) {
|
||||
$result2 = db_process_sql_update(
|
||||
'tpolicy_agents',
|
||||
['pending_delete' => 1],
|
||||
[
|
||||
'id_agent' => $id_agent,
|
||||
'id_policy' => $value['id_policy'],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tpolicy_group = db_get_all_rows_sql(
|
||||
'SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = '.$idGroup
|
||||
);
|
||||
|
||||
if ($tpolicy_group) {
|
||||
foreach ($tpolicy_group as $key => $value) {
|
||||
$tpolicy_agents = db_get_sql(
|
||||
'SELECT * FROM tpolicy_agents
|
||||
WHERE id_policy = '.$value['id_policy'].' AND id_agent ='.$id_agent
|
||||
);
|
||||
|
||||
if (!$tpolicy_agents) {
|
||||
db_process_sql_insert(
|
||||
'tpolicy_agents',
|
||||
[
|
||||
'id_policy' => $value['id_policy'],
|
||||
'id_agent' => $id_agent,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$result3 = db_process_sql_update(
|
||||
'tpolicy_agents',
|
||||
['pending_delete' => 0],
|
||||
[
|
||||
'id_agent' => $id_agent,
|
||||
'id_policy' => $value['id_policy'],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
returnData(
|
||||
@ -1829,11 +1772,6 @@ function api_set_update_agent_field($id_agent, $use_agent_alias, $params)
|
||||
]
|
||||
);
|
||||
|
||||
$tpolicy_group_old = db_get_all_rows_sql(
|
||||
'SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = '.$values_old['id_grupo']
|
||||
);
|
||||
|
||||
$return = db_process_sql_update(
|
||||
'tagente',
|
||||
$fields,
|
||||
@ -1861,59 +1799,6 @@ function api_set_update_agent_field($id_agent, $use_agent_alias, $params)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ($tpolicy_group_old) {
|
||||
foreach ($tpolicy_group_old as $key => $value) {
|
||||
$tpolicy_agents_old = db_get_sql(
|
||||
'SELECT * FROM tpolicy_agents
|
||||
WHERE id_policy = '.$value['id_policy'].' AND id_agent = '.$agent
|
||||
);
|
||||
|
||||
if ($tpolicy_agents_old) {
|
||||
$result2 = db_process_sql_update(
|
||||
'tpolicy_agents',
|
||||
['pending_delete' => 1],
|
||||
[
|
||||
'id_agent' => $agent,
|
||||
'id_policy' => $value['id_policy'],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tpolicy_group = db_get_all_rows_sql(
|
||||
'SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = '.$field['id_grupo']
|
||||
);
|
||||
|
||||
if ($tpolicy_group) {
|
||||
foreach ($tpolicy_group as $key => $value) {
|
||||
$tpolicy_agents = db_get_sql(
|
||||
'SELECT * FROM tpolicy_agents
|
||||
WHERE id_policy = '.$value['id_policy'].' AND id_agent ='.$agent
|
||||
);
|
||||
|
||||
if (!$tpolicy_agents) {
|
||||
db_process_sql_insert(
|
||||
'tpolicy_agents',
|
||||
[
|
||||
'id_policy' => $value['id_policy'],
|
||||
'id_agent' => $agent,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$result3 = db_process_sql_update(
|
||||
'tpolicy_agents',
|
||||
['pending_delete' => 0],
|
||||
[
|
||||
'id_agent' => $agent,
|
||||
'id_policy' => $value['id_policy'],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2066,23 +1951,6 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
|
||||
agents_add_address($id_agente, $direccion_agente);
|
||||
}
|
||||
|
||||
$tpolicy_group_old = db_get_all_rows_sql(
|
||||
'SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = '.$grupo
|
||||
);
|
||||
|
||||
if ($tpolicy_group_old) {
|
||||
foreach ($tpolicy_group_old as $key => $old_group) {
|
||||
db_process_sql_insert(
|
||||
'tpolicy_agents',
|
||||
[
|
||||
'id_policy' => $old_group['id_policy'],
|
||||
'id_agent' => $id_agente,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$info = '{"Name":"'.$nombre_agente.'",
|
||||
"IP":"'.$direccion_agente.'",
|
||||
"Group":"'.$grupo.'",
|
||||
|
@ -567,7 +567,7 @@ function groups_get_groups_tree_recursive($groups, $trash=0, $trash2=0)
|
||||
|
||||
$tree = $groups;
|
||||
foreach ($groups as $key => $group) {
|
||||
if ($group['id_grupo'] == 0) {
|
||||
if (is_array($group) === false || (int) $group['id_grupo'] === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -961,7 +961,9 @@ function html_print_select(
|
||||
}
|
||||
|
||||
$output .= '<script type="text/javascript">';
|
||||
$output .= '$("#'.$id.'").select2();';
|
||||
$output .= '$("#'.$id.'").select2({
|
||||
closeOnSelect: '.(($select2_multiple_enable === true) ? 'false' : 'true').'
|
||||
});';
|
||||
|
||||
if ($required !== false) {
|
||||
$require_message = __('Please select an item from this list.');
|
||||
@ -994,6 +996,79 @@ function html_print_select(
|
||||
|
||||
$output .= '$("#'.$id.'").trigger("change");';
|
||||
|
||||
$output .= 'var count_shift_'.$id.' = 0;';
|
||||
$output .= 'var shift_array_'.$id.' = [];';
|
||||
$output .= 'var options_selecteds_'.$id.' = [];';
|
||||
$output .= '$("#'.$id.'").on("select2:select", function (e) {
|
||||
if (event.shiftKey) {
|
||||
shift_array_'.$id.'.push(e.params.data.element.index);
|
||||
count_shift_'.$id.'++;
|
||||
}
|
||||
if(count_shift_'.$id.' == 2 ){
|
||||
if(shift_array_'.$id.'[0] <= shift_array_'.$id.'[1]) {
|
||||
for (var i = shift_array_'.$id.'[0]; i <= shift_array_'.$id.'[1]; i++) {
|
||||
var option_value = $("#'.$id.' option").eq(i).val();
|
||||
options_selecteds_'.$id.'.push(option_value);
|
||||
}
|
||||
} else {
|
||||
for (var i = shift_array_'.$id.'[0]; i >= shift_array_'.$id.'[1]; i--) {
|
||||
var option_value = $("#'.$id.' option").eq(i).val();
|
||||
options_selecteds_'.$id.'.push(option_value);
|
||||
}
|
||||
}
|
||||
|
||||
$("#'.$id.'").val(
|
||||
[
|
||||
...$("#'.$id.'").val(),
|
||||
...options_selecteds_'.$id.'
|
||||
]
|
||||
);
|
||||
|
||||
$("#'.$id.'").trigger("change");
|
||||
$("#'.$id.'").select2("close");
|
||||
count_shift_'.$id.' = 0;
|
||||
shift_array_'.$id.' = [];
|
||||
options_selecteds_'.$id.' = [];
|
||||
}
|
||||
});';
|
||||
|
||||
$output .= 'var delete_count_shift_'.$id.' = 0;';
|
||||
$output .= 'var delete_shift_array_'.$id.' = [];';
|
||||
$output .= 'var delete_options_selecteds_'.$id.' = [];';
|
||||
$output .= '$("#'.$id.'").on("select2:unselect", function (e) {
|
||||
if (event.shiftKey) {
|
||||
delete_shift_array_'.$id.'.push(e.params.data.element.index);
|
||||
delete_count_shift_'.$id.'++;
|
||||
}
|
||||
if(delete_count_shift_'.$id.' == 2 ){
|
||||
if(delete_shift_array_'.$id.'[0] <= delete_shift_array_'.$id.'[1]) {
|
||||
for (var i = delete_shift_array_'.$id.'[0]; i <= delete_shift_array_'.$id.'[1]; i++) {
|
||||
var option_value = $("#'.$id.' option").eq(i).val();
|
||||
delete_options_selecteds_'.$id.'.push(option_value);
|
||||
}
|
||||
} else {
|
||||
for (var i = delete_shift_array_'.$id.'[0]; i >= delete_shift_array_'.$id.'[1]; i--) {
|
||||
var option_value = $("#'.$id.' option").eq(i).val();
|
||||
delete_options_selecteds_'.$id.'.push(option_value);
|
||||
}
|
||||
}
|
||||
|
||||
var result = [];
|
||||
$("#'.$id.'").val().forEach(function(value) {
|
||||
if (delete_options_selecteds_'.$id.'.includes(value) == false) {
|
||||
result.push(value);
|
||||
}
|
||||
});
|
||||
|
||||
$("#'.$id.'").val(result);
|
||||
$("#'.$id.'").trigger("change");
|
||||
$("#'.$id.'").select2("close");
|
||||
delete_count_shift_'.$id.' = 0;
|
||||
delete_shift_array_'.$id.' = [];
|
||||
delete_options_selecteds_'.$id.' = [];
|
||||
}
|
||||
});';
|
||||
|
||||
$output .= 'function checkMultipleAll(id){
|
||||
if ($("#checkbox-"+id.id+"-check-all").is(":checked")) {
|
||||
$("#"+id.id+" > option").prop("selected", "selected");
|
||||
@ -1584,17 +1659,31 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
||||
0 => __('Show common modules'),
|
||||
1 => __('Show all modules'),
|
||||
];
|
||||
$output .= html_print_input(
|
||||
[
|
||||
'label' => __('Show common modules'),
|
||||
'type' => 'select',
|
||||
'fields' => $selection,
|
||||
'name' => 'filtered-module-show-common-modules-'.$uniqId,
|
||||
'selected' => $data['mShowCommonModules'],
|
||||
'return' => true,
|
||||
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
|
||||
]
|
||||
);
|
||||
|
||||
if (true) {
|
||||
$output .= html_print_input(
|
||||
[
|
||||
|
||||
'label' => __('Only common modules'),
|
||||
'type' => 'switch',
|
||||
'value' => 'checked',
|
||||
'id' => 'filtered-module-show-common-modules-'.$uniqId,
|
||||
'return' => true,
|
||||
'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$output .= html_print_input(
|
||||
[
|
||||
'label' => __('Show common modules'),
|
||||
'type' => 'select',
|
||||
'fields' => $selection,
|
||||
'name' => 'filtered-module-show-common-modules-'.$uniqId,
|
||||
'return' => true,
|
||||
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ($data['mAgents'] !== null) {
|
||||
$all_modules = get_modules_agents(
|
||||
|
@ -3726,7 +3726,7 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_same_modules($agents, $modules)
|
||||
function get_same_modules($agents, array $modules=[])
|
||||
{
|
||||
if (is_array($agents) === false || empty($agents) === true) {
|
||||
return [];
|
||||
@ -3791,7 +3791,8 @@ function get_same_modules_all($agents, $modules, $select_mode=true)
|
||||
|
||||
$carry[$explode[0]][] = $explode[1];
|
||||
return $carry;
|
||||
}
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
if ($select_mode === true) {
|
||||
@ -3802,7 +3803,8 @@ function get_same_modules_all($agents, $modules, $select_mode=true)
|
||||
|
||||
$carry[$explode[0]][] = $explode[1];
|
||||
return $carry;
|
||||
}
|
||||
},
|
||||
[]
|
||||
);
|
||||
} else {
|
||||
$rows = db_get_all_rows_sql(
|
||||
@ -3831,7 +3833,7 @@ function get_same_modules_all($agents, $modules, $select_mode=true)
|
||||
$result = [];
|
||||
foreach ($agents as $tserver => $id_agents) {
|
||||
if (metaconsole_connect(null, $tserver) == NOERR) {
|
||||
$same_modules = get_same_modules($id_agents, $modules[$tserver]);
|
||||
$same_modules = get_same_modules($id_agents, ($modules[$tserver] ?? []));
|
||||
foreach ($same_modules as $id_module) {
|
||||
$result[] = $tserver.'|'.$id_module;
|
||||
}
|
||||
|
@ -214,9 +214,14 @@ function fmAgentChange(uniqId) {
|
||||
function fmModuleChange(uniqId, isMeta) {
|
||||
var idModuleGroup = $("#filtered-module-module-group-" + uniqId).val();
|
||||
var idAgents = $("#filtered-module-agents-" + uniqId).val();
|
||||
var showCommonModules = $(
|
||||
var commonSelectorType = $(
|
||||
"#filtered-module-show-common-modules-" + uniqId
|
||||
).val();
|
||||
).attr("type");
|
||||
|
||||
var showCommonModules = +(
|
||||
$("#filtered-module-show-common-modules-" + uniqId).prop("checked") == false
|
||||
);
|
||||
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
{
|
||||
@ -227,11 +232,15 @@ function fmModuleChange(uniqId, isMeta) {
|
||||
selection: showCommonModules
|
||||
},
|
||||
function(data) {
|
||||
debugger;
|
||||
$("#filtered-module-modules-" + uniqId).html("");
|
||||
if (data) {
|
||||
jQuery.each(data, function(id, value) {
|
||||
var option = $("<option></option>");
|
||||
if (isMeta === 1) {
|
||||
if (value["id_node"] == null || value["id_node"] == "") {
|
||||
option.attr("value", id).html(value);
|
||||
}
|
||||
option
|
||||
.attr(
|
||||
"value",
|
||||
|
@ -388,9 +388,12 @@ function initialiceLayout(data) {
|
||||
dashboardId: data.dashboardId,
|
||||
widgetId: widgetId
|
||||
},
|
||||
width: widgetId == 14 || widgetId == 2 || widgetId == 23 ? 750 : 450,
|
||||
maxHeight: 610,
|
||||
minHeight: 400
|
||||
width:
|
||||
widgetId == 14 || widgetId == 2 || widgetId == 23 || widgetId == 16
|
||||
? 750
|
||||
: 450,
|
||||
maxHeight: 650,
|
||||
minHeight: widgetId == 16 ? 450 : 400
|
||||
},
|
||||
onsubmit: {
|
||||
page: data.page,
|
||||
|
@ -267,6 +267,7 @@ class AgentModuleWidget extends Widget
|
||||
'mShowSelectedOtherGroups' => true,
|
||||
'mReturnAllGroup' => $return_all_group,
|
||||
'mMetaFields' => ((bool) is_metaconsole()),
|
||||
'commonModulesSwitch' => true,
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -493,7 +493,7 @@ div#main_pure {
|
||||
#form-config-widget .info_box,
|
||||
.content-widget .info_box {
|
||||
border-radius: 5px;
|
||||
width: 90%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#form-config-widget .info_box {
|
||||
@ -519,16 +519,17 @@ div#main_pure {
|
||||
#select_multiple_modules_filtered {
|
||||
border: 1px solid #c1c1c1;
|
||||
border-radius: 10px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
#select_multiple_modules_filtered > div {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: 5px;
|
||||
flex-wrap: wrap;
|
||||
flex: 1 1 320px;
|
||||
flex: 1 2 750px;
|
||||
}
|
||||
|
||||
#select_multiple_modules_filtered > div > div {
|
||||
@ -537,12 +538,21 @@ div#main_pure {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
#select_multiple_modules_filtered > div > div > * {
|
||||
flex: auto;
|
||||
}
|
||||
|
||||
#select_multiple_modules_filtered > div > div > select {
|
||||
min-width: 250px !important;
|
||||
}
|
||||
|
||||
#select_multiple_modules_filtered > div > div > .select2 {
|
||||
min-width: 250px !important;
|
||||
}
|
||||
|
||||
.visual-console-container-dashboard div.label strong {
|
||||
color: inherit;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.760';
|
||||
$build = '220221';
|
||||
$build = '220307';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
@ -557,13 +557,13 @@ $table_ichanges = '<div class="autorefresh_select">
|
||||
</div>
|
||||
<div class="autorefresh_select_arrows" style="display:grid">
|
||||
<a href="javascript:">'.html_print_image(
|
||||
'images/darrowright_green.png',
|
||||
true,
|
||||
[
|
||||
'id' => 'right_autorefreshlist',
|
||||
'alt' => __('Push selected pages into autorefresh list'),
|
||||
'title' => __('Push selected pages into autorefresh list'),
|
||||
]
|
||||
'images/darrowright_green.png',
|
||||
true,
|
||||
[
|
||||
'id' => 'right_autorefreshlist',
|
||||
'alt' => __('Push selected pages into autorefresh list'),
|
||||
'title' => __('Push selected pages into autorefresh list'),
|
||||
]
|
||||
).'</a>
|
||||
<a href="javascript:">'.html_print_image(
|
||||
'images/darrowleft_green.png',
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.760
|
||||
%define release 220221
|
||||
%define release 220307
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.760
|
||||
%define release 220221
|
||||
%define release 220307
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.760
|
||||
%define release 220221
|
||||
%define release 220307
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -605,10 +605,7 @@ CREATE TABLE IF NOT EXISTS `talert_special_days` (
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `talert_execution_queue` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_alert_template_module` INT UNSIGNED NOT NULL,
|
||||
`alert_mode` TINYINT NOT NULL,
|
||||
`data` MEDIUMTEXT,
|
||||
`extra_macros` TEXT,
|
||||
`data` LONGTEXT,
|
||||
`utimestamp` BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
@ -2583,6 +2580,21 @@ CREATE TABLE IF NOT EXISTS `tpolicy_groups` (
|
||||
UNIQUE (`id_policy`, `id_group`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tpolicy_group_agents`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tpolicy_group_agents` (
|
||||
`id` SERIAL,
|
||||
`id_policy` INT UNSIGNED,
|
||||
`id_agent` INT UNSIGNED,
|
||||
`direct` TINYINT UNSIGNED DEFAULT 0,
|
||||
FOREIGN KEY (`id_policy`) REFERENCES `tpolicies`(`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tdashboard`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
@ -985,14 +985,6 @@ INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `t
|
||||
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `wizard_level`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `tags`, `disabled_types_event`, `module_macros`) VALUES (783,'Check Informix Port','',19,9,0,0,300,1526,'','','public','',2,2,0,'','','',0,1,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.0000000000000,'basic','','','','','','');
|
||||
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `wizard_level`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `tags`, `disabled_types_event`, `module_macros`) VALUES (784,'Check port DB2','',49,9,0,0,300,50000,'','','public','',2,2,0,'','','',0,1,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.0000000000000,'basic','','','','','','');
|
||||
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `each_ff`) VALUES (785,'Packet Loss','Measure packet loss in the network, using a flood ping (50 ping in 8 secons) and counting back missing packets. It should be zero on most cases. ',10,1,0,0,300,0,'','','','',2,4,9,'','','',0,0,1,10.00,0.00,'',30.00,0.00,'',0,'','','',0,0,0.00000,'%','nowizard','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Test time\",\"help\":\"\",\"value\":\"8\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Target IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}','You should check manually the packet loss of the network with a flood ping on targeted host (ping -c 100 -f xxxx). Aditionally, and due the major packet loss, probably you can see a simple ping failing here. Check your network equipment.','You should check manually the packet loss of the network with a flood ping on targeted host (ping -c 100 -f xxxx)','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0);
|
||||
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES (786,'N. total processes','Number of running processes in a Windows system.',11,34,0,0,300,0,'tasklist /NH | find /c /v ""','','','',6,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','windows','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES (787,'Free space in C:','Free space available in C:',11,34,0,0,300,0,'powershell $obj=(Get-WmiObject -class "Win32_LogicalDisk" -namespace "root\CIMV2") ; $obj.FreeSpace[0] * 100 /$obj.Size[0]','','','',4,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','windows','',0,0,0.000000000000000,'%','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES (788,'Linux uptime','System uptime',43,36,0,0,300,0,'uptime |sed s/us\.*$//g | sed s/,\.*$//g','','','',4,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES (789,'Linux processes','Running processes',43,34,0,0,300,0,'ps elf | wc -l','','','',6,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES (790,'Linux system load','Current load (5 min)',43,34,0,0,300,0,'uptime | awk '{print $(NF-1)}' | tr -d ','','','','',6,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES (791,'Linux available memory percent','Available memory %',43,34,0,0,300,0,'free | grep Mem | awk '{print $NF/$2 * 100}'','','','',4,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'%','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES (792,'Linux available disk /','Available free space in mountpoint /',43,34,0,0,300,0,'df / | tail -n +2 | awk '{print $(NF-1)}' | tr -d '%'','','','',4,2,0,'','','',0,0,1,0.00,0.00,'0.00',0.00,0.00,'',0,'','inherited','',0,0,0.000000000000000,'','nowizard','','nowizard','0','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0);
|
||||
|
||||
|
||||
--
|
||||
-- Dumping data for table `tnetwork_component_group`
|
||||
|
@ -5,7 +5,7 @@
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
|
@ -12,7 +12,7 @@ use NetAddr::IP;
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 7.0NG.760-220221
|
||||
Version: 7.0NG.760-220307
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.760-220221"
|
||||
pandora_version="7.0NG.760-220307"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -24,7 +24,7 @@ use threads;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
# Pandora Modules
|
||||
use PandoraFMS::DB;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package PandoraFMS::AlertServer;
|
||||
##########################################################################
|
||||
################################################################################
|
||||
# Pandora FMS Alert Server.
|
||||
# Pandora FMS. the Flexible Monitoring System. http://www.pandorafms.org
|
||||
##########################################################################
|
||||
################################################################################
|
||||
# Copyright (c) 2005-2021 Artica Soluciones Tecnologicas S.L
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
@ -15,7 +15,7 @@ package PandoraFMS::AlertServer;
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##########################################################################
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
@ -24,6 +24,7 @@ use threads;
|
||||
use threads::shared;
|
||||
use Thread::Semaphore;
|
||||
|
||||
use MIME::Base64;
|
||||
use JSON;
|
||||
use POSIX qw(strftime);
|
||||
|
||||
@ -47,9 +48,9 @@ my $AlertSem :shared;
|
||||
my %Alerts :shared;
|
||||
my $EventRef :shared = 0;
|
||||
|
||||
########################################################################################
|
||||
################################################################################
|
||||
# Alert Server class constructor.
|
||||
########################################################################################
|
||||
################################################################################
|
||||
sub new ($$$) {
|
||||
my ($class, $config, $dbh) = @_;
|
||||
|
||||
@ -69,9 +70,9 @@ sub new ($$$) {
|
||||
return $self;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
################################################################################
|
||||
# Run.
|
||||
###############################################################################
|
||||
################################################################################
|
||||
sub run ($) {
|
||||
my $self = shift;
|
||||
my $pa_config = $self->getConfig ();
|
||||
@ -81,9 +82,9 @@ sub run ($) {
|
||||
$self->SUPER::run (\@TaskQueue, \%PendingTasks, $Sem, $TaskSem);
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
################################################################################
|
||||
# Data producer.
|
||||
###############################################################################
|
||||
################################################################################
|
||||
sub data_producer ($) {
|
||||
my $self = shift;
|
||||
my ($pa_config, $dbh) = ($self->getConfig (), $self->getDBH ());
|
||||
@ -120,14 +121,16 @@ sub data_producer ($) {
|
||||
return @tasks;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
################################################################################
|
||||
# Data consumer.
|
||||
###############################################################################
|
||||
################################################################################
|
||||
sub data_consumer ($$) {
|
||||
my ($self, $task_id) = @_;
|
||||
my ($pa_config, $dbh) = ($self->getConfig (), $self->getDBH ());
|
||||
|
||||
eval {{
|
||||
local $SIG{__DIE__};
|
||||
|
||||
# Get the alert from the queue.
|
||||
my $task = get_db_single_row ($dbh, 'SELECT * FROM talert_execution_queue WHERE id = ?', $task_id);
|
||||
if (! defined ($task)) {
|
||||
@ -135,42 +138,40 @@ sub data_consumer ($$) {
|
||||
last 0;
|
||||
}
|
||||
|
||||
# Get the alert data.
|
||||
my $alert = get_db_single_row ($dbh, 'SELECT talert_template_modules.id as id_template_module,
|
||||
talert_template_modules.*, talert_templates.*
|
||||
FROM talert_template_modules, talert_templates
|
||||
WHERE talert_template_modules.id_alert_template = talert_templates.id
|
||||
AND talert_template_modules.id = ?', $task->{'id_alert_template_module'});
|
||||
if (! defined ($alert)) {
|
||||
logger($pa_config, "Alert ID " . $task->{'id_alert_template_module'} . " not found.", 10);
|
||||
last;
|
||||
my $args = PandoraFMS::Tools::p_decode_json(
|
||||
$pa_config,
|
||||
decode_base64($task->{'data'})
|
||||
);
|
||||
|
||||
if (ref $args ne "ARRAY") {
|
||||
die ('Invalid alert queued');
|
||||
}
|
||||
|
||||
# Get the agent and module associated with the alert
|
||||
my $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente_modulo = ?', $alert->{'id_agent_module'});
|
||||
if (! defined ($module)) {
|
||||
logger($pa_config, "Module ID " . $alert->{'id_agent_module'} . " not found for alert ID " . $alert->{'id_template_module'} . ".", 10);
|
||||
last;
|
||||
}
|
||||
my $agent = get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE id_agente = ?', $module->{'id_agente'});
|
||||
if (! defined ($agent)) {
|
||||
logger($pa_config, "Agent ID " . $module->{'id_agente'} . " not found for module ID " . $module->{'id_agente_modulo'} . " alert ID " . $alert->{'id_template_module'} . ".", 10);
|
||||
last;
|
||||
}
|
||||
my @args = @{$args};
|
||||
|
||||
# Execute the alert.
|
||||
pandora_execute_alert ($pa_config, $task->{'data'}, $agent, $module, $alert, $task->{'alert_mode'},
|
||||
$dbh, strftime ("%Y-%m-%d %H:%M:%S", localtime()), 0, decode_json($task->{'extra_macros'}));
|
||||
# You cannot code a DBI object into JSON, use current.
|
||||
my $execution_args = [
|
||||
$pa_config,
|
||||
@args[0..4],
|
||||
$dbh,
|
||||
@args[5..$#args]
|
||||
];
|
||||
|
||||
# Execute.
|
||||
PandoraFMS::Core::pandora_execute_alert(@$execution_args);
|
||||
}};
|
||||
if ($@) {
|
||||
logger ($pa_config,"[ERROR] Executing alert ".$@, 0);
|
||||
}
|
||||
|
||||
# Remove the alert from the queue and unlock.
|
||||
db_do($dbh, 'DELETE FROM talert_execution_queue WHERE id=?', $task_id);
|
||||
alert_unlock($pa_config, $task_id);
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
################################################################################
|
||||
# Get a lock on the given alert. Return 1 on success, 0 otherwise.
|
||||
##########################################################################
|
||||
################################################################################
|
||||
sub alert_lock {
|
||||
my ($pa_config, $alert, $locked_alerts) = @_;
|
||||
|
||||
@ -186,9 +187,9 @@ sub alert_lock {
|
||||
return 1;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
################################################################################
|
||||
# Remove the lock on the given alert.
|
||||
##########################################################################
|
||||
################################################################################
|
||||
sub alert_unlock {
|
||||
my ($pa_config, $alert) = @_;
|
||||
|
||||
|
@ -22,7 +22,7 @@ use POSIX qw(strftime);
|
||||
use Time::Local;
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.760";
|
||||
my $pandora_build = "220221";
|
||||
my $pandora_build = "220307";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -145,7 +145,7 @@ if (!$@) {
|
||||
}
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::DB;
|
||||
use PandoraFMS::Config;
|
||||
@ -551,31 +551,48 @@ sub pandora_evaluate_alert ($$$$$$$;$$$$) {
|
||||
return $status if ($alert->{$DayNames[$wday]} != 1);
|
||||
}
|
||||
|
||||
my $schedule = PandoraFMS::Tools::p_decode_json($pa_config, $alert->{'schedule'});
|
||||
|
||||
return $status unless defined($schedule) && ref $schedule eq "HASH";
|
||||
|
||||
return $status unless defined($schedule->{$DayNames[$wday]});
|
||||
|
||||
return $status unless ref($schedule->{$DayNames[$wday]}) eq "ARRAY";
|
||||
|
||||
my $time = sprintf ("%.2d:%.2d:%.2d", $hour, $min, $sec);
|
||||
|
||||
#
|
||||
# Check time slots
|
||||
#
|
||||
my $inSlot = 0;
|
||||
foreach my $timeBlock (@{$schedule->{$DayNames[$wday]}}) {
|
||||
if ($timeBlock->{'start'} eq $timeBlock->{'end'}) {
|
||||
# All day.
|
||||
$inSlot = 1;
|
||||
} elsif ($timeBlock->{'start'} le $time && $timeBlock->{'end'} ge $time) {
|
||||
# In range.
|
||||
$inSlot = 1;
|
||||
}
|
||||
my $schedule;
|
||||
if (defined($alert->{'schedule'}) && $alert->{'schedule'} ne '') {
|
||||
$schedule = PandoraFMS::Tools::p_decode_json($pa_config, $alert->{'schedule'});
|
||||
}
|
||||
|
||||
return $status if $inSlot eq 0;
|
||||
if (defined($schedule)) {
|
||||
# New behaviour.
|
||||
return $status unless defined($schedule) && ref $schedule eq "HASH";
|
||||
|
||||
return $status unless defined($schedule->{$DayNames[$wday]});
|
||||
|
||||
return $status unless ref($schedule->{$DayNames[$wday]}) eq "ARRAY";
|
||||
|
||||
my $time = sprintf ("%.2d:%.2d:%.2d", $hour, $min, $sec);
|
||||
|
||||
#
|
||||
# Check time slots
|
||||
#
|
||||
my $inSlot = 0;
|
||||
foreach my $timeBlock (@{$schedule->{$DayNames[$wday]}}) {
|
||||
if ($timeBlock->{'start'} eq $timeBlock->{'end'}) {
|
||||
# All day.
|
||||
$inSlot = 1;
|
||||
} elsif ($timeBlock->{'start'} le $time && $timeBlock->{'end'} ge $time) {
|
||||
# In range.
|
||||
$inSlot = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $status if $inSlot eq 0;
|
||||
} else {
|
||||
# Old behaviour.
|
||||
# Check time slot
|
||||
my $time = sprintf ("%.2d:%.2d:%.2d", $hour, $min, $sec);
|
||||
if (($alert->{'time_from'} ne $alert->{'time_to'})) {
|
||||
if ($alert->{'time_from'} lt $alert->{'time_to'}) {
|
||||
return $status if (($time le $alert->{'time_from'}) || ($time ge $alert->{'time_to'}));
|
||||
} else {
|
||||
return $status if (($time le $alert->{'time_from'}) && ($time ge $alert->{'time_to'}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Check time threshold
|
||||
my $limit_utimestamp = $alert->{'last_reference'} + $alert->{'time_threshold'};
|
||||
@ -776,10 +793,12 @@ sub pandora_process_alert ($$$$$$$$;$$) {
|
||||
db_do($dbh, 'UPDATE talert_template_module_actions SET last_execution = 0 WHERE id_alert_template_module = ?', $id);
|
||||
}
|
||||
|
||||
if ($pa_config->{'alertserver'} == 1 && defined ($alert->{'id_template_module'})) {
|
||||
pandora_queue_alert($pa_config, $dbh, $data, $alert, 0, $extra_macros);
|
||||
if ($pa_config->{'alertserver'} == 1) {
|
||||
pandora_queue_alert($pa_config, $dbh, [$data, $agent, $module,
|
||||
$alert, 0, $timestamp, 0, $extra_macros, $is_correlated_alert]);
|
||||
} else {
|
||||
pandora_execute_alert ($pa_config, $data, $agent, $module, $alert, 0, $dbh, $timestamp, 0, $extra_macros, $is_correlated_alert);
|
||||
pandora_execute_alert ($pa_config, $data, $agent, $module, $alert, 0, $dbh,
|
||||
$timestamp, 0, $extra_macros, $is_correlated_alert);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -820,8 +839,9 @@ sub pandora_process_alert ($$$$$$$$;$$) {
|
||||
last_fired = ?, internal_counter = ? ' . $new_interval . ' WHERE id = ?',
|
||||
$alert->{'times_fired'}, $utimestamp, $alert->{'internal_counter'}, $id);
|
||||
|
||||
if ($pa_config->{'alertserver'} == 1 && defined ($alert->{'id_template_module'})) {
|
||||
pandora_queue_alert($pa_config, $dbh, $data, $alert, 1, $extra_macros);
|
||||
if ($pa_config->{'alertserver'} == 1) {
|
||||
pandora_queue_alert($pa_config, $dbh, [$data, $agent, $module,
|
||||
$alert, 1, $timestamp, 0, $extra_macros, $is_correlated_alert]);
|
||||
} else {
|
||||
pandora_execute_alert ($pa_config, $data, $agent, $module, $alert, 1,
|
||||
$dbh, $timestamp, 0, $extra_macros, $is_correlated_alert);
|
||||
@ -837,7 +857,7 @@ Execute the given alert.
|
||||
|
||||
=cut
|
||||
##########################################################################
|
||||
sub pandora_execute_alert ($$$$$$$$$;$$) {
|
||||
sub pandora_execute_alert {
|
||||
my ($pa_config, $data, $agent, $module,
|
||||
$alert, $alert_mode, $dbh, $timestamp, $forced_alert,
|
||||
$extra_macros, $is_correlated_alert) = @_;
|
||||
@ -1081,17 +1101,15 @@ Queue the given alert for execution.
|
||||
|
||||
=cut
|
||||
##########################################################################
|
||||
sub pandora_queue_alert ($$$$$;$) {
|
||||
my ($pa_config, $dbh, $data, $alert, $alert_mode, $extra_macros) = @_;
|
||||
my $json_macros = '{}';
|
||||
sub pandora_queue_alert ($$$) {
|
||||
my ($pa_config, $dbh, $arguments) = @_;
|
||||
|
||||
eval {
|
||||
local $SIG{__DIE__};
|
||||
$json_macros = encode_json($extra_macros);
|
||||
};
|
||||
my $json_arguments = PandoraFMS::Tools::p_encode_json($pa_config, $arguments);
|
||||
|
||||
db_do ($dbh, "INSERT INTO talert_execution_queue (id_alert_template_module, data, alert_mode, extra_macros, utimestamp)
|
||||
VALUES (?, ?, ?, ?, ?)", $alert->{'id_template_module'}, $data, $alert_mode, $json_macros, time());
|
||||
$json_arguments = encode_base64($json_arguments);
|
||||
|
||||
db_do ($dbh, "INSERT INTO talert_execution_queue (data, utimestamp)
|
||||
VALUES (?, ?)", $json_arguments, time());
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
@ -5522,6 +5540,9 @@ sub pandora_process_policy_queue ($) {
|
||||
next;
|
||||
}
|
||||
|
||||
# Refresh policy agents.
|
||||
enterprise_hook('pandora_apply_policy_groups', [$pa_config, $dbh]);
|
||||
|
||||
my $operation = enterprise_hook('get_first_policy_queue', [$dbh]);
|
||||
next unless (defined ($operation) && $operation ne '');
|
||||
|
||||
|
@ -22,7 +22,7 @@ use warnings;
|
||||
use DBI;
|
||||
use Carp qw/croak/;
|
||||
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
use PandoraFMS::Tools;
|
||||
|
||||
#use Data::Dumper;
|
||||
@ -555,6 +555,7 @@ sub get_agentmodule_status_str($$$) {
|
||||
FROM tagente_estado
|
||||
WHERE id_agente_modulo = ?', $agent_module_id);
|
||||
|
||||
return 'N/A' unless defined($status);
|
||||
return 'Normal' if ($status == 0);
|
||||
return 'Critical' if ($status == 1);
|
||||
return 'Warning' if ($status == 2);
|
||||
|
@ -41,7 +41,7 @@ use Encode::Locale ();
|
||||
use LWP::Simple;
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
@ -33,7 +33,7 @@ use File::Basename qw(dirname);
|
||||
use File::Copy;
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
@ -53,7 +53,7 @@ use warnings;
|
||||
use Geo::IP;
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::DB;
|
||||
use PandoraFMS::Tools;
|
||||
|
@ -30,7 +30,7 @@ use HTML::Entities;
|
||||
use POSIX qw(strftime);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
@ -11,7 +11,7 @@ use warnings;
|
||||
use File::Copy;
|
||||
use File::Basename qw(dirname basename);
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
use PandoraFMS::PluginTools qw/init read_configuration read_file empty trim/;
|
||||
|
||||
my $YAML = 0;
|
||||
@ -25,7 +25,7 @@ if ($@) {
|
||||
$YAML = 1;
|
||||
}
|
||||
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
our @ISA = ("Exporter");
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw( ) ] );
|
||||
|
@ -30,7 +30,7 @@ use JSON qw(decode_json);
|
||||
use Encode qw(encode_utf8 decode_utf8);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.760";
|
||||
my $pandora_build = "220221";
|
||||
my $pandora_build = "220307";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -29,7 +29,7 @@ use Net::Ping;
|
||||
use POSIX qw(floor strftime);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
@ -26,7 +26,7 @@ use Thread::Semaphore;
|
||||
use Time::HiRes qw(usleep);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::DB;
|
||||
use PandoraFMS::Core;
|
||||
|
@ -12,7 +12,7 @@ use IO::Socket::INET;
|
||||
use POSIX qw/ceil/;
|
||||
use Socket qw/inet_aton/;
|
||||
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::Recon::NmapParser;
|
||||
use PandoraFMS::Recon::Util;
|
||||
|
@ -7,7 +7,7 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
# Default lib dir for RPM and DEB packages.
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use Socket qw/inet_aton/;
|
||||
|
||||
|
@ -31,7 +31,7 @@ use XML::Simple;
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
@ -25,7 +25,7 @@ use threads;
|
||||
use threads::shared;
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::DB;
|
||||
use PandoraFMS::Core;
|
||||
|
@ -34,7 +34,7 @@ use threads::shared;
|
||||
use JSON;
|
||||
use Encode qw/decode_utf8 encode_utf8/;
|
||||
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
use PandoraFMS::Sendmail;
|
||||
|
||||
# New in 3.2. Used to sendmail internally, without external scripts
|
||||
@ -126,6 +126,7 @@ our @EXPORT = qw(
|
||||
is_offline
|
||||
is_empty
|
||||
is_in_array
|
||||
array_diff
|
||||
add_hashes
|
||||
to_number
|
||||
clean_blank
|
||||
@ -868,6 +869,19 @@ sub is_in_array {
|
||||
return 0;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Check if a value is in an array
|
||||
################################################################################
|
||||
sub array_diff($$) {
|
||||
my ($a, $b) = @_;
|
||||
|
||||
my %diff;
|
||||
@diff{ @{$a} } = @{$a};
|
||||
delete @diff{ @{$b} };
|
||||
|
||||
return keys %diff;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Mix hashses
|
||||
################################################################################
|
||||
@ -1130,9 +1144,9 @@ sub enterprise_hook ($$) {
|
||||
my $output = eval { &$func (@args); };
|
||||
|
||||
# Discomment to debug.
|
||||
if ($@) {
|
||||
print STDERR $@;
|
||||
}
|
||||
#if ($@) {
|
||||
# print STDERR $@;
|
||||
#}
|
||||
|
||||
# Check for errors
|
||||
#return undef if ($@);
|
||||
@ -2640,7 +2654,7 @@ sub p_encode_json {
|
||||
};
|
||||
if ($@){
|
||||
if (defined($data)) {
|
||||
logger($pa_config, 'Failed to encode data: '.$@, 5);
|
||||
logger($pa_config, 'Failed to encode data: '.$@, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ use POSIX qw(strftime);
|
||||
use HTML::Entities;
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.760
|
||||
%define release 220221
|
||||
%define release 220307
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.760
|
||||
%define release 220221
|
||||
%define release 220307
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -9,7 +9,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.760"
|
||||
PI_BUILD="220221"
|
||||
PI_BUILD="220307"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
@ -26,7 +26,7 @@ use POSIX qw(strftime);
|
||||
use Time::HiRes qw(usleep);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Core;
|
||||
use PandoraFMS::Config;
|
||||
|
@ -13,7 +13,7 @@ use Sys::Hostname;
|
||||
use POSIX qw(strftime);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
|
||||
|
@ -31,7 +31,7 @@ use POSIX qw(strftime);
|
||||
use Time::HiRes qw( clock_gettime clock ) ;
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
@ -27,7 +27,7 @@ use File::Path qw(rmtree);
|
||||
use Time::HiRes qw(usleep);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Core;
|
||||
use PandoraFMS::Tools;
|
||||
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
||||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.760 Build 220221";
|
||||
my $version = "7.0NG.760 Build 220307";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
@ -1032,11 +1032,61 @@ sub pandora_delete_old_session_data {
|
||||
db_do ($dbh, "DELETE FROM tsessions_php WHERE data IS NULL OR id_session REGEXP '^cron-'");
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Delete old data from the history database.
|
||||
###############################################################################
|
||||
sub pandoradb_history ($$) {
|
||||
my ($conf, $dbh) = @_;
|
||||
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime());
|
||||
my $ulimit_access_timestamp = time() - 86400;
|
||||
my $ulimit_timestamp = time() - (86400 * $conf->{'_days_purge'});
|
||||
|
||||
log_message ('', "Starting at ". strftime ("%Y-%m-%d %H:%M:%S", localtime()) . "\n");
|
||||
|
||||
# Delete old numeric data.
|
||||
if ($conf->{'_days_purge'} > 0) {
|
||||
pandora_delete_old_module_data ($dbh, 'tagente_datos', $ulimit_access_timestamp, $ulimit_timestamp);
|
||||
} else {
|
||||
log_message ('PURGE', 'days_purge is set to 0. Old data will not be deleted.');
|
||||
}
|
||||
|
||||
# Delete old string data.
|
||||
$conf->{'_string_purge'} = 7 unless defined($conf->{'_string_purge'});
|
||||
if ($conf->{'_string_purge'} > 0) {
|
||||
$ulimit_access_timestamp = time() - 86400;
|
||||
$ulimit_timestamp = time() - (86400 * $conf->{'_string_purge'});
|
||||
pandora_delete_old_module_data ($dbh, 'tagente_datos_string', $ulimit_access_timestamp, $ulimit_timestamp);
|
||||
} else {
|
||||
log_message ('PURGE', 'string_purge is set to 0. Old string data will not be deleted.');
|
||||
}
|
||||
|
||||
# Delete old events.
|
||||
if ($conf->{'_event_purge'} > 0) {
|
||||
log_message ('PURGE', "Deleting events older than " . $conf->{'_event_purge'} . " days from tevento.", '');
|
||||
|
||||
my $event_limit = time() - 86400 * $conf->{'_event_purge'};
|
||||
my $events_to_delete = get_db_value ($dbh, "SELECT COUNT(*) FROM tevento WHERE utimestamp < ?", $event_limit);
|
||||
while($events_to_delete > 0) {
|
||||
db_delete_limit($dbh, 'tevento', "utimestamp < ?", $BIG_OPERATION_STEP, $event_limit);
|
||||
$events_to_delete = $events_to_delete - $BIG_OPERATION_STEP;
|
||||
|
||||
# Mark the progress.
|
||||
log_message ('', ".");
|
||||
|
||||
# Do not overload the MySQL server.
|
||||
usleep (10000);
|
||||
}
|
||||
log_message ('', "\n");
|
||||
}
|
||||
|
||||
log_message ('', "Ending at ". strftime ("%Y-%m-%d %H:%M:%S", localtime()) . "\n");
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Main
|
||||
###############################################################################
|
||||
sub pandoradb_main ($$$;$) {
|
||||
my ($conf, $dbh, $history_dbh, $running_in_history) = @_;
|
||||
my ($conf, $dbh, $history_dbh) = @_;
|
||||
|
||||
log_message ('', "Starting at ". strftime ("%Y-%m-%d %H:%M:%S", localtime()) . "\n");
|
||||
|
||||
@ -1059,8 +1109,7 @@ sub pandoradb_main ($$$;$) {
|
||||
|
||||
# Only active database should be compacted. Disabled for historical database.
|
||||
# Compact on if enable and DaysCompact are below DaysPurge
|
||||
if (!$running_in_history
|
||||
&& ($conf->{'_onlypurge'} == 0)
|
||||
if (($conf->{'_onlypurge'} == 0)
|
||||
&& ($conf->{'_days_compact'} < $conf->{'_days_purge'})
|
||||
) {
|
||||
pandora_compactdb ($conf, defined ($history_dbh) ? $history_dbh : $dbh, $dbh);
|
||||
@ -1181,13 +1230,8 @@ if (defined($history_dbh)) {
|
||||
# Keep base settings.
|
||||
$h_conf->{'_onlypurge'} = $conf{'_onlypurge'};
|
||||
|
||||
# Re-launch maintenance process for historical database.
|
||||
pandoradb_main(
|
||||
$h_conf,
|
||||
$history_dbh,
|
||||
undef,
|
||||
1 # Disable certain funcionality while runningn in historical database.
|
||||
);
|
||||
# Launch maintenance process for historical database.
|
||||
pandoradb_history($h_conf, $history_dbh);
|
||||
|
||||
# Handle partitions.
|
||||
enterprise_hook('handle_partitions', [$h_conf, $history_dbh]);
|
||||
|
@ -35,7 +35,7 @@ use Math::Trig; # Math functions
|
||||
use Time::HiRes qw ( clock_gettime CLOCK_REALTIME);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
# Pandora Modules
|
||||
use PandoraFMS::Config;
|
||||
|
@ -24,7 +24,7 @@ use LWP::Simple;
|
||||
use Data::Dumper;
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
@ -36,7 +36,7 @@ use Encode::Locale;
|
||||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.760 Build 220221";
|
||||
my $version = "7.0NG.760 Build 220307";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
@ -13,7 +13,7 @@ use JSON;
|
||||
use IO::Socket::INET;
|
||||
use File::Copy;
|
||||
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Config;
|
||||
use PandoraFMS::Tools;
|
||||
|
@ -18,7 +18,7 @@ use Data::Dumper;
|
||||
use JSON qw(encode_json);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
@ -18,7 +18,7 @@ use Data::Dumper;
|
||||
use JSON qw(encode_json);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
@ -10,7 +10,7 @@ use POSIX qw (strftime floor);
|
||||
use Sys::Hostname;
|
||||
use Time::HiRes qw(gettimeofday tv_interval);
|
||||
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
# Pandora Modules.
|
||||
use PandoraFMS::Config;
|
||||
|
@ -16,7 +16,7 @@ use POSIX;
|
||||
use HTML::Entities; # Encode or decode strings with HTML entities
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
@ -14,7 +14,7 @@ use strict;
|
||||
use LWP::Simple;
|
||||
use LWP::UserAgent;
|
||||
use MIME::Base64;
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
use PandoraFMS::Tools;
|
||||
|
||||
# Init
|
||||
|
@ -81,7 +81,7 @@ function pidof_pandora () {
|
||||
# in a "strech" term, ps aux don't report more than COLUMNS
|
||||
# characters and this will not work.
|
||||
COLUMNS=300
|
||||
PANDORA_PID=`ps aux | grep "$PANDORA_DAEMON $PANDORA_HOME" | grep -v grep | tail -1 | awk '{ print $2 }'`
|
||||
PANDORA_PID=`ps aux | grep "$PANDORA_DAEMON" | grep "$PANDORA_HOME" | grep -v grep | tail -1 | awk '{ print $2 }'`
|
||||
echo $PANDORA_PID
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ function pidof_pandora_ha () {
|
||||
# in a "strech" term, ps aux don't report more than COLUMNS
|
||||
# characters and this will not work.
|
||||
COLUMNS=300
|
||||
PANDORA_PID=`ps aux | grep "$PANDORA_HA -d -p $PID_DIR/pandora_ha.pid $PANDORA_HOME" | grep -v grep | tail -1 | awk '{ print $2 }'`
|
||||
PANDORA_PID=`ps aux | grep "$PANDORA_HA" | grep "$PANDORA_HOME" | grep -v grep | tail -1 | awk '{ print $2 }'`
|
||||
echo $PANDORA_PID
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ use warnings;
|
||||
|
||||
use Net::SMPP;
|
||||
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
use PandoraFMS::PluginTools qw(read_configuration);
|
||||
|
||||
my $HELP =<<EO_H;
|
||||
|
@ -16,7 +16,7 @@ use POSIX;
|
||||
use HTML::Entities; # Encode or decode strings with HTML entities
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
@ -21,7 +21,7 @@ use warnings;
|
||||
|
||||
use POSIX qw(strftime);
|
||||
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
use PandoraFMS::PluginTools;
|
||||
|
||||
use Data::Dumper;
|
||||
|
@ -12,7 +12,7 @@ use NetAddr::IP;
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
@ -6,7 +6,7 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use POSIX qw/strftime/;
|
||||
use Socket qw/inet_aton/;
|
||||
|
@ -9,7 +9,7 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
Loading…
x
Reference in New Issue
Block a user