Merge branch 'develop' into 1730-missed-enterprise-plugins

This commit is contained in:
fbsanchez 2018-01-18 11:35:19 +01:00
commit 7d4e95f3cb
35 changed files with 90 additions and 76 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.717-180110
Version: 7.0NG.717-180118
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.717
%define release 180110
%define release 180118
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.717
%define release 180110
%define release 180118
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.717"
PI_BUILD="180110"
PI_BUILD="180118"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{180110}
{180118}
ViewReadme
{Yes}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.717-180110
Version: 7.0NG.717-180118
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -13,4 +13,6 @@ ALTER TABLE tcontainer_item ADD COLUMN `fullscale` tinyint(1) UNSIGNED NOT NULL
ALTER TABLE treport_content ADD COLUMN hide_no_data tinyint(1) DEFAULT 0;
COMMIT;
ALTER TABLE tagente_estado ADD COLUMN last_unknown_update bigint(20) NOT NULL default 0;
COMMIT;

View File

@ -1110,6 +1110,7 @@ ALTER TABLE tserver ADD COLUMN `server_keepalive` int(11) DEFAULT 0;
ALTER TABLE tagente_estado MODIFY `status_changes` tinyint(4) unsigned default 0;
ALTER TABLE tagente_estado CHANGE `last_known_status` `known_status` tinyint(4) default 0;
ALTER TABLE tagente_estado ADD COLUMN `last_known_status` tinyint(4) default 0;
ALTER TABLE tagente_estado ADD COLUMN last_unknown_update bigint(20) NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `talert_actions`

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC180110';
$build_version = 'PC180118';
$pandora_version = 'v7.0NG.717';
// Do not overwrite default timezone set if defined.

View File

@ -90,15 +90,8 @@ function cron_next_execution_date ($cron, $cur_time = false, $module_interval =
// Get cron configuration
$cron_array = explode (" ", $cron);
// Months start from 0
if ($cron_array[3] != '*') {
$mon_s = cron_get_interval ($cron_array[3]);
if ($mon_s['up'] !== false) {
$cron_array[3] = $mon_s['down'] - 1 . "-" . $mon_s['up'] - 1;
} else {
$cron_array[3] = $mon_s['down'] - 1;
}
}
// REMARKS: Months start from 1 in php (different to server)
// Get current time
if ($cur_time === false) $cur_time = time();
@ -106,10 +99,6 @@ function cron_next_execution_date ($cron, $cur_time = false, $module_interval =
$nex_time = $cur_time + $module_interval;
$nex_time_array = explode (" ", date ("i H d m Y", $nex_time));
if (cron_is_in_cron($cron_array, $nex_time_array)) return $nex_time;
// Get first next date candidate from next cron configuration
// Initialize some vars
$prev_ovfl = false;
// Update minutes
$min_s = cron_get_interval ($cron_array[0]);
@ -128,7 +117,6 @@ function cron_next_execution_date ($cron, $cur_time = false, $module_interval =
if ($nex_time === false) {
// Update the month day if overflow
$prev_ovfl = true;
$nex_time_array[1] = 0;
$nex_time_array[2]++;
$nex_time = cron_valid_date($nex_time_array);
@ -139,7 +127,7 @@ function cron_next_execution_date ($cron, $cur_time = false, $module_interval =
$nex_time = cron_valid_date($nex_time_array);
if ($nex_time === false) {
#Update the year if overflow
$nex_time_array[3] = 0;
$nex_time_array[3] = 1;
$nex_time_array[4]++;
$nex_time = cron_valid_date($nex_time_array);
}
@ -155,26 +143,24 @@ function cron_next_execution_date ($cron, $cur_time = false, $module_interval =
$nex_time_array[1] = ($hour_s['down'] == '*') ? 0 : $hour_s['down'];
// When an overflow is passed check the hour update again
if ($prev_ovfl) {
$nex_time = cron_valid_date($nex_time_array);
$nex_time = cron_valid_date($nex_time_array);
if ($nex_time >= $cur_time) {
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
return $nex_time;
}
}
$prev_ovfl = false;
// Check if next day is in cron
$nex_time_array[2]++;
$nex_time = cron_valid_date($nex_time_array);
if ($nex_time === false) {
// Update the month if overflow
$prev_ovfl = true;
$nex_time_array[2] = 1;
$nex_time_array[3]++;
$nex_time = cron_valid_date($nex_time_array);
if ($nex_time === false) {
// Update the year if overflow
$nex_time_array[3] = 0;
$nex_time_array[3] = 1;
$nex_time_array[4]++;
$nex_time = cron_valid_date($nex_time_array);
}
@ -189,21 +175,20 @@ function cron_next_execution_date ($cron, $cur_time = false, $module_interval =
$nex_time_array[2] = ($mday_s['down'] == '*') ? 1 : $mday_s['down'];
// When an overflow is passed check the hour update in the next execution
if ($prev_ovfl) {
$nex_time = cron_valid_date($nex_time_array);
$nex_time = cron_valid_date($nex_time_array);
if ($nex_time >= $cur_time) {
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
return $nex_time;
}
}
$prev_ovfl = false;
// Check if next month is in cron
$nex_time_array[3]++;
$nex_time = cron_valid_date($nex_time_array);
if ($nex_time === false) {
#Update the year if overflow
$prev_ovfl = true;
$nex_time_array[3]++;
$nex_time_array[3] = 1;
$nex_time_array[4]++;
$nex_time = cron_valid_date($nex_time_array);
}
@ -214,11 +199,11 @@ function cron_next_execution_date ($cron, $cur_time = false, $module_interval =
// Update the month if fails
$mon_s = cron_get_interval ($cron_array[3]);
$nex_time_array[3] = ($mon_s['down'] == '*') ? 0 : $mon_s['down'];
$nex_time_array[3] = ($mon_s['down'] == '*') ? 1 : $mon_s['down'];
// When an overflow is passed check the hour update in the next execution
if ($prev_ovfl) {
$nex_time = cron_valid_date($nex_time_array);
$nex_time = cron_valid_date($nex_time_array);
if ($nex_time >= $cur_time) {
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
return $nex_time;
}

View File

@ -929,7 +929,7 @@ function html_print_extended_select_for_cron ($hour = '*', $minute = '*', $mday
}
# Months
for ($i = 0; $i < 12; $i++) {
for ($i = 1; $i <= 12; $i++) {
$months[$i] = date('F', mktime (0, 0, 0, $i, 1));
}

View File

@ -3218,7 +3218,13 @@ function draw_elements_graph() {
"id_module_start_" + d.id_module_start + " " +
"id_module_end_" + d.id_module_end;
})
.attr("stroke", function (d) { return d.link_color; })
.attr("stroke", function (d) {
if(d.link_color === undefined) {
return "#999";
} else {
return d.link_color;
}
})
.attr("stroke-width", 3)
.attr("d", null)
.attr('marker-start', function (d) {

View File

@ -544,7 +544,12 @@ if (! isset ($config['id_user'])) {
exit ("</html>");
}
}
if($home_page != 'Visual console'){
header("Location: ".$config['homeurl']."index.php?sec=".$_GET["sec"]."&sec2=".$_GET["sec2"]);
}
else{
header("Location: ".$config['homeurl']."index.php?sec=".$_GET["sec"]);
}
}
// Hash login process
elseif (isset ($_GET["loginhash"])) {

View File

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

View File

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

View File

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

View File

@ -163,6 +163,7 @@ CREATE TABLE IF NOT EXISTS `tagente_estado` (
`last_error` int(4) NOT NULL default '0',
`ff_start_utimestamp` bigint(20) default 0,
`last_dynamic_update` bigint(20) NOT NULL default '0',
`last_unknown_update` bigint(20) NOT NULL default '0',
PRIMARY KEY (`id_agente_estado`),
KEY `status_index_1` (`id_agente_modulo`),
KEY `idx_agente` (`id_agente`),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.717-180110
Version: 7.0NG.717-180118
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -564,6 +564,10 @@ enc_dir /usr/share/pandora_server/enc/
# Go to http://wiki.pandorafms.com/ for more information.
dynamic_updates 5
# Periodically update unknown modules (1), instead of only once (0). Periodic
# updates may affect server performance.
unknown_updates 0
# Enable (1) or disable (0) the Pandora FMS WUX Server (PANDORA FMS ENTERPRISE ONLY).
wuxserver 0

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.717";
my $pandora_build = "180110";
my $pandora_build = "180118";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@ -470,6 +470,8 @@ sub pandora_load_config {
$pa_config->{"thread_log"} = 0; # 7.0.717
$pa_config->{"unknown_updates"} = 0; # 7.0.718
# Check for UID0
if ($pa_config->{"quiet"} != 0){
if ($> == 0){
@ -1081,6 +1083,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^thread_log\s+([0-1])/i) {
$pa_config->{'thread_log'}= clean_blank($1);
}
elsif ($parametro =~ m/^unknown_updates\s+([0-1])/i) {
$pa_config->{'unknown_updates'} = clean_blank($1);
}
} # end of loop for parameter #
# Set to RDBMS' standard port

View File

@ -4835,8 +4835,13 @@ sub pandora_module_unknown ($$) {
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente.disabled = 0
AND tagente_modulo.disabled = 0
AND ((tagente_estado.estado <> 3 AND tagente_modulo.id_tipo_modulo NOT IN (21, 22, 23, 100))
OR (tagente_estado.estado <> 0 AND tagente_modulo.id_tipo_modulo IN (21, 22, 23)))
AND ((tagente_modulo.id_tipo_modulo IN (21, 22, 23) AND tagente_estado.estado <> 0)
OR (' .
($pa_config->{'unknown_updates'} == 0 ?
'tagente_estado.estado <> 3 AND tagente_modulo.id_tipo_modulo NOT IN (21, 22, 23, 100)' :
'tagente_modulo.id_tipo_modulo NOT IN (21, 22, 23, 100) AND tagente_estado.last_unknown_update + tagente_estado.current_interval < UNIX_TIMESTAMP()') .
')
)
AND tagente_estado.utimestamp != 0
AND (tagente_estado.current_interval * ?) + tagente_estado.utimestamp < UNIX_TIMESTAMP()', $pa_config->{'unknown_interval'});
@ -4894,9 +4899,11 @@ sub pandora_module_unknown ($$) {
}
# Regular module
else {
# Set the module state to unknown
logger ($pa_config, "Module " . $module->{'nombre'} . " is going to UNKNOWN", 10);
db_do ($dbh, 'UPDATE tagente_estado SET last_status = 3, estado = 3 WHERE id_agente_estado = ?', $module->{'id_agente_estado'});
# Set the module status to unknown (the module can already be unknown if unknown_updates is enabled).
if ($module->{'estado'} != 3) {
logger ($pa_config, "Module " . $module->{'nombre'} . " is going to UNKNOWN", 10);
db_do ($dbh, 'UPDATE tagente_estado SET last_status = 3, estado = 3, last_unknown_update = ? WHERE id_agente_estado = ?', time(), $module->{'id_agente_estado'});
}
# Get agent information
my $agent = get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE id_agente = ?', $module->{'id_agente'});
@ -4918,7 +4925,8 @@ sub pandora_module_unknown ($$) {
my $do_event;
# Are unknown events enabled?
if ($pa_config->{'unknown_events'} == 0) {
if ($pa_config->{'unknown_events'} == 0 ||
$module->{'estado'} == 3) { # Already in unknown status (unknown_updates is enabled).
$do_event = 0;
}
elsif (!defined($module->{'disabled_types_event'}) || $module->{'disabled_types_event'} eq "") {
@ -4938,7 +4946,7 @@ sub pandora_module_unknown ($$) {
$do_event = 1;
}
}
# Generate event with severity minor
if ($do_event) {
my ($event_type, $severity) = ('going_unknown', 5);

View File

@ -216,9 +216,11 @@ sub data_consumer ($$) {
# Agent and module macros
my %macros = (_agent_ => (defined ($agent)) ? $agent->{'alias'} : '',
_agentalias_ => (defined ($agent)) ? $agent->{'alias'} : '',
_agentdescription_ => (defined ($agent)) ? $agent->{'comentarios'} : '',
_agentstatus_ => undef,
_agentgroup_ => (defined ($group)) ? $group->{'nombre'} : '',
_agentname_ => (defined ($agent)) ? $agent->{'nombre'} : '',
_address_ => (defined ($agent)) ? $agent->{'direccion'} : '',
_module_ => (defined ($module)) ? $module->{'nombre'} : '',
_modulegroup_ => undef,

View File

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

View File

@ -1373,7 +1373,7 @@ sub cron_next_execution_date {
if($mon ne '*') {
my ($mon_down, $mon_up) = cron_get_interval ($mon);
if (defined($mon_up)) {
$mon = $mon_down - 1 . "-" . $mon_up - 1;
$mon = ($mon_down - 1) . "-" . ($mon_up - 1);
} else {
$mon = $mon_down - 1;
}
@ -1395,7 +1395,6 @@ sub cron_next_execution_date {
# Get first next date candidate from next cron configuration
# Initialize some vars
my @nex_time_array = @curr_time_array;
my $prev_ovfl = 0;
# Update minutes
my ($min_down, undef) = cron_get_interval ($min);
@ -1412,7 +1411,6 @@ sub cron_next_execution_date {
if ($nex_time == 0) {
#Update the month day if overflow
$prev_ovfl = 1;
$nex_time_array[1] = 0;
$nex_time_array[2]++;
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
@ -1437,18 +1435,16 @@ sub cron_next_execution_date {
$nex_time_array[1] = ($hour_down eq '*') ? 0 : $hour_down;
# When an overflow is passed check the hour update again
if ($prev_ovfl) {
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
if ($nex_time >= $cur_time) {
return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array);
}
$prev_ovfl = 0;
# Check if next day is in cron
$nex_time_array[2]++;
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
if ($nex_time == 0) {
#Update the month if overflow
$prev_ovfl = 1;
$nex_time_array[2] = 1;
$nex_time_array[3]++;
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
@ -1467,18 +1463,17 @@ sub cron_next_execution_date {
$nex_time_array[2] = ($mday_down eq '*') ? 1 : $mday_down;
# When an overflow is passed check the hour update in the next execution
if ($prev_ovfl) {
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
if ($nex_time >= $cur_time) {
return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array);
}
$prev_ovfl = 0;
# Check if next month is in cron
$nex_time_array[3]++;
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
if ($nex_time == 0) {
#Update the year if overflow
$prev_ovfl = 1;
$nex_time_array[3] = 0;
$cur_year++;
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
}
@ -1488,11 +1483,11 @@ sub cron_next_execution_date {
#Update the month if fails
my ($mon_down, undef) = cron_get_interval ($mon);
$nex_time_array[3] = ($mday_down eq '*') ? 0 : $mday_down;
$nex_time_array[3] = ($mon_down eq '*') ? 0 : $mon_down;
# When an overflow is passed check the hour update in the next execution
if ($prev_ovfl) {
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
if ($nex_time >= $cur_time) {
return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array);
}

View File

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

View File

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

View File

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

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.717 PS180110";
my $version = "7.0NG.717 PS180118";
# Pandora server configuration
my %conf;

View File

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