Merge branch 'develop' into ent-6231-Fallo-discovery-la-recon-no-genera-los-agentes-cuando-se-selecciona-una-module-template

This commit is contained in:
alejandro-campos 2020-08-27 12:09:59 +02:00
commit c5268c152a
58 changed files with 436 additions and 134 deletions

View File

@ -17,7 +17,7 @@ Installing Pandora FMS is a very easy task. Please visit our wiki and follow all
Pandora FMS is a monitoring application to watch systems and applications that allows to know the status of any element of the business systems. Pandora FMS watches your hardware, software, your multilayer system and, of course, your OS. Pandora FMS can detect if a network interface is down or the movement of any NASDAQ new technology market value. If you wish, Pandora FMS can send a SMS message when your system or your application fails or when Google stock value drops below 330 US$. Pandora FMS will fit your systems and requirements, because it has been designed to be open, modular, multiplattform and easy to customize. Pandora FMS is a monitoring application to watch systems and applications that allows to know the status of any element of the business systems. Pandora FMS watches your hardware, software, your multilayer system and, of course, your OS. Pandora FMS can detect if a network interface is down or the movement of any NASDAQ new technology market value. If you wish, Pandora FMS can send a SMS message when your system or your application fails or when Google stock value drops below 330 US$. Pandora FMS will fit your systems and requirements, because it has been designed to be open, modular, multiplattform and easy to customize.
### Other things Pandora FMS can do ### Other things Pandora FMS can do
Pandora FMS is a monitoring tool that not only measures if a parameter is right or wrong. Pandora FMS can quantify the state (right or wrong), or store a value (numeric or alphanumeric) for months if necessary. Pandora FMS can measure performances, compare values among different systems and set alarms over thresholds. Pandora FMS works against a Database so it can generate reports, statistics, SLA and meausre anything: OS, applications and hardware systems, such as firewalls, proxies, Databases, web servers, VPN, routers, switches, processes, services, remote accesses to servers, etc. Everything integrated in an open and distributed architecture. Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks. Pandora FMS is a monitoring tool that not only measures if a parameter is right or wrong. Pandora FMS can quantify the state (right or wrong), or store a value (numeric or alphanumeric) for months if necessary. Pandora FMS can measure performances, compare values among different systems and set alarms over thresholds. Pandora FMS works against a Database so it can generate reports, statistics, SLA and meausre anything: OS, applications and hardware systems, such as firewalls, proxies, Databases, web servers, VPN, routers, switches, processes, services, [remote accesses to servers](https://pandorafms.com/server-monitoring/), etc. Everything integrated in an open and distributed architecture. Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks.
### Main features ### Main features
* Network monitoring * Network monitoring

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.748-200810 Version: 7.0NG.748-200827
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -55,7 +55,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.748'; use constant AGENT_VERSION => '7.0NG.748';
use constant AGENT_BUILD => '200810'; use constant AGENT_BUILD => '200827';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -1678,7 +1678,7 @@ sub execute_command_timeout {
}; };
my $result = ($?>>8); my $result = ($?>>8);
print $result; return $result;
# Exit child. # Exit child.
# Child finishes. # Child finishes.
@ -1753,7 +1753,7 @@ sub execute_command_block {
); );
# Do not retry if success. # Do not retry if success.
last if looks_like_number($err_level) && $err_level == 0; $retries = 0 if looks_like_number($err_level) && $err_level == 0;
} while ((--$retries) > 0); } while ((--$retries) > 0);

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.748 %define version 7.0NG.748
%define release 200810 %define release 200827
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}
@ -21,10 +21,10 @@ BuildArch: noarch
Requires(pre): shadow-utils Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: fileutils textutils unzip Requires: coreutils unzip
Requires: util-linux procps grep Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk Requires: /sbin/ip /bin/awk
Requires: perl perl(Sys::Syslog) perl(IO::Compress::Zip) perl(YAML::Tiny) Requires: perl perl(Sys::Syslog) perl(IO::Compress::Zip)
# Required by plugins # Required by plugins
#Requires: sh-utils sed passwd net-tools rpm #Requires: sh-utils sed passwd net-tools rpm
AutoReq: 0 AutoReq: 0

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.748 %define version 7.0NG.748
%define release 200810 %define release 200827
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}
@ -20,7 +20,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: noarch BuildArch: noarch
#PreReq: %fillup_prereq %insserv_prereq /usr/bin/sed /usr/bin/grep /usr/sbin/useradd #PreReq: %fillup_prereq %insserv_prereq /usr/bin/sed /usr/bin/grep /usr/sbin/useradd
Requires(pre,preun):/usr/bin/sed /usr/bin/grep /usr/sbin/useradd Requires(pre,preun):/usr/bin/sed /usr/bin/grep /usr/sbin/useradd
Requires: coreutils unzip perl perl(Sys::Syslog) perl(IO::Compress::Zip) perl(YAML::Tiny) Requires: coreutils unzip perl perl(Sys::Syslog) perl(IO::Compress::Zip)
AutoReq: 0 AutoReq: 0
Provides: %{name}-%{version} Provides: %{name}-%{version}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.748" PI_VERSION="7.0NG.748"
PI_BUILD="200810" PI_BUILD="200827"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -56,6 +56,8 @@ my $Reg_exp = '';
# Flag to show or not summary module # Flag to show or not summary module
my $summary_flag = 0; my $summary_flag = 0;
my $nodatalist_flag = 0;
# Number of coincidences found # Number of coincidences found
my $coincidences = 0; my $coincidences = 0;
@ -120,7 +122,15 @@ sub error_msg ($) {
# Print a help message. # Print a help message.
############################################################################### ###############################################################################
sub print_help () { sub print_help () {
print "Usage: $0 <log_file> <module_name> <pattern> <up_lines_extra> <bot_lines_extra> [--summary]\n"; print "Usage: $0 <log_file> <module_name> <pattern> <up_lines_extra> <bot_lines_extra> [--summary] [--nodatalist]\n\n";
print "Options:\n";
print "\t<log_file>\t\tPath to the log file to be monitored\n";
print "\t<module_name>\t\tName of the module that will be created\n";
print "\t<pattern>\t\tRegex string to be matched in log file\n";
print "\t<up_lines_extra>\tShows NUM lines before matching lines to provide context\n";
print "\t<bot_lines_extra>\tShows NUM lines after matching lines to provide context\n";
print "\t--summary\t\tCreates a module with the total number of matches\n";
print "\t--nodatalist\t\tInserts all coincidences in a single data output instead of a data per line\n";
} }
############################################################################### ###############################################################################
@ -317,6 +327,7 @@ sub print_log ($) {
if ($#kdata < 0) { if ($#kdata < 0) {
print_summary() if ($summary_flag == 1); print_summary() if ($summary_flag == 1);
return; return;
} }
# Log module # Log module
@ -341,6 +352,18 @@ sub print_log ($) {
$output = "<module>\n"; $output = "<module>\n";
$output .= "<name><![CDATA[" . $Module_name . "]]></name>\n"; $output .= "<name><![CDATA[" . $Module_name . "]]></name>\n";
$output .= "<type><![CDATA[async_string]]></type>\n"; $output .= "<type><![CDATA[async_string]]></type>\n";
if ($nodatalist_flag == 1){
$output .= "<data><![CDATA[";
foreach my $line (@kdata) {
foreach my $content (@{$data->{$line}}) {
my $processed_line = $content;
$processed_line =~ "\n";
$output .= $processed_line;
}
}
$output .= "]]></data>\n";
}
else {
$output .= "<datalist>\n"; $output .= "<datalist>\n";
foreach my $line (@kdata) { foreach my $line (@kdata) {
$output .= "<data><value><![CDATA["; $output .= "<data><value><![CDATA[";
@ -352,10 +375,12 @@ sub print_log ($) {
$output .= "]]></value></data>\n"; $output .= "]]></value></data>\n";
} }
$output .= "</datalist>\n"; $output .= "</datalist>\n";
}
$output .= "</module>\n"; $output .= "</module>\n";
print stdout $output; print stdout $output;
} }
} }
############################################################################### ###############################################################################
@ -376,12 +401,18 @@ $Reg_exp = trim($ARGV[2]);
my $up_lines = trim($ARGV[3]); my $up_lines = trim($ARGV[3]);
my $bot_lines = trim($ARGV[4]); my $bot_lines = trim($ARGV[4]);
my $sum_flag = trim($ARGV[5]); my $sum_flag = trim($ARGV[5]);
my $nodatalist = trim($ARGV[6]);
if ( ( defined($up_lines) && ($up_lines eq "--summary")) if ( grep { /--summary/ } @ARGV )
|| ( defined($bot_lines) && ($bot_lines eq "--summary")) {
|| ( defined($sum_flag) && ($sum_flag eq "--summary")) ) { $summary_flag = 1;
$summary_flag = 1;
} }
if ( grep { /--nodatalist/ } @ARGV )
{
$nodatalist_flag = 1;
}
# Create index file storage directory # Create index file storage directory
if ( ! -d $Idx_dir) { if ( ! -d $Idx_dir) {
mkdir($Idx_dir) || error_msg("Error creating directory $Idx_dir: " mkdir($Idx_dir) || error_msg("Error creating directory $Idx_dir: "

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{200810} {200827}
ViewReadme ViewReadme
{Yes} {Yes}

View File

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

View File

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

View File

@ -5,4 +5,3 @@ Options -Indexes
Order Allow,Deny Order Allow,Deny
Deny from All Deny from All
</Files> </Files>

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.748-200810 Version: 7.0NG.748-200827
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -7,5 +7,3 @@
Deny from all Deny from all
Allow from localhost Allow from localhost
</FilesMatch> </FilesMatch>
php_flag engine off

View File

@ -0,0 +1,9 @@
START TRANSACTION;
ALTER TABLE `talert_templates` ADD COLUMN `previous_name` text;
ALTER TABLE `talert_actions` ADD COLUMN `previous_name` text;
ALTER TABLE `talert_commands` ADD COLUMN `previous_name` text;
ALTER TABLE `ttag` ADD COLUMN `previous_name` text NULL;
ALTER TABLE `tconfig_os` ADD COLUMN `previous_name` text NULL;
COMMIT;

View File

@ -1312,6 +1312,8 @@ ALTER TABLE talert_actions ADD COLUMN `field12_recovery` TEXT NOT NULL DEFAULT "
ALTER TABLE talert_actions ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_actions ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_actions ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_actions` ADD COLUMN `previous_name` text;
ALTER TABLE `talert_actions` MODIFY COLUMN `field11` text NOT NULL, ALTER TABLE `talert_actions` MODIFY COLUMN `field11` text NOT NULL,
MODIFY COLUMN `field12` text NOT NULL, MODIFY COLUMN `field12` text NOT NULL,
MODIFY COLUMN `field13` text NOT NULL, MODIFY COLUMN `field13` text NOT NULL,
@ -1325,6 +1327,7 @@ UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria&#x20;IMS&#x20;
UPDATE `talert_commands` SET `description` = 'This&#x20;alert&#x20;send&#x20;an&#x20;email&#x20;using&#x20;internal&#x20;Pandora&#x20;FMS&#x20;Server&#x20;SMTP&#x20;capabilities&#x20;&#40;defined&#x20;in&#x20;each&#x20;server,&#x20;using:&#x0d;&#x0a;_field1_&#x20;as&#x20;destination&#x20;email&#x20;address,&#x20;and&#x0d;&#x0a;_field2_&#x20;as&#x20;subject&#x20;for&#x20;message.&#x20;&#x0d;&#x0a;_field3_&#x20;as&#x20;text&#x20;of&#x20;message.&#x20;&#x0d;&#x0a;_field4_&#x20;as&#x20;content&#x20;type&#x20;&#40;text/plain&#x20;or&#x20;html/text&#41;.', `fields_descriptions` = '[\"Destination&#x20;address\",\"Subject\",\"Text\",\"Content&#x20;Type\",\"\",\"\",\"\",\"\",\"\",\"\"]', `fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id=1; UPDATE `talert_commands` SET `description` = 'This&#x20;alert&#x20;send&#x20;an&#x20;email&#x20;using&#x20;internal&#x20;Pandora&#x20;FMS&#x20;Server&#x20;SMTP&#x20;capabilities&#x20;&#40;defined&#x20;in&#x20;each&#x20;server,&#x20;using:&#x0d;&#x0a;_field1_&#x20;as&#x20;destination&#x20;email&#x20;address,&#x20;and&#x0d;&#x0a;_field2_&#x20;as&#x20;subject&#x20;for&#x20;message.&#x20;&#x0d;&#x0a;_field3_&#x20;as&#x20;text&#x20;of&#x20;message.&#x20;&#x0d;&#x0a;_field4_&#x20;as&#x20;content&#x20;type&#x20;&#40;text/plain&#x20;or&#x20;html/text&#41;.', `fields_descriptions` = '[\"Destination&#x20;address\",\"Subject\",\"Text\",\"Content&#x20;Type\",\"\",\"\",\"\",\"\",\"\",\"\"]', `fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id=1;
ALTER TABLE `talert_commands` ADD COLUMN `id_group` mediumint(8) unsigned NULL default 0; ALTER TABLE `talert_commands` ADD COLUMN `id_group` mediumint(8) unsigned NULL default 0;
ALTER TABLE `talert_commands` ADD COLUMN `fields_hidden` text; ALTER TABLE `talert_commands` ADD COLUMN `fields_hidden` text;
ALTER TABLE `talert_commands` ADD COLUMN `previous_name` text;
UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1; UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1;
@ -1337,6 +1340,11 @@ ALTER TABLE `talert_commands` MODIFY COLUMN `id_group` mediumint(8) unsigned NUL
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE `tmap` MODIFY COLUMN `id_user` varchar(250) NOT NULL DEFAULT ''; ALTER TABLE `tmap` MODIFY COLUMN `id_user` varchar(250) NOT NULL DEFAULT '';
-- ---------------------------------------------------------------------
-- Table `ttag`
-- ---------------------------------------------------------------------
ALTER TABLE `ttag` ADD COLUMN `previous_name` text NULL;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tconfig` -- Table `tconfig`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1381,7 +1389,9 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_content', '');
-- Table `tconfig_os` -- Table `tconfig_os`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`) VALUES (100, 'Cluster', 'Cluster agent', 'so_cluster.png'); ALTER TABLE `tconfig_os` ADD COLUMN `previous_name` text NULL;
INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`) VALUES (100, 'Cluster', 'Cluster agent', 'so_cluster.png', '');
UPDATE `tagente` SET `id_os` = 100 WHERE `id_os` = 21 and (select `id_os` from `tconfig_os` WHERE `id_os` = 21 and `name` = 'Cluster'); UPDATE `tagente` SET `id_os` = 100 WHERE `id_os` = 21 and (select `id_os` from `tconfig_os` WHERE `id_os` = 21 and `name` = 'Cluster');
@ -2461,6 +2471,8 @@ INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES
-- Alter table `talert_templates` -- Alter table `talert_templates`
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
ALTER TABLE `talert_templates` ADD COLUMN `previous_name` text;
ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal'); ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal');
ALTER TABLE `talert_templates` MODIFY COLUMN `field11` text NOT NULL, ALTER TABLE `talert_templates` MODIFY COLUMN `field11` text NOT NULL,

View File

@ -291,8 +291,8 @@ if (is_ajax()) {
'field'.$i.'_value', 'field'.$i.'_value',
'', '',
'', '',
__('None'),
'', '',
0,
true, true,
false, false,
false, false,

View File

@ -362,6 +362,7 @@ $templates = alerts_get_alert_templates(
'description', 'description',
'type', 'type',
'id_group', 'id_group',
'previous_name',
] ]
); );
if ($templates === false) { if ($templates === false) {

View File

@ -83,6 +83,10 @@ if ($update_command) {
$values['command'] = $command; $values['command'] = $command;
$values['description'] = $description; $values['description'] = $description;
$values['id_group'] = $id_group; $values['id_group'] = $id_group;
// Only for Metaconsole. Save the previous name for synchronizing.
if (is_metaconsole()) {
$values['previous_name'] = db_get_value('name', 'talert_commands', 'id', $id);
}
// Check it the new name is used in the other command. // Check it the new name is used in the other command.
$id_check = db_get_value('id', 'talert_commands', 'name', $name); $id_check = db_get_value('id', 'talert_commands', 'name', $name);

View File

@ -34,6 +34,9 @@ if (! check_acl($config['id_user'], 0, 'LM')) {
$duplicate_template = (bool) get_parameter('duplicate_template'); $duplicate_template = (bool) get_parameter('duplicate_template');
$id = (int) get_parameter('id'); $id = (int) get_parameter('id');
$pure = get_parameter('pure', 0); $pure = get_parameter('pure', 0);
$step = (int) get_parameter('step', 1);
// We set here the number of steps.
define('LAST_STEP', 3);
// If user tries to duplicate/edit a template with group=ALL then must have "PM" access privileges // If user tries to duplicate/edit a template with group=ALL then must have "PM" access privileges
if ($duplicate_template) { if ($duplicate_template) {
@ -56,7 +59,6 @@ if ($a_template !== false) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
$step = (int) get_parameter('step', 1);
if ($step == 1) { if ($step == 1) {
$help_header = ''; $help_header = '';
} else if ($step == 2) { } else if ($step == 2) {
@ -113,7 +115,6 @@ if ($a_template !== false) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
$step = (int) get_parameter('step', 1);
if ($step == 1) { if ($step == 1) {
$help_header = ''; $help_header = '';
} else if ($step == 2) { } else if ($step == 2) {
@ -252,24 +253,20 @@ function update_template($step)
$wizard_level = (string) get_parameter('wizard_level'); $wizard_level = (string) get_parameter('wizard_level');
$priority = (int) get_parameter('priority'); $priority = (int) get_parameter('priority');
$id_group = get_parameter('id_group'); $id_group = get_parameter('id_group');
// Only for Metaconsole. Save the previous name for synchronizing.
switch ($config['dbtype']) { if (is_metaconsole()) {
case 'mysql': $previous_name = db_get_value('name', 'talert_templates', 'id', $id);
case 'postgresql': } else {
$name_check = db_get_value('name', 'talert_templates', 'name', $name); $previous_name = '';
break;
case 'oracle':
$name_check = db_get_value('name', 'talert_templates', 'to_char(name)', $name);
break;
} }
$values = [ $values = [
'name' => $name, 'name' => $name,
'description' => $description, 'description' => $description,
'id_group' => $id_group, 'id_group' => $id_group,
'priority' => $priority, 'priority' => $priority,
'wizard_level' => $wizard_level, 'wizard_level' => $wizard_level,
'previous_name' => $previous_name,
]; ];
$result = alerts_update_alert_template($id, $values); $result = alerts_update_alert_template($id, $values);

View File

@ -330,7 +330,7 @@ if ($create_component) {
if ($name && !$name_check) { if ($name && !$name_check) {
$id = network_components_create_network_component( $id = network_components_create_network_component(
$name, strip_tags(io_safe_input($name), '<br>'),
$type, $type,
$id_group, $id_group,
[ [
@ -431,7 +431,7 @@ if ($update_component) {
$id, $id,
[ [
'type' => $type, 'type' => $type,
'name' => $name, 'name' => strip_tags(io_safe_input($name, '<br>')),
'id_group' => $id_group, 'id_group' => $id_group,
'description' => $description, 'description' => $description,
'module_interval' => $module_interval, 'module_interval' => $module_interval,

View File

@ -111,7 +111,7 @@ if (isset($id)) {
$component = network_components_get_network_component((int) $id); $component = network_components_get_network_component((int) $id);
if ($component !== false) { if ($component !== false) {
$id_component_type = $component['id_modulo']; $id_component_type = $component['id_modulo'];
$name = $component['name']; $name = io_safe_output($component['name']);
$type = $component['type']; $type = $component['type'];
$description = $component['description']; $description = $component['description'];
$max = $component['max']; $max = $component['max'];

View File

@ -98,6 +98,10 @@ switch ($action) {
$values = []; $values = [];
$values['name'] = $name; $values['name'] = $name;
$values['description'] = $description; $values['description'] = $description;
// Only for Metaconsole. Save the previous name for synchronizing.
if (is_metaconsole()) {
$values['previous_name'] = db_get_value('name', 'tconfig_os', 'id_os', $idOS);
}
if (($icon !== 0) && ($icon != '')) { if (($icon !== 0) && ($icon != '')) {
$values['icon_name'] = $icon; $values['icon_name'] = $icon;

View File

@ -79,6 +79,10 @@ if ($update_tag && $id_tag != 0) {
$values['url'] = $url_tag; $values['url'] = $url_tag;
$values['email'] = $email_tag; $values['email'] = $email_tag;
$values['phone'] = $phone_tag; $values['phone'] = $phone_tag;
// Only for Metaconsole. Save the previous name for synchronizing.
if (is_metaconsole()) {
$values['previous_name'] = db_get_value('name', 'ttag', 'id_tag', $id_tag);
}
$result = false; $result = false;
if ($values['name'] != '') { if ($values['name'] != '') {

View File

@ -511,34 +511,38 @@ foreach ($info as $user_id => $user_info) {
$data[4] = ''; $data[4] = '';
if ($user_profiles !== false) { if ($user_profiles !== false) {
if (defined('METACONSOLE')) { $total_profile = 0;
$data[4] .= "<div width='100%'>";
foreach ($user_profiles as $row) { $data[4] .= '<div style="text-align: end;">';
foreach ($user_profiles as $row) {
if ($total_profile <= 5) {
$data[4] .= "<div style='float:left;'>"; $data[4] .= "<div style='float:left;'>";
$data[4] .= profile_get_name($row['id_perfil']); $data[4] .= profile_get_name($row['id_perfil']);
$data[4] .= ' / </div>'; $data[4] .= ' / </div>';
$data[4] .= "<div style='float:left; padding-left:5px;'>"; $data[4] .= "<div style='float:left; padding-left:5px;'>";
$data[4] .= groups_get_name($row['id_grupo'], true); $data[4] .= groups_get_name($row['id_grupo'], true);
$data[4] .= '</div>'; $data[4] .= '</div>';
if ($total_profile == 0 && count($user_profiles) >= 5) {
$data[4] .= '<span onclick="showGroups()" style="padding-left: 15px;">
'.html_print_image('images/input_zoom_gray.png', true, ['title' => __('Show')]).'</span>';
}
$data[4] .= '<br />'; $data[4] .= '<br />';
$data[4] .= '<br />'; $data[4] .= '<br />';
$data[4] .= '</div>';
} else {
$data[4] .= "<div id='groups_list' style='display:none;'>";
$data[4] .= '<div >';
$data[4] .= profile_get_name($row['id_perfil']);
$data[4] .= ' / '.groups_get_name($row['id_grupo'], true).'</div>';
$data[4] .= '<br/>';
} }
$total_profile++;
}
$data[4] .= '</div>'; $data[4] .= '</div>';
} else {
$data[4] .= "<table width='100%'>";
foreach ($user_profiles as $row) {
$data[4] .= '<tr>';
$data[4] .= '<td>';
$data[4] .= profile_get_name($row['id_perfil']);
$data[4] .= ' / ';
$data[4] .= groups_get_name($row['id_grupo'], true);
$data[4] .= '</td>';
$data[4] .= '</tr>';
}
$data[4] .= '</table>';
}
} else { } else {
$data[4] .= __('The user doesn\'t have any assigned profile/group'); $data[4] .= __('The user doesn\'t have any assigned profile/group');
} }
@ -588,3 +592,17 @@ if ($config['admin_can_add_user'] !== false) {
echo '</div>'; echo '</div>';
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
echo '<script type="text/javascript">
function showGroups(){
var groups_list = document.getElementById("groups_list");
if(groups_list.style.display == "none"){
document.querySelectorAll("[id=groups_list]").forEach(element=>
element.style.display = "block");
}else{
document.querySelectorAll("[id=groups_list]").forEach(element=>
element.style.display = "none");
};
}
</script>';

View File

@ -1,5 +1,4 @@
#pandora disable phpexec #pandora disable phpexec
<Files *.php> <FilesMatch "\.(php)$">
Deny from all Deny from all
</Files> </FilesMatch>
php_flag engine off

View File

@ -937,11 +937,16 @@ if ($perform_event_response) {
return; return;
} }
$target = get_parameter('target', '');
$response_id = get_parameter('response_id'); $response_id = get_parameter('response_id');
$event_id = (int) get_parameter('event_id'); $event_id = (int) get_parameter('event_id');
$server_id = (int) get_parameter('server_id', 0); $server_id = (int) get_parameter('server_id', 0);
$command = events_get_response_target($event_id, $response_id, $server_id); if (empty($target)) {
$command = events_get_response_target($event_id, $response_id, $server_id);
} else {
$command = $target;
}
$event_response = db_get_row('tevent_response', 'id', $response_id); $event_response = db_get_row('tevent_response', 'id', $response_id);
@ -1088,7 +1093,8 @@ if ($dialogue_event_response) {
} }
} else { } else {
echo "<div style='text-align:left'>"; echo "<div style='text-align:left'>";
echo $prompt.sprintf(__('Executing command: %s', $command));
echo $prompt."Executing command: $command";
echo '</div><br>'; echo '</div><br>';
echo "<div id='response_loading_command' style='display:none'>".html_print_image('images/spinner.gif', true).'</div>'; echo "<div id='response_loading_command' style='display:none'>".html_print_image('images/spinner.gif', true).'</div>';

View File

@ -3001,6 +3001,8 @@ class AgentWizard extends HTML
$module['name'] $module['name']
); );
$newModule['name_oid'] = str_replace('"', '', $tmpSecond[3]);
// Add this new module to the module list. // Add this new module to the module list.
$moduleBlocks[] = $newModule; $moduleBlocks[] = $newModule;
} }

View File

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

View File

@ -2780,6 +2780,11 @@ function alerts_ui_update_or_create_actions($update=true)
if ($update) { if ($update) {
$values['name'] = $name; $values['name'] = $name;
$values['id_alert_command'] = $id_alert_command; $values['id_alert_command'] = $id_alert_command;
// Only for Metaconsole, save the previous name for synchronization.
if (is_metaconsole()) {
$values['previous_name'] = db_get_value('name', 'talert_actions', 'id', $id);
}
$result = (!$name) ? '' : alerts_update_alert_action($id, $values); $result = (!$name) ? '' : alerts_update_alert_action($id, $values);
} else { } else {
$name_check = db_get_value('name', 'talert_actions', 'name', $name); $name_check = db_get_value('name', 'talert_actions', 'name', $name);

View File

@ -1861,13 +1861,13 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
foreach ($servers as $server) { foreach ($servers as $server) {
if (metaconsole_connect($server) == NOERR) { if (metaconsole_connect($server) == NOERR) {
if ($other['data'][0] === '1') { if ($other['data'][0] === '1') {
$idAgent[0] = agents_get_agent_id_by_alias($id); $idAgent = agents_get_agent_id_by_alias($id);
} else { } else {
$idAgent[0] = agents_get_agent_id($id, true); $idAgent[0] = agents_get_agent_id($id, true);
} }
if ($idAgent[0]) { if (!empty($idAgent)) {
$result = agents_delete_agent($idAgent, true); $result = agents_delete_agent($idAgent[0], true);
} }
metaconsole_restore_db(); metaconsole_restore_db();

View File

@ -728,7 +728,7 @@ function notifications_print_source_select_box(
" "
<div class='global-config-notification-single-selector'> <div class='global-config-notification-single-selector'>
<div> <div>
<h4>%s</h4> <h5>%s</h5>
%s %s
</div> </div>
<div class='global-notifications-icons'> <div class='global-notifications-icons'>

View File

@ -135,7 +135,7 @@ function show_response_dialog(response_id, response) {
params.push("dialogue_event_response=1"); params.push("dialogue_event_response=1");
params.push("massive=0"); params.push("massive=0");
params.push("event_id=" + response["event_id"]); params.push("event_id=" + response["event_id"]);
params.push("target=" + response["target"]); params.push("target=" + encodeURIComponent(response["target"]));
params.push("response_id=" + response_id); params.push("response_id=" + response_id);
params.push("server_id=" + response["server_id"]); params.push("server_id=" + response["server_id"]);
@ -363,8 +363,17 @@ function get_response_target(
if (response_params.length > 1 || response_params[0] != "") { if (response_params.length > 1 || response_params[0] != "") {
for (var i = 0; i < response_params.length; i++) { for (var i = 0; i < response_params.length; i++) {
if (!response_command) { if (!response_command) {
var response_param = "_" + response_params[i] + "_";
if (
response_params[i].startsWith("_") &&
response_params[i].endsWith("_")
) {
response_param = response_params[i];
}
target = target.replace( target = target.replace(
"_" + response_params[i] + "_", response_param,
$("#" + response_params[i]).val() $("#" + response_params[i]).val()
); );
} else { } else {
@ -388,7 +397,7 @@ function perform_response(response, response_id) {
var params = []; var params = [];
params.push("page=include/ajax/events"); params.push("page=include/ajax/events");
params.push("perform_event_response=1"); params.push("perform_event_response=1");
params.push("target=" + response["target"]); params.push("target=" + encodeURIComponent(response["target"]));
params.push("response_id=" + response_id); params.push("response_id=" + response_id);
params.push("event_id=" + response["event_id"]); params.push("event_id=" + response["event_id"]);
params.push("server_id=" + response["server_id"]); params.push("server_id=" + response["server_id"]);

View File

@ -1088,6 +1088,9 @@ if ($searchPage) {
} }
} else if ($sec == 'gextensions') { } else if ($sec == 'gextensions') {
$main_sec = get_parameter('extension_in_menu'); $main_sec = get_parameter('extension_in_menu');
if (empty($main_sec) === true) {
$main_sec = $sec;
}
} else { } else {
$main_sec = $sec; $main_sec = $sec;
} }

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.748'; $version = '7.0NG.748';
$build = '200810'; $build = '200827';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -0,0 +1,101 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
// Login check
check_login();
$agent_id = get_parameter_get('id_agente', 0);
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->cellpadding = '0';
$table->cellspacing = '0';
$table->head = [];
$table->align = [];
$table->head[0] = "<span title='".__('Source')."'>".__('Source').'</span>';
$table->head[1] = "<span title='".__('Review')."'>".__('Review').'</span>';
$table->head[2] = "<span title='".__('Last contact')."'>".__('Last contact').'</span>';
$table->style = [];
$table->style['source'] = 'width: 80%;';
$table->data = [];
$row = [];
// Get most recent sources for active agent.
$sql = "select source, MAX(utimestamp) AS last_contact from tagent_module_log where id_agent=$agent_id GROUP BY source";
$logs = mysql_db_get_all_rows_sql($sql);
foreach ($logs as $log) {
$row['source'] = $log['source'];
$row['review'] = '<a href="javascript:void(0)">'.html_print_image('images/zoom.png', true, ['title' => __('Review in log viewer'), 'alt' => '', 'onclick' => "send_form('".$log['source'].'-'.$agent_id."')"]).'</a>';
$row['last_contact'] = human_time_comparation($log['last_contact']);
$table->data[] = $row;
}
ob_start();
if (!empty($table->data)) {
echo '<div id="log_sources_status" style="width:100%;">';
html_print_table($table);
echo '</div>';
} else {
ui_print_info_message(['no_close' => true, 'message' => __('No log sources found') ]);
$log_sources_defined = false;
}
// Hidden form to perform post request to Log Viewer page when clicking on the Review field icon.
echo '<form method="POST" action="index.php?sec=estado&sec2=enterprise/operation/log/log_viewer" name="review_log_form" id="review_log_form" style="display: none;">';
html_print_input_hidden('agent_id', $agent_id, false);
html_print_input_hidden('source', null, false);
html_print_input_hidden('redirect_search', 1, false);
echo '</form>';
$html_content = ob_get_clean();
// Create controlled toggle content.
ui_toggle(
$html_content,
__('Log sources status'),
'log_sources_status',
!$log_sources_defined,
false,
'',
'white_table_graph_content no-padding-imp'
);
?>
<script type="text/javascript">
function send_form(source) {
var review_form = document.getElementById("review_log_form");
var source_input = document.getElementById('hidden-source');
source_input.value = source;
review_form.submit();
}
</script>

View File

@ -1576,6 +1576,12 @@ switch ($tab) {
include 'estado_monitores.php'; include 'estado_monitores.php';
echo "<a name='alerts'></a>"; echo "<a name='alerts'></a>";
include 'alerts_status.php'; include 'alerts_status.php';
if ($config['log_collector']) {
echo "<a name='log_sources'></a>";
include 'log_sources_status.php';
}
// Check permissions to read events // Check permissions to read events
if (check_acl($config['id_user'], 0, 'ER')) { if (check_acl($config['id_user'], 0, 'ER')) {
echo "<a name='events'></a>"; echo "<a name='events'></a>";

View File

@ -317,7 +317,12 @@ if (is_ajax()) {
); );
$count = events_get_all( $count = events_get_all(
'count', 'count',
$filter $filter,
null,
null,
null,
null,
$history
); );
if ($count !== false) { if ($count !== false) {

View File

@ -137,11 +137,11 @@ if (isset($_GET['id'])) {
} }
// Upload file // Upload file
if ((check_acl($config['id_user'], $id_grupo, 'IW') == 1) and isset($_GET['upload_file']) and ($_FILES['userfile']['name'] != '')) { if ((check_acl($config['id_user'], $id_grupo, 'IW') == 1) && isset($_GET['upload_file']) && ($_FILES['userfile']['name'] != '')) {
$description = get_parameter('file_description', __('No description available')); $description = get_parameter('file_description', __('No description available'));
// Insert into database // Insert into database
$filename = io_safe_input($_FILES['userfile']['name']); $filename = strip_tags(io_safe_input($_FILES['userfile']['name']), '<br>');
$filesize = io_safe_input($_FILES['userfile']['size']); $filesize = io_safe_input($_FILES['userfile']['size']);
// The following is if you have clamavlib installed // The following is if you have clamavlib installed

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.748 %define version 7.0NG.748
%define release 200810 %define release 200827
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.748 %define version 7.0NG.748
%define release 200810 %define release 200827
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

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

View File

@ -381,6 +381,7 @@ CREATE TABLE IF NOT EXISTS `talert_commands` (
`fields_descriptions` TEXT, `fields_descriptions` TEXT,
`fields_values` TEXT, `fields_values` TEXT,
`fields_hidden` TEXT, `fields_hidden` TEXT,
`previous_name` text,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -423,6 +424,7 @@ CREATE TABLE IF NOT EXISTS `talert_actions` (
`field13_recovery` text NOT NULL, `field13_recovery` text NOT NULL,
`field14_recovery` text NOT NULL, `field14_recovery` text NOT NULL,
`field15_recovery` text NOT NULL, `field15_recovery` text NOT NULL,
`previous_name` text,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
FOREIGN KEY (`id_alert_command`) REFERENCES talert_commands(`id`) FOREIGN KEY (`id_alert_command`) REFERENCES talert_commands(`id`)
ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE
@ -490,6 +492,7 @@ CREATE TABLE IF NOT EXISTS `talert_templates` (
`wizard_level` enum('basic','advanced','nowizard') default 'nowizard', `wizard_level` enum('basic','advanced','nowizard') default 'nowizard',
`min_alerts_reset_counter` tinyint(1) default 0, `min_alerts_reset_counter` tinyint(1) default 0,
`disable_event` tinyint(1) default 0, `disable_event` tinyint(1) default 0,
`previous_name` text,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_template_action` (`id_alert_action`), KEY `idx_template_action` (`id_alert_action`),
FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`) FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
@ -583,6 +586,7 @@ CREATE TABLE IF NOT EXISTS `tconfig_os` (
`name` varchar(100) NOT NULL default '', `name` varchar(100) NOT NULL default '',
`description` varchar(250) default '', `description` varchar(250) default '',
`icon_name` varchar(100) default '', `icon_name` varchar(100) default '',
`previous_name` text NULL,
PRIMARY KEY (`id_os`) PRIMARY KEY (`id_os`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -2041,6 +2045,7 @@ CREATE TABLE IF NOT EXISTS `ttag` (
`url` mediumtext NOT NULL, `url` mediumtext NOT NULL,
`email` text NULL, `email` text NULL,
`phone` text NULL, `phone` text NULL,
`previous_name` text NULL,
PRIMARY KEY (`id_tag`) PRIMARY KEY (`id_tag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -150,27 +150,27 @@ UNLOCK TABLES;
-- --
LOCK TABLES `tconfig_os` WRITE; LOCK TABLES `tconfig_os` WRITE;
INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`) VALUES INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`, `previous_name`) VALUES
(1,'Linux','Linux: All versions','so_linux.png'), (1,'Linux','Linux: All versions','so_linux.png', ''),
(2,'Solaris','Sun Solaris','so_solaris.png'), (2,'Solaris','Sun Solaris','so_solaris.png', ''),
(3,'AIX','IBM AIX','so_aix.png'), (3,'AIX','IBM AIX','so_aix.png', ''),
(4,'BSD','OpenBSD, FreeBSD and Others','so_bsd.png'), (4,'BSD','OpenBSD, FreeBSD and Others','so_bsd.png', ''),
(5,'HP-UX','HP-UX Unix OS','so_hpux.png'), (5,'HP-UX','HP-UX Unix OS','so_hpux.png', ''),
(7,'Cisco','CISCO IOS','so_cisco.png'), (7,'Cisco','CISCO IOS','so_cisco.png', ''),
(8,'MacOS','MAC OS','so_mac.png'), (8,'MacOS','MAC OS','so_mac.png', ''),
(9,'Windows','Microsoft Windows OS','so_win.png'), (9,'Windows','Microsoft Windows OS','so_win.png', ''),
(10,'Other','Other SO','so_other.png'), (10,'Other','Other SO','so_other.png', ''),
(11,'Network','Network Agent','network.png'), (11,'Network','Network Agent','network.png', ''),
(12,'Web Server','Web Server/Application','network.png'), (12,'Web Server','Web Server/Application','network.png', ''),
(13,'Sensor','Hardware Agent (Sensor)','network.png'), (13,'Sensor','Hardware Agent (Sensor)','network.png', ''),
(14,'Embedded','Embedded device running an agent','embedded.png'), (14,'Embedded','Embedded device running an agent','embedded.png', ''),
(15,'Android','Android agent','android.png'), (15,'Android','Android agent','android.png', ''),
(16, 'VMware', 'VMware Architecture', 'so_vmware.png'), (16, 'VMware', 'VMware Architecture', 'so_vmware.png', ''),
(17, 'Router', 'Generic router', 'so_router.png'), (17, 'Router', 'Generic router', 'so_router.png', ''),
(18, 'Switch', 'Generic switch', 'so_switch.png'), (18, 'Switch', 'Generic switch', 'so_switch.png', ''),
(19, 'Satellite', 'Satellite agent', 'satellite.png'), (19, 'Satellite', 'Satellite agent', 'satellite.png', ''),
(20, 'Mainframe', 'Mainframe agent', 'so_mainframe.png'), (20, 'Mainframe', 'Mainframe agent', 'so_mainframe.png', ''),
(100, 'Cluster', 'Cluster agent', 'so_cluster.png'); (100, 'Cluster', 'Cluster agent', 'so_cluster.png', '');
UNLOCK TABLES; UNLOCK TABLES;
@ -1187,7 +1187,7 @@ INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`
INSERT INTO `tagent_custom_fields` VALUES (1,'Serial&#x20;Number',0,0,''),(2,'Department',0,0,''),(3,'Additional&#x20;ID',0,0,''),(4,'eHorusID',0,0,''); INSERT INTO `tagent_custom_fields` VALUES (1,'Serial&#x20;Number',0,0,''),(2,'Department',0,0,''),(3,'Additional&#x20;ID',0,0,''),(4,'eHorusID',0,0,'');
INSERT INTO `ttag` VALUES (1,'network','Network&#x20;equipment','http://artica.es','',''),(2,'critical','Critical&#x20;modules','','',''),(3,'dmz','DMZ&#x20;Network&#x20;Zone','','',''),(4,'performance','Performance&#x20;anda&#x20;capacity&#x20;modules','','',''),(5,'configuration','','','',''); INSERT INTO `ttag` VALUES (1,'network','Network&#x20;equipment','http://artica.es','','',''),(2,'critical','Critical&#x20;modules','','','',''),(3,'dmz','DMZ&#x20;Network&#x20;Zone','','','',''),(4,'performance','Performance&#x20;anda&#x20;capacity&#x20;modules','','','',''),(5,'configuration','','','','','');
INSERT INTO `tevent_response` VALUES (1,'Ping&#x20;to&#x20;host','Ping&#x20;to&#x20;the&#x20;agent&#x20;host','ping&#x20;-c&#x20;5&#x20;_agent_address_','command',0,620,500,0,'',0,90),(3,'Create&#x20;incident&#x20;from&#x20;event','Create&#x20;a&#x20;incident&#x20;from&#x20;the&#x20;event&#x20;with&#x20;the&#x20;standard&#x20;incidents&#x20;system&#x20;of&#x20;Pandora&#x20;FMS','index.php?sec=workspace&amp;sec2=operation/incidents/incident_detail&amp;insert_form&amp;from_event=_event_id_','url',0,0,0,1,'',0,90),(5,'Restart&#x20;agent','Restart&#x20;the&#x20;agent&#x20;with&#x20;using&#x20;UDP&#x20;protocol.&#x0d;&#x0a;&#x0d;&#x0a;To&#x20;use&#x20;this&#x20;response&#x20;is&#x20;necessary&#x20;to&#x20;have&#x20;installed&#x20;Pandora&#x20;FMS&#x20;server&#x20;and&#x20;console&#x20;in&#x20;the&#x20;same&#x20;machine.','/usr/share/pandora_server/util/udp_client.pl&#x20;_agent_address_&#x20;41122&#x20;&quot;REFRESH&#x20;AGENT&quot;','command',0,620,500,0,'',0,90),(6,'Ping&#x20;to&#x20;module&#x20;agent&#x20;host','Ping&#x20;to&#x20;the&#x20;module&#x20;agent&#x20;host','ping&#x20;-c&#x20;5&#x20;_module_address_','command',0,620,500,0,'',0,90); INSERT INTO `tevent_response` VALUES (1,'Ping&#x20;to&#x20;host','Ping&#x20;to&#x20;the&#x20;agent&#x20;host','ping&#x20;-c&#x20;5&#x20;_agent_address_','command',0,620,500,0,'',0,90),(3,'Create&#x20;incident&#x20;from&#x20;event','Create&#x20;a&#x20;incident&#x20;from&#x20;the&#x20;event&#x20;with&#x20;the&#x20;standard&#x20;incidents&#x20;system&#x20;of&#x20;Pandora&#x20;FMS','index.php?sec=workspace&amp;sec2=operation/incidents/incident_detail&amp;insert_form&amp;from_event=_event_id_','url',0,0,0,1,'',0,90),(5,'Restart&#x20;agent','Restart&#x20;the&#x20;agent&#x20;with&#x20;using&#x20;UDP&#x20;protocol.&#x0d;&#x0a;&#x0d;&#x0a;To&#x20;use&#x20;this&#x20;response&#x20;is&#x20;necessary&#x20;to&#x20;have&#x20;installed&#x20;Pandora&#x20;FMS&#x20;server&#x20;and&#x20;console&#x20;in&#x20;the&#x20;same&#x20;machine.','/usr/share/pandora_server/util/udp_client.pl&#x20;_agent_address_&#x20;41122&#x20;&quot;REFRESH&#x20;AGENT&quot;','command',0,620,500,0,'',0,90),(6,'Ping&#x20;to&#x20;module&#x20;agent&#x20;host','Ping&#x20;to&#x20;the&#x20;module&#x20;agent&#x20;host','ping&#x20;-c&#x20;5&#x20;_module_address_','command',0,620,500,0,'',0,90);

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.748-200810 Version: 7.0NG.748-200827
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

@ -1018,9 +1018,9 @@ sub pandora_execute_action ($$$$$$$$$;$) {
$field15 = defined($action->{'field15'}) && $action->{'field15'} ne "" ? $action->{'field15'} : $alert->{'field15'}; $field15 = defined($action->{'field15'}) && $action->{'field15'} ne "" ? $action->{'field15'} : $alert->{'field15'};
} }
else { else {
$field1 = defined($alert->{'field1'}) && $alert->{'field1'} ne "" ? $alert->{'field1'} : $action->{'field1'}; $field1 = defined($action->{'field1'}) && $action->{'field1'} ne "" ? $action->{'field1'} : $alert->{'field1'};
$field2 = defined($alert->{'field2'}) && $alert->{'field2'} ne "" ? $alert->{'field2'} : $action->{'field2'}; $field2 = defined($action->{'field2'}) && $action->{'field2'} ne "" ? $action->{'field2'} : $alert->{'field2'};
$field3 = defined($alert->{'field3'}) && $alert->{'field3'} ne "" ? $alert->{'field3'} : $action->{'field3'}; $field3 = defined($action->{'field3'}) && $action->{'field3'} ne "" ? $action->{'field3'} : $alert->{'field3'};
$field4 = defined($action->{'field4'}) && $action->{'field4'} ne "" ? $action->{'field4'} : $alert->{'field4'}; $field4 = defined($action->{'field4'}) && $action->{'field4'} ne "" ? $action->{'field4'} : $alert->{'field4'};
$field5 = defined($action->{'field5'}) && $action->{'field5'} ne "" ? $action->{'field5'} : $alert->{'field5'}; $field5 = defined($action->{'field5'}) && $action->{'field5'} ne "" ? $action->{'field5'} : $alert->{'field5'};
$field6 = defined($action->{'field6'}) && $action->{'field6'} ne "" ? $action->{'field6'} : $alert->{'field6'}; $field6 = defined($action->{'field6'}) && $action->{'field6'} ne "" ? $action->{'field6'} : $alert->{'field6'};

View File

@ -52,8 +52,10 @@ our @EXPORT = qw(
db_string db_string
db_text db_text
db_update db_update
db_update_hash
db_update_get_values db_update_get_values
set_update_agent set_update_agent
set_update_agentmodule
get_action_id get_action_id
get_addr_id get_addr_id
get_agent_addr_id get_agent_addr_id
@ -912,17 +914,21 @@ sub get_db_rows_limit ($$$;@) {
} }
########################################################################## ##########################################################################
## Updates agent fields using field => value ## Updates using hashed data.
## Be careful, no filter is done. ## $dbh database connector (active)
## $tablename table name
## $id hashref as { 'primary_key_id' => "value" }
## $data hashref as { 'field1' => "value", 'field2' => "value"}
########################################################################## ##########################################################################
sub set_update_agent { sub db_update_hash {
my ($dbh, $agent_id, $data) = @_; my ($dbh, $tablename, $id, $data) = @_;
return undef unless (defined($tablename) && $tablename ne "");
return undef unless (defined($agent_id) && $agent_id > 0);
return undef unless (ref($data) eq "HASH"); return undef unless (ref($data) eq "HASH");
# Build update query # Build update query
my $query = 'UPDATE tagente SET '; my $query = 'UPDATE `'.$tablename.'` SET ';
my @values; my @values;
foreach my $field (keys %{$data}) { foreach my $field (keys %{$data}) {
@ -933,12 +939,50 @@ sub set_update_agent {
chop($query); chop($query);
$query .= ' WHERE id_agente = ? '; my @keys = keys %{$id};
push @values, $agent_id; my $k = shift @keys;
$query .= ' WHERE '.$k.' = ? ';
push @values, $id->{$k};
return db_update($dbh, $query, @values); return db_update($dbh, $query, @values);
} }
##########################################################################
## Updates agent fields using field => value
## Be careful, no filter is done.
##########################################################################
sub set_update_agent {
my ($dbh, $agent_id, $data) = @_;
return undef unless (defined($agent_id) && $agent_id > 0);
return undef unless (ref($data) eq "HASH");
return db_update_hash(
$dbh,
'tagente',
{ 'id_agente' => $agent_id },
$data
);
}
##########################################################################
## Updates agent fields using field => value
## Be careful, no filter is done.
##########################################################################
sub set_update_agentmodule {
my ($dbh, $agentmodule_id, $data) = @_;
return undef unless (defined($agentmodule_id) && $agentmodule_id > 0);
return undef unless (ref($data) eq "HASH");
return db_update_hash(
$dbh,
'tagente_modulo',
{ 'id_agente_modulo' => $agentmodule_id },
$data
);
}
########################################################################## ##########################################################################
## SQL delete with a LIMIT clause. ## SQL delete with a LIMIT clause.

View File

@ -633,6 +633,9 @@ sub process_module_data ($$$$$$$$$$) {
# Get module parameters, matching column names in tagente_modulo # Get module parameters, matching column names in tagente_modulo
my $module_conf; my $module_conf;
# Extra usable fields but not supported at DB level.
my $extra = {};
# Supported tags # Supported tags
my $tags = {'name' => 0, 'data' => 0, 'type' => 0, 'description' => 0, 'max' => 0, my $tags = {'name' => 0, 'data' => 0, 'type' => 0, 'description' => 0, 'max' => 0,
'min' => 0, 'descripcion' => 0, 'post_process' => 0, 'module_interval' => 0, 'min_critical' => 0, 'min' => 0, 'descripcion' => 0, 'post_process' => 0, 'module_interval' => 0, 'min_critical' => 0,
@ -642,7 +645,9 @@ sub process_module_data ($$$$$$$$$$) {
'unknown_instructions' => '', 'tags' => '', 'critical_inverse' => 0, 'warning_inverse' => 0, 'quiet' => 0, 'unknown_instructions' => '', 'tags' => '', 'critical_inverse' => 0, 'warning_inverse' => 0, 'quiet' => 0,
'module_ff_interval' => 0, 'alert_template' => '', 'crontab' => '', 'min_ff_event_normal' => 0, 'module_ff_interval' => 0, 'alert_template' => '', 'crontab' => '', 'min_ff_event_normal' => 0,
'min_ff_event_warning' => 0, 'min_ff_event_critical' => 0, 'ff_timeout' => 0, 'each_ff' => 0, 'module_parent' => 0, 'min_ff_event_warning' => 0, 'min_ff_event_critical' => 0, 'ff_timeout' => 0, 'each_ff' => 0, 'module_parent' => 0,
'module_parent_unlink' => 0, 'cron_interval' => 0, 'ff_type' => 0}; 'module_parent_unlink' => 0, 'cron_interval' => 0, 'ff_type' => 0, 'min_warning_forced' => 0, 'max_warning_forced' => 0,
'min_critical_forced' => 0, 'max_critical_forced' => 0, 'str_warning_forced' => 0, 'str_critical_forced' => 0
};
# Other tags will be saved here # Other tags will be saved here
$module_conf->{'extended_info'} = ''; $module_conf->{'extended_info'} = '';
@ -693,6 +698,14 @@ sub process_module_data ($$$$$$$$$$) {
$module_conf->{'disabled_types_event'} = '' unless defined ($module_conf->{'disabled_types_event'}); $module_conf->{'disabled_types_event'} = '' unless defined ($module_conf->{'disabled_types_event'});
$module_conf->{'module_macros'} = '' unless defined ($module_conf->{'module_macros'}); $module_conf->{'module_macros'} = '' unless defined ($module_conf->{'module_macros'});
# Extract extra fields.
foreach my $pk (keys %{$module_conf}) {
if ($pk =~ /_forced$/) {
$extra->{$pk} = $module_conf->{$pk};
delete $module_conf->{$pk};
}
}
# Get module data or create it if it does not exist # Get module data or create it if it does not exist
my $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND ' . db_text ('nombre') . ' = ?', $agent->{'id_agente'}, safe_input($module_name)); my $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND ' . db_text ('nombre') . ' = ?', $agent->{'id_agente'}, safe_input($module_name));
if (! defined ($module)) { if (! defined ($module)) {
@ -825,7 +838,13 @@ sub process_module_data ($$$$$$$$$$) {
# Update module configuration if in learning mode and not a policy module # Update module configuration if in learning mode and not a policy module
if ((($agent->{'modo'} eq '1') || ($agent->{'modo'} eq '2')) && $policy_linked == 0) { if ((($agent->{'modo'} eq '1') || ($agent->{'modo'} eq '2')) && $policy_linked == 0) {
update_module_configuration ($pa_config, $dbh, $module, $module_conf); update_module_configuration(
$pa_config,
$dbh,
$module,
$module_conf,
$extra
);
} }
# Module disabled! # Module disabled!
@ -898,8 +917,8 @@ sub get_macros_for_data($$){
########################################################################## ##########################################################################
# Update module configuration in tagente_modulo if necessary. # Update module configuration in tagente_modulo if necessary.
########################################################################## ##########################################################################
sub update_module_configuration ($$$$) { sub update_module_configuration ($$$$$) {
my ($pa_config, $dbh, $module, $module_conf) = @_; my ($pa_config, $dbh, $module, $module_conf, $extra) = @_;
# Update if at least one of the configuration tokens has changed # Update if at least one of the configuration tokens has changed
foreach my $conf_token ('descripcion', 'extended_info', 'module_interval') { foreach my $conf_token ('descripcion', 'extended_info', 'module_interval') {
@ -917,6 +936,9 @@ sub update_module_configuration ($$$$) {
$module->{'extended_info'} = $module_conf->{'extended_info'} if (defined($module_conf->{'extended_info'})) ; $module->{'extended_info'} = $module_conf->{'extended_info'} if (defined($module_conf->{'extended_info'})) ;
$module->{'descripcion'} = ($module_conf->{'descripcion'} eq '') ? $module->{'descripcion'} : $module_conf->{'descripcion'}; $module->{'descripcion'} = ($module_conf->{'descripcion'} eq '') ? $module->{'descripcion'} : $module_conf->{'descripcion'};
$module->{'module_interval'} = ($module_conf->{'module_interval'} eq '') ? $module->{'module_interval'} : $module_conf->{'module_interval'}; $module->{'module_interval'} = ($module_conf->{'module_interval'} eq '') ? $module->{'module_interval'} : $module_conf->{'module_interval'};
# Enterprise updates.
enterprise_hook('update_module_fields', [$dbh, $pa_config, $module, $extra]);
} }
############################################################################### ###############################################################################

View File

@ -33,7 +33,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.748"; my $pandora_version = "7.0NG.748";
my $pandora_build = "200810"; my $pandora_build = "200827";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );
@ -672,6 +672,24 @@ sub print_module {
if (! (empty ($data->{warning_inverse}))) { if (! (empty ($data->{warning_inverse}))) {
$xml_module .= "\t<warning_inverse><![CDATA[" . $data->{warning_inverse} . "]]></warning_inverse>\n"; $xml_module .= "\t<warning_inverse><![CDATA[" . $data->{warning_inverse} . "]]></warning_inverse>\n";
} }
if (! (empty($data->{min_warning})) ) {
$xml_module .= "\t<min_warning_forced><![CDATA[" . $data->{min_warning_forced} . "]]></min_warning_forced>\n";
}
if (! (empty($data->{max_warning})) ) {
$xml_module .= "\t<max_warning_forced><![CDATA[" . $data->{max_warning_forced} . "]]></max_warning_forced>\n";
}
if (! (empty ($data->{min_critical})) ) {
$xml_module .= "\t<min_critical_forced><![CDATA[" . $data->{min_critical_forced} . "]]></min_critical_forced>\n";
}
if (! (empty ($data->{max_critical})) ){
$xml_module .= "\t<max_critical_forced><![CDATA[" . $data->{max_critical_forced} . "]]></max_critical_forced>\n";
}
if (! (empty ($data->{str_warning}))) {
$xml_module .= "\t<str_warning_forced><![CDATA[" . $data->{str_warning_forced} . "]]></str_warning_forced>\n";
}
if (! (empty ($data->{str_critical}))) {
$xml_module .= "\t<str_critical_forced><![CDATA[" . $data->{str_critical_forced} . "]]></str_critical_forced>\n";
}
if (! (empty ($data->{max}))) { if (! (empty ($data->{max}))) {
$xml_module .= "\t<max><![CDATA[" . $data->{max} . "]]></max>\n"; $xml_module .= "\t<max><![CDATA[" . $data->{max} . "]]></max>\n";
} }

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.748 %define version 7.0NG.748
%define release 200810 %define release 200827
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.748 %define version 7.0NG.748
%define release 200810 %define release 200827
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.748" PI_VERSION="7.0NG.748"
PI_BUILD="200810" PI_BUILD="200827"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

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

View File

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