Merge branch 'develop' into ent-3120-Cambio-de-radio-buttons-yes-no-por-checkbox-2-parte

Conflicts:
pandora_console/godmode/setup/setup_auth.php
pandora_console/include/functions_api.php
pandora_console/install.php


Former-commit-id: 70caf6f8d0b99057c55b21c8e3b4317a343923fb
This commit is contained in:
manuel 2019-02-13 12:03:46 +01:00
commit b11d1a6687
30 changed files with 125 additions and 57 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.731-190211
Version: 7.0NG.731-190213
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.731-190211"
pandora_version="7.0NG.731-190213"
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

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.731';
use constant AGENT_BUILD => '190211';
use constant AGENT_BUILD => '190213';
# 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.731
%define release 190211
%define release 190213
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.731"
PI_BUILD="190211"
PI_BUILD="190213"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

@ -945,6 +945,10 @@ if ($update_agent) {
$disabled ? '1' : '0',
]
);
// Validate alerts for disabled agents.
if ($disabled) {
alerts_validate_alert_agent($id_agente);
}
}
if ($tpolicy_group_old) {

View File

@ -205,6 +205,10 @@ if ($update_agents) {
$values['disabled'],
]
);
// Validate alerts for disabled agents.
if ($values['disabled'] == 1) {
alerts_validate_alert_agent($id_agent);
}
}
if ($group_old || $result) {

View File

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

View File

@ -1700,6 +1700,43 @@ function alerts_get_effective_alert_actions($id_agent_module)
}
/**
* Validate alerts for the given module.
*
* @param int agent_module_id ID of the module
*/
function alerts_validate_alert_module($agent_module_id)
{
db_process_sql(
sprintf(
'UPDATE talert_template_modules
SET times_fired=0, internal_counter=0
WHERE id_agent_module = %d',
$agent_module_id
)
);
}
/**
* Validate alerts for the given agent.
*
* @param int agent_id ID of the agent
*/
function alerts_validate_alert_agent($agent_id)
{
db_process_sql(
sprintf(
'UPDATE talert_template_modules tm
INNER JOIN tagente_modulo am ON tm.id_agent_module = am.id_agente_modulo
SET tm.times_fired=0, tm.internal_counter=0
WHERE am.id_agente = %d',
$agent_id
)
);
}
/**
* Validates an alert id or an array of alert id's.
*

View File

@ -472,11 +472,12 @@ function api_get_module_last_value($idAgentModule, $trash1, $other=';', $returnT
DB column mapping table used by tree_agents (and get module_properties)
*/
// agent related field mappings (output field => column designation for 'tagente')
/*
* Agent related field mappings (output field => column designation for 'tagente').
* agent_id is not in this list (because it is mandatory).
* agent_id_group is not in this list.
*/
$agent_field_column_mapping = [
/*
agent_id is not in this list (because it is mandatory) */
// agent_id_group is not in this list
'agent_name' => 'nombre as agent_name',
'agent_direction' => 'direccion as agent_direction',
'agent_comentary' => 'comentarios as agent_comentary',
@ -496,8 +497,8 @@ $agent_field_column_mapping = [
];
// module related field mappings 1/2 (output field => column for 'tagente_modulo')
// module_id_agent_modulo is not in this list
$module_field_column_mampping = [
// module_id_agent_modulo is not in this list
'module_id_agent' => 'id_agente as module_id_agent',
'module_id_module_type' => 'id_tipo_modulo as module_id_module_type',
'module_description' => 'descripcion as module_description',
@ -541,8 +542,8 @@ $module_field_column_mampping = [
];
// module related field mappings 2/2 (output field => column for 'tagente_estado')
// module_id_agent_modulo is not in this list
$estado_fields_to_columns_mapping = [
// module_id_agent_modulo is not in this list
'module_id_agent_state' => 'id_agente_estado as module_id_agent_state',
'module_data' => 'datos as module_data',
'module_timestamp' => 'timestamp as module_timestamp',

View File

@ -329,6 +329,11 @@ function modules_change_disabled($id_agent_module, $new_value=1)
continue;
}
// Validate alerts for disabled modules.
if ($new_value == 1) {
alerts_validate_alert_module($id_module);
}
$id_agent_changed[] = modules_get_agentmodule_agent($id_module);
$id_agent_module_changed[] = $id_module;
}

View File

@ -1183,12 +1183,11 @@ function reporting_SLA(
}
}
// SLA items sorted descending ()
if ($content['top_n'] == 2) {
// SLA items sorted descending ()
arsort($return['data']['']);
}
// SLA items sorted ascending
else if ($content['top_n'] == 1) {
} else if ($content['top_n'] == 1) {
// SLA items sorted ascending
asort($sla_showed_values);
}
@ -6724,7 +6723,7 @@ function reporting_general($report, $content)
'id_agente_modulo',
$row['id_agent_module']
);
$id_module_type = db_get_value('id_tipo_modulo', 'tagente_modulo', 'nombre', $mod_name);
if ($content['period'] == 0) {
$data_res[$index] = modules_get_last_value($row['id_agent_module']);
} else {
@ -6771,16 +6770,31 @@ function reporting_general($report, $content)
$agent_name[$index] = $ag_name;
$module_name[$index] = $mod_name;
$units[$index] = $unit;
$id_module_types[$index] = $id_module_type;
$operations[$index] = $row['operation'];
break;
case REPORT_GENERAL_GROUP_BY_AGENT:
$id_module_types[$index] = $id_module_type;
if ($id_module_types[$index] == 2 || $id_module_types[$index] == 6 || $id_module_types[$index] == 9 || $id_module_types[$index] == 18) {
$data_res[$index] = round($data_res[$index], 0, PHP_ROUND_HALF_DOWN);
}
if ($id_module_types[$index] == 2 || $id_module_types[$index] == 6 || $id_module_types[$index] == 9 || $id_module_types[$index] == 18) {
if ($data_res[$index] == 1) {
$data_res[$index] = 'Up';
} else if ($data_res[$index] == 0) {
$data_res[$index] = 'Down';
}
}
if ($data_res[$index] === false) {
$return['data'][$ag_name][$mod_name] = null;
} else {
if (!is_numeric($data_res[$index])) {
$return['data'][$ag_name][$mod_name] = $data_res[$index];
} else {
hd($data_res[$index], true);
$return['data'][$ag_name][$mod_name] = format_for_graph($data_res[$index], 2).' '.$unit;
}
}
@ -6896,7 +6910,7 @@ function reporting_general($report, $content)
$data['module'] = $module_name[$i];
$data['id_agent_module'] = $id_agent_module[$i];
$data['id_agent'] = agents_get_agent_id_by_module_id($id_agent_module[$i]);
$data['id_module_type'] = $id_module_types[$i];
$data['operator'] = '';
if ($content['period'] != 0) {
switch ($operations[$i]) {

View File

@ -2629,21 +2629,6 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0)
}
function get_agent_first_time($agent_name)
{
$id = agents_get_agent_id($agent_name, true);
$utimestamp = db_get_all_rows_sql(
'SELECT utimestamp FROM tagente_datos WHERE id_agente_modulo IN
(SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = '.$id.')
ORDER BY utimestamp ASC LIMIT 1'
);
$utimestamp = $utimestamp[0]['utimestamp'];
return $utimestamp;
}
function reporting_html_general(&$table, $item)
{
if (!empty($item['data'])) {
@ -2676,6 +2661,16 @@ function reporting_html_general(&$table, $item)
// End - Order by agent
foreach ($item['data'] as $row) {
if ($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) {
$row['formated_value'] = round($row['formated_value'], 0, PHP_ROUND_HALF_DOWN);
}
if (($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) && $row['formated_value'] == 1) {
$row['formated_value'] = 'Up';
} else if (($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) && $row['formated_value'] == 0) {
$row['formated_value'] = 'Down';
}
if ($item['date']['period'] != 0) {
$table1->data[] = [
$row['agent'],
@ -2738,13 +2733,11 @@ function reporting_html_general(&$table, $item)
}
$list_modules = array_keys($list_modules);
$table1->width = '99%';
$table1->data = [];
$table1->head = array_merge([__('Agent')], $list_modules);
foreach ($item['data'] as $agent => $modules) {
$row = [];
$row['agent'] = $agent;
$table1->style['agent'] = 'text-align: center;';
foreach ($list_modules as $name) {
@ -2804,6 +2797,21 @@ function reporting_html_general(&$table, $item)
}
function get_agent_first_time($agent_name)
{
$id = agents_get_agent_id($agent_name, true);
$utimestamp = db_get_all_rows_sql(
'SELECT utimestamp FROM tagente_datos WHERE id_agente_modulo IN
(SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = '.$id.')
ORDER BY utimestamp ASC LIMIT 1'
);
$utimestamp = $utimestamp[0]['utimestamp'];
return $utimestamp;
}
function reporting_html_sql(&$table, $item)
{
if (!$item['correct']) {

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.731-190211
Version: 7.0NG.731-190213
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.731-190211"
pandora_version="7.0NG.731-190213"
package_cpan=0
package_pandora=1

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.731 PS190211";
my $version = "7.0NG.731 PS190213";
# Pandora server configuration
my %conf;
@ -171,11 +171,6 @@ sub pandora_purgedb ($$) {
if (!defined($conf->{'_string_purge'})){
$conf->{'_string_purge'} = 7;
}
# Update alert with last_fired older than today - time_threshold
my @templates = get_db_rows ($dbh, 'SELECT t1.id,t1.time_threshold FROM talert_templates t1 WHERE EXISTS ( SELECT * FROM talert_template_modules t2 WHERE t1.id = t2.id_alert_template );');
foreach my $template(@templates) {
db_do($dbh, 'UPDATE talert_template_modules SET times_fired = 0 WHERE id_alert_template = ? AND times_fired > 0 AND last_fired < (? - ?)',$template->{'id'},time(),$template->{'time_threshold'});
}
if ($conf->{'_string_purge'} > 0) {
$ulimit_access_timestamp = time() - 86400;

View File

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