mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-23 22:05:41 +02:00
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:
commit
c5268c152a
@ -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.
|
||||
|
||||
### 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
|
||||
* Network monitoring
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.748-200810
|
||||
Version: 7.0NG.748-200827
|
||||
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.748-200810"
|
||||
pandora_version="7.0NG.748-200827"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -55,7 +55,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
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
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
@ -1678,7 +1678,7 @@ sub execute_command_timeout {
|
||||
};
|
||||
|
||||
my $result = ($?>>8);
|
||||
print $result;
|
||||
return $result;
|
||||
|
||||
# Exit child.
|
||||
# Child finishes.
|
||||
@ -1753,7 +1753,7 @@ sub execute_command_block {
|
||||
);
|
||||
|
||||
# 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);
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.748
|
||||
%define release 200810
|
||||
%define release 200827
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
@ -21,10 +21,10 @@ BuildArch: noarch
|
||||
Requires(pre): shadow-utils
|
||||
Requires(post): chkconfig /bin/ln
|
||||
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
|
||||
Requires: fileutils textutils unzip
|
||||
Requires: coreutils unzip
|
||||
Requires: util-linux procps grep
|
||||
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
|
||||
#Requires: sh-utils sed passwd net-tools rpm
|
||||
AutoReq: 0
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.748
|
||||
%define release 200810
|
||||
%define release 200827
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
@ -20,7 +20,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||
BuildArch: noarch
|
||||
#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: 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
|
||||
Provides: %{name}-%{version}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.748"
|
||||
PI_BUILD="200810"
|
||||
PI_BUILD="200827"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -56,6 +56,8 @@ my $Reg_exp = '';
|
||||
# Flag to show or not summary module
|
||||
my $summary_flag = 0;
|
||||
|
||||
my $nodatalist_flag = 0;
|
||||
|
||||
# Number of coincidences found
|
||||
my $coincidences = 0;
|
||||
|
||||
@ -120,7 +122,15 @@ sub error_msg ($) {
|
||||
# Print a help message.
|
||||
###############################################################################
|
||||
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) {
|
||||
print_summary() if ($summary_flag == 1);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
# Log module
|
||||
@ -341,6 +352,18 @@ sub print_log ($) {
|
||||
$output = "<module>\n";
|
||||
$output .= "<name><![CDATA[" . $Module_name . "]]></name>\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";
|
||||
foreach my $line (@kdata) {
|
||||
$output .= "<data><value><![CDATA[";
|
||||
@ -352,10 +375,12 @@ sub print_log ($) {
|
||||
$output .= "]]></value></data>\n";
|
||||
}
|
||||
$output .= "</datalist>\n";
|
||||
}
|
||||
$output .= "</module>\n";
|
||||
|
||||
print stdout $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@ -376,12 +401,18 @@ $Reg_exp = trim($ARGV[2]);
|
||||
my $up_lines = trim($ARGV[3]);
|
||||
my $bot_lines = trim($ARGV[4]);
|
||||
my $sum_flag = trim($ARGV[5]);
|
||||
my $nodatalist = trim($ARGV[6]);
|
||||
|
||||
if ( ( defined($up_lines) && ($up_lines eq "--summary"))
|
||||
|| ( defined($bot_lines) && ($bot_lines eq "--summary"))
|
||||
|| ( defined($sum_flag) && ($sum_flag eq "--summary")) ) {
|
||||
if ( grep { /--summary/ } @ARGV )
|
||||
{
|
||||
$summary_flag = 1;
|
||||
}
|
||||
|
||||
if ( grep { /--nodatalist/ } @ARGV )
|
||||
{
|
||||
$nodatalist_flag = 1;
|
||||
}
|
||||
|
||||
# Create index file storage directory
|
||||
if ( ! -d $Idx_dir) {
|
||||
mkdir($Idx_dir) || error_msg("Error creating directory $Idx_dir: "
|
||||
|
Binary file not shown.
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{200810}
|
||||
{200827}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#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_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
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"
|
||||
END
|
||||
END
|
||||
|
@ -5,4 +5,3 @@ Options -Indexes
|
||||
Order Allow,Deny
|
||||
Deny from All
|
||||
</Files>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.748-200810
|
||||
Version: 7.0NG.748-200827
|
||||
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.748-200810"
|
||||
pandora_version="7.0NG.748-200827"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -7,5 +7,3 @@
|
||||
Deny from all
|
||||
Allow from localhost
|
||||
</FilesMatch>
|
||||
php_flag engine off
|
||||
|
||||
|
9
pandora_console/extras/mr/41.sql
Normal file
9
pandora_console/extras/mr/41.sql
Normal 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;
|
@ -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 `field14_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,
|
||||
MODIFY COLUMN `field12` text NOT NULL,
|
||||
MODIFY COLUMN `field13` text NOT NULL,
|
||||
@ -1325,6 +1327,7 @@ UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria IMS 
|
||||
UPDATE `talert_commands` SET `description` = 'This alert send an email using internal Pandora FMS Server SMTP capabilities (defined in each server, using:
_field1_ as destination email address, and
_field2_ as subject for message. 
_field3_ as text of message. 
_field4_ as content type (text/plain or html/text).', `fields_descriptions` = '[\"Destination address\",\"Subject\",\"Text\",\"Content 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 `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;
|
||||
|
||||
@ -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 '';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `ttag`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `ttag` ADD COLUMN `previous_name` text NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -1381,7 +1389,9 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_content', '');
|
||||
-- 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');
|
||||
|
||||
@ -2461,6 +2471,8 @@ INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES
|
||||
-- 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 `field11` text NOT NULL,
|
||||
|
@ -291,8 +291,8 @@ if (is_ajax()) {
|
||||
'field'.$i.'_value',
|
||||
'',
|
||||
'',
|
||||
__('None'),
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
|
@ -362,6 +362,7 @@ $templates = alerts_get_alert_templates(
|
||||
'description',
|
||||
'type',
|
||||
'id_group',
|
||||
'previous_name',
|
||||
]
|
||||
);
|
||||
if ($templates === false) {
|
||||
|
@ -83,6 +83,10 @@ if ($update_command) {
|
||||
$values['command'] = $command;
|
||||
$values['description'] = $description;
|
||||
$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.
|
||||
$id_check = db_get_value('id', 'talert_commands', 'name', $name);
|
||||
|
@ -34,6 +34,9 @@ if (! check_acl($config['id_user'], 0, 'LM')) {
|
||||
$duplicate_template = (bool) get_parameter('duplicate_template');
|
||||
$id = (int) get_parameter('id');
|
||||
$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 ($duplicate_template) {
|
||||
@ -56,7 +59,6 @@ if ($a_template !== false) {
|
||||
if (defined('METACONSOLE')) {
|
||||
alerts_meta_print_header();
|
||||
} else {
|
||||
$step = (int) get_parameter('step', 1);
|
||||
if ($step == 1) {
|
||||
$help_header = '';
|
||||
} else if ($step == 2) {
|
||||
@ -113,7 +115,6 @@ if ($a_template !== false) {
|
||||
if (defined('METACONSOLE')) {
|
||||
alerts_meta_print_header();
|
||||
} else {
|
||||
$step = (int) get_parameter('step', 1);
|
||||
if ($step == 1) {
|
||||
$help_header = '';
|
||||
} else if ($step == 2) {
|
||||
@ -252,16 +253,11 @@ function update_template($step)
|
||||
$wizard_level = (string) get_parameter('wizard_level');
|
||||
$priority = (int) get_parameter('priority');
|
||||
$id_group = get_parameter('id_group');
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
$name_check = db_get_value('name', 'talert_templates', 'name', $name);
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$name_check = db_get_value('name', 'talert_templates', 'to_char(name)', $name);
|
||||
break;
|
||||
// Only for Metaconsole. Save the previous name for synchronizing.
|
||||
if (is_metaconsole()) {
|
||||
$previous_name = db_get_value('name', 'talert_templates', 'id', $id);
|
||||
} else {
|
||||
$previous_name = '';
|
||||
}
|
||||
|
||||
$values = [
|
||||
@ -270,6 +266,7 @@ function update_template($step)
|
||||
'id_group' => $id_group,
|
||||
'priority' => $priority,
|
||||
'wizard_level' => $wizard_level,
|
||||
'previous_name' => $previous_name,
|
||||
];
|
||||
|
||||
$result = alerts_update_alert_template($id, $values);
|
||||
|
@ -330,7 +330,7 @@ if ($create_component) {
|
||||
|
||||
if ($name && !$name_check) {
|
||||
$id = network_components_create_network_component(
|
||||
$name,
|
||||
strip_tags(io_safe_input($name), '<br>'),
|
||||
$type,
|
||||
$id_group,
|
||||
[
|
||||
@ -431,7 +431,7 @@ if ($update_component) {
|
||||
$id,
|
||||
[
|
||||
'type' => $type,
|
||||
'name' => $name,
|
||||
'name' => strip_tags(io_safe_input($name, '<br>')),
|
||||
'id_group' => $id_group,
|
||||
'description' => $description,
|
||||
'module_interval' => $module_interval,
|
||||
|
@ -111,7 +111,7 @@ if (isset($id)) {
|
||||
$component = network_components_get_network_component((int) $id);
|
||||
if ($component !== false) {
|
||||
$id_component_type = $component['id_modulo'];
|
||||
$name = $component['name'];
|
||||
$name = io_safe_output($component['name']);
|
||||
$type = $component['type'];
|
||||
$description = $component['description'];
|
||||
$max = $component['max'];
|
||||
|
@ -98,6 +98,10 @@ switch ($action) {
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$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 != '')) {
|
||||
$values['icon_name'] = $icon;
|
||||
|
@ -79,6 +79,10 @@ if ($update_tag && $id_tag != 0) {
|
||||
$values['url'] = $url_tag;
|
||||
$values['email'] = $email_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;
|
||||
if ($values['name'] != '') {
|
||||
|
@ -511,34 +511,38 @@ foreach ($info as $user_id => $user_info) {
|
||||
|
||||
$data[4] = '';
|
||||
if ($user_profiles !== false) {
|
||||
if (defined('METACONSOLE')) {
|
||||
$data[4] .= "<div width='100%'>";
|
||||
$total_profile = 0;
|
||||
|
||||
$data[4] .= '<div style="text-align: end;">';
|
||||
foreach ($user_profiles as $row) {
|
||||
if ($total_profile <= 5) {
|
||||
$data[4] .= "<div style='float:left;'>";
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / </div>';
|
||||
$data[4] .= "<div style='float:left; padding-left:5px;'>";
|
||||
$data[4] .= groups_get_name($row['id_grupo'], true);
|
||||
$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] .= '</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>';
|
||||
} 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 {
|
||||
$data[4] .= __('The user doesn\'t have any assigned profile/group');
|
||||
}
|
||||
@ -588,3 +592,17 @@ if ($config['admin_can_add_user'] !== false) {
|
||||
echo '</div>';
|
||||
|
||||
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>';
|
||||
|
@ -1,5 +1,4 @@
|
||||
#pandora disable phpexec
|
||||
<Files *.php>
|
||||
<FilesMatch "\.(php)$">
|
||||
Deny from all
|
||||
</Files>
|
||||
php_flag engine off
|
||||
</FilesMatch>
|
@ -937,11 +937,16 @@ if ($perform_event_response) {
|
||||
return;
|
||||
}
|
||||
|
||||
$target = get_parameter('target', '');
|
||||
$response_id = get_parameter('response_id');
|
||||
$event_id = (int) get_parameter('event_id');
|
||||
$server_id = (int) get_parameter('server_id', 0);
|
||||
|
||||
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);
|
||||
|
||||
@ -1088,7 +1093,8 @@ if ($dialogue_event_response) {
|
||||
}
|
||||
} else {
|
||||
echo "<div style='text-align:left'>";
|
||||
echo $prompt.sprintf(__('Executing command: %s', $command));
|
||||
|
||||
echo $prompt."Executing command: $command";
|
||||
echo '</div><br>';
|
||||
|
||||
echo "<div id='response_loading_command' style='display:none'>".html_print_image('images/spinner.gif', true).'</div>';
|
||||
|
@ -3001,6 +3001,8 @@ class AgentWizard extends HTML
|
||||
$module['name']
|
||||
);
|
||||
|
||||
$newModule['name_oid'] = str_replace('"', '', $tmpSecond[3]);
|
||||
|
||||
// Add this new module to the module list.
|
||||
$moduleBlocks[] = $newModule;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC200810';
|
||||
$build_version = 'PC200827';
|
||||
$pandora_version = 'v7.0NG.748';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -2780,6 +2780,11 @@ function alerts_ui_update_or_create_actions($update=true)
|
||||
if ($update) {
|
||||
$values['name'] = $name;
|
||||
$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);
|
||||
} else {
|
||||
$name_check = db_get_value('name', 'talert_actions', 'name', $name);
|
||||
|
@ -1861,13 +1861,13 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
|
||||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect($server) == NOERR) {
|
||||
if ($other['data'][0] === '1') {
|
||||
$idAgent[0] = agents_get_agent_id_by_alias($id);
|
||||
$idAgent = agents_get_agent_id_by_alias($id);
|
||||
} else {
|
||||
$idAgent[0] = agents_get_agent_id($id, true);
|
||||
}
|
||||
|
||||
if ($idAgent[0]) {
|
||||
$result = agents_delete_agent($idAgent, true);
|
||||
if (!empty($idAgent)) {
|
||||
$result = agents_delete_agent($idAgent[0], true);
|
||||
}
|
||||
|
||||
metaconsole_restore_db();
|
||||
|
@ -728,7 +728,7 @@ function notifications_print_source_select_box(
|
||||
"
|
||||
<div class='global-config-notification-single-selector'>
|
||||
<div>
|
||||
<h4>%s</h4>
|
||||
<h5>%s</h5>
|
||||
%s
|
||||
</div>
|
||||
<div class='global-notifications-icons'>
|
||||
|
@ -135,7 +135,7 @@ function show_response_dialog(response_id, response) {
|
||||
params.push("dialogue_event_response=1");
|
||||
params.push("massive=0");
|
||||
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("server_id=" + response["server_id"]);
|
||||
|
||||
@ -363,8 +363,17 @@ function get_response_target(
|
||||
if (response_params.length > 1 || response_params[0] != "") {
|
||||
for (var i = 0; i < response_params.length; i++) {
|
||||
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(
|
||||
"_" + response_params[i] + "_",
|
||||
response_param,
|
||||
$("#" + response_params[i]).val()
|
||||
);
|
||||
} else {
|
||||
@ -388,7 +397,7 @@ function perform_response(response, response_id) {
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
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("event_id=" + response["event_id"]);
|
||||
params.push("server_id=" + response["server_id"]);
|
||||
|
@ -1088,6 +1088,9 @@ if ($searchPage) {
|
||||
}
|
||||
} else if ($sec == 'gextensions') {
|
||||
$main_sec = get_parameter('extension_in_menu');
|
||||
if (empty($main_sec) === true) {
|
||||
$main_sec = $sec;
|
||||
}
|
||||
} else {
|
||||
$main_sec = $sec;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.748';
|
||||
$build = '200810';
|
||||
$build = '200827';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
101
pandora_console/operation/agentes/log_sources_status.php
Normal file
101
pandora_console/operation/agentes/log_sources_status.php
Normal 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>
|
@ -1576,6 +1576,12 @@ switch ($tab) {
|
||||
include 'estado_monitores.php';
|
||||
echo "<a name='alerts'></a>";
|
||||
include 'alerts_status.php';
|
||||
|
||||
if ($config['log_collector']) {
|
||||
echo "<a name='log_sources'></a>";
|
||||
include 'log_sources_status.php';
|
||||
}
|
||||
|
||||
// Check permissions to read events
|
||||
if (check_acl($config['id_user'], 0, 'ER')) {
|
||||
echo "<a name='events'></a>";
|
||||
|
@ -317,7 +317,12 @@ if (is_ajax()) {
|
||||
);
|
||||
$count = events_get_all(
|
||||
'count',
|
||||
$filter
|
||||
$filter,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
$history
|
||||
);
|
||||
|
||||
if ($count !== false) {
|
||||
|
@ -137,11 +137,11 @@ if (isset($_GET['id'])) {
|
||||
}
|
||||
|
||||
// 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'));
|
||||
|
||||
// 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']);
|
||||
|
||||
// The following is if you have clamavlib installed
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.748
|
||||
%define release 200810
|
||||
%define release 200827
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.748
|
||||
%define release 200810
|
||||
%define release 200827
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.748
|
||||
%define release 200810
|
||||
%define release 200827
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -381,6 +381,7 @@ CREATE TABLE IF NOT EXISTS `talert_commands` (
|
||||
`fields_descriptions` TEXT,
|
||||
`fields_values` TEXT,
|
||||
`fields_hidden` TEXT,
|
||||
`previous_name` text,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
@ -423,6 +424,7 @@ CREATE TABLE IF NOT EXISTS `talert_actions` (
|
||||
`field13_recovery` text NOT NULL,
|
||||
`field14_recovery` text NOT NULL,
|
||||
`field15_recovery` text NOT NULL,
|
||||
`previous_name` text,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_alert_command`) REFERENCES talert_commands(`id`)
|
||||
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',
|
||||
`min_alerts_reset_counter` tinyint(1) default 0,
|
||||
`disable_event` tinyint(1) default 0,
|
||||
`previous_name` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_template_action` (`id_alert_action`),
|
||||
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 '',
|
||||
`description` varchar(250) default '',
|
||||
`icon_name` varchar(100) default '',
|
||||
`previous_name` text NULL,
|
||||
PRIMARY KEY (`id_os`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
@ -2041,6 +2045,7 @@ CREATE TABLE IF NOT EXISTS `ttag` (
|
||||
`url` mediumtext NOT NULL,
|
||||
`email` text NULL,
|
||||
`phone` text NULL,
|
||||
`previous_name` text NULL,
|
||||
PRIMARY KEY (`id_tag`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -150,27 +150,27 @@ UNLOCK TABLES;
|
||||
--
|
||||
|
||||
LOCK TABLES `tconfig_os` WRITE;
|
||||
INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`) VALUES
|
||||
(1,'Linux','Linux: All versions','so_linux.png'),
|
||||
(2,'Solaris','Sun Solaris','so_solaris.png'),
|
||||
(3,'AIX','IBM AIX','so_aix.png'),
|
||||
(4,'BSD','OpenBSD, FreeBSD and Others','so_bsd.png'),
|
||||
(5,'HP-UX','HP-UX Unix OS','so_hpux.png'),
|
||||
(7,'Cisco','CISCO IOS','so_cisco.png'),
|
||||
(8,'MacOS','MAC OS','so_mac.png'),
|
||||
(9,'Windows','Microsoft Windows OS','so_win.png'),
|
||||
(10,'Other','Other SO','so_other.png'),
|
||||
(11,'Network','Network Agent','network.png'),
|
||||
(12,'Web Server','Web Server/Application','network.png'),
|
||||
(13,'Sensor','Hardware Agent (Sensor)','network.png'),
|
||||
(14,'Embedded','Embedded device running an agent','embedded.png'),
|
||||
(15,'Android','Android agent','android.png'),
|
||||
(16, 'VMware', 'VMware Architecture', 'so_vmware.png'),
|
||||
(17, 'Router', 'Generic router', 'so_router.png'),
|
||||
(18, 'Switch', 'Generic switch', 'so_switch.png'),
|
||||
(19, 'Satellite', 'Satellite agent', 'satellite.png'),
|
||||
(20, 'Mainframe', 'Mainframe agent', 'so_mainframe.png'),
|
||||
(100, 'Cluster', 'Cluster agent', 'so_cluster.png');
|
||||
INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`, `previous_name`) VALUES
|
||||
(1,'Linux','Linux: All versions','so_linux.png', ''),
|
||||
(2,'Solaris','Sun Solaris','so_solaris.png', ''),
|
||||
(3,'AIX','IBM AIX','so_aix.png', ''),
|
||||
(4,'BSD','OpenBSD, FreeBSD and Others','so_bsd.png', ''),
|
||||
(5,'HP-UX','HP-UX Unix OS','so_hpux.png', ''),
|
||||
(7,'Cisco','CISCO IOS','so_cisco.png', ''),
|
||||
(8,'MacOS','MAC OS','so_mac.png', ''),
|
||||
(9,'Windows','Microsoft Windows OS','so_win.png', ''),
|
||||
(10,'Other','Other SO','so_other.png', ''),
|
||||
(11,'Network','Network Agent','network.png', ''),
|
||||
(12,'Web Server','Web Server/Application','network.png', ''),
|
||||
(13,'Sensor','Hardware Agent (Sensor)','network.png', ''),
|
||||
(14,'Embedded','Embedded device running an agent','embedded.png', ''),
|
||||
(15,'Android','Android agent','android.png', ''),
|
||||
(16, 'VMware', 'VMware Architecture', 'so_vmware.png', ''),
|
||||
(17, 'Router', 'Generic router', 'so_router.png', ''),
|
||||
(18, 'Switch', 'Generic switch', 'so_switch.png', ''),
|
||||
(19, 'Satellite', 'Satellite agent', 'satellite.png', ''),
|
||||
(20, 'Mainframe', 'Mainframe agent', 'so_mainframe.png', ''),
|
||||
(100, 'Cluster', 'Cluster agent', 'so_cluster.png', '');
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
@ -1187,7 +1187,7 @@ INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`
|
||||
|
||||
INSERT INTO `tagent_custom_fields` VALUES (1,'Serial Number',0,0,''),(2,'Department',0,0,''),(3,'Additional ID',0,0,''),(4,'eHorusID',0,0,'');
|
||||
|
||||
INSERT INTO `ttag` VALUES (1,'network','Network equipment','http://artica.es','',''),(2,'critical','Critical modules','','',''),(3,'dmz','DMZ Network Zone','','',''),(4,'performance','Performance anda capacity modules','','',''),(5,'configuration','','','','');
|
||||
INSERT INTO `ttag` VALUES (1,'network','Network equipment','http://artica.es','','',''),(2,'critical','Critical modules','','','',''),(3,'dmz','DMZ Network Zone','','','',''),(4,'performance','Performance anda capacity modules','','','',''),(5,'configuration','','','','','');
|
||||
|
||||
INSERT INTO `tevent_response` VALUES (1,'Ping to host','Ping to the agent host','ping -c 5 _agent_address_','command',0,620,500,0,'',0,90),(3,'Create incident from event','Create a incident from the event with the standard incidents system of Pandora FMS','index.php?sec=workspace&sec2=operation/incidents/incident_detail&insert_form&from_event=_event_id_','url',0,0,0,1,'',0,90),(5,'Restart agent','Restart the agent with using UDP protocol.

To use this response is necessary to have installed Pandora FMS server and console in the same machine.','/usr/share/pandora_server/util/udp_client.pl _agent_address_ 41122 "REFRESH AGENT"','command',0,620,500,0,'',0,90),(6,'Ping to module agent host','Ping to the module agent host','ping -c 5 _module_address_','command',0,620,500,0,'',0,90);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 7.0NG.748-200810
|
||||
Version: 7.0NG.748-200827
|
||||
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.748-200810"
|
||||
pandora_version="7.0NG.748-200827"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.748";
|
||||
my $pandora_build = "200810";
|
||||
my $pandora_build = "200827";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -1018,9 +1018,9 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
||||
$field15 = defined($action->{'field15'}) && $action->{'field15'} ne "" ? $action->{'field15'} : $alert->{'field15'};
|
||||
}
|
||||
else {
|
||||
$field1 = defined($alert->{'field1'}) && $alert->{'field1'} ne "" ? $alert->{'field1'} : $action->{'field1'};
|
||||
$field2 = defined($alert->{'field2'}) && $alert->{'field2'} ne "" ? $alert->{'field2'} : $action->{'field2'};
|
||||
$field3 = defined($alert->{'field3'}) && $alert->{'field3'} ne "" ? $alert->{'field3'} : $action->{'field3'};
|
||||
$field1 = defined($action->{'field1'}) && $action->{'field1'} ne "" ? $action->{'field1'} : $alert->{'field1'};
|
||||
$field2 = defined($action->{'field2'}) && $action->{'field2'} ne "" ? $action->{'field2'} : $alert->{'field2'};
|
||||
$field3 = defined($action->{'field3'}) && $action->{'field3'} ne "" ? $action->{'field3'} : $alert->{'field3'};
|
||||
$field4 = defined($action->{'field4'}) && $action->{'field4'} ne "" ? $action->{'field4'} : $alert->{'field4'};
|
||||
$field5 = defined($action->{'field5'}) && $action->{'field5'} ne "" ? $action->{'field5'} : $alert->{'field5'};
|
||||
$field6 = defined($action->{'field6'}) && $action->{'field6'} ne "" ? $action->{'field6'} : $alert->{'field6'};
|
||||
|
@ -52,8 +52,10 @@ our @EXPORT = qw(
|
||||
db_string
|
||||
db_text
|
||||
db_update
|
||||
db_update_hash
|
||||
db_update_get_values
|
||||
set_update_agent
|
||||
set_update_agentmodule
|
||||
get_action_id
|
||||
get_addr_id
|
||||
get_agent_addr_id
|
||||
@ -912,17 +914,21 @@ sub get_db_rows_limit ($$$;@) {
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
## Updates agent fields using field => value
|
||||
## Be careful, no filter is done.
|
||||
## Updates using hashed data.
|
||||
## $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 {
|
||||
my ($dbh, $agent_id, $data) = @_;
|
||||
sub db_update_hash {
|
||||
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");
|
||||
|
||||
# Build update query
|
||||
my $query = 'UPDATE tagente SET ';
|
||||
my $query = 'UPDATE `'.$tablename.'` SET ';
|
||||
|
||||
my @values;
|
||||
foreach my $field (keys %{$data}) {
|
||||
@ -933,12 +939,50 @@ sub set_update_agent {
|
||||
|
||||
chop($query);
|
||||
|
||||
$query .= ' WHERE id_agente = ? ';
|
||||
push @values, $agent_id;
|
||||
my @keys = keys %{$id};
|
||||
my $k = shift @keys;
|
||||
|
||||
$query .= ' WHERE '.$k.' = ? ';
|
||||
push @values, $id->{$k};
|
||||
|
||||
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.
|
||||
|
@ -633,6 +633,9 @@ sub process_module_data ($$$$$$$$$$) {
|
||||
# Get module parameters, matching column names in tagente_modulo
|
||||
my $module_conf;
|
||||
|
||||
# Extra usable fields but not supported at DB level.
|
||||
my $extra = {};
|
||||
|
||||
# Supported tags
|
||||
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,
|
||||
@ -642,7 +645,9 @@ sub process_module_data ($$$$$$$$$$) {
|
||||
'unknown_instructions' => '', 'tags' => '', 'critical_inverse' => 0, 'warning_inverse' => 0, 'quiet' => 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,
|
||||
'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
|
||||
$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->{'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
|
||||
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)) {
|
||||
@ -825,7 +838,13 @@ sub process_module_data ($$$$$$$$$$) {
|
||||
|
||||
# Update module configuration if in learning mode and not a policy module
|
||||
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!
|
||||
@ -898,8 +917,8 @@ sub get_macros_for_data($$){
|
||||
##########################################################################
|
||||
# Update module configuration in tagente_modulo if necessary.
|
||||
##########################################################################
|
||||
sub update_module_configuration ($$$$) {
|
||||
my ($pa_config, $dbh, $module, $module_conf) = @_;
|
||||
sub update_module_configuration ($$$$$) {
|
||||
my ($pa_config, $dbh, $module, $module_conf, $extra) = @_;
|
||||
|
||||
# Update if at least one of the configuration tokens has changed
|
||||
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->{'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'};
|
||||
|
||||
# Enterprise updates.
|
||||
enterprise_hook('update_module_fields', [$dbh, $pa_config, $module, $extra]);
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
@ -33,7 +33,7 @@ our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.748";
|
||||
my $pandora_build = "200810";
|
||||
my $pandora_build = "200827";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
@ -672,6 +672,24 @@ sub print_module {
|
||||
if (! (empty ($data->{warning_inverse}))) {
|
||||
$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}))) {
|
||||
$xml_module .= "\t<max><![CDATA[" . $data->{max} . "]]></max>\n";
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.748
|
||||
%define release 200810
|
||||
%define release 200827
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.748
|
||||
%define release 200810
|
||||
%define release 200827
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -9,7 +9,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.748"
|
||||
PI_BUILD="200810"
|
||||
PI_BUILD="200827"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
||||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.748 PS200810";
|
||||
my $version = "7.0NG.748 PS200827";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
||||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.748 PS200810";
|
||||
my $version = "7.0NG.748 PS200827";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user