Merge remote-tracking branch 'origin/develop' into 2078-ue-cmdb-integration

This commit is contained in:
fbsanchez 2018-09-19 11:05:38 +02:00
commit b647bf38fc
30 changed files with 133 additions and 200 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.726-180906
Version: 7.0NG.726-180907
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.726-180906"
pandora_version="7.0NG.726-180907"
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.726';
use constant AGENT_BUILD => '180906';
use constant AGENT_BUILD => '180907';
# 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.726
%define release 180906
%define release 180907
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.726"
PI_BUILD="180906"
PI_BUILD="180907"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

@ -5178,7 +5178,7 @@ function multiDragMouse(eventDrag){
}
function linkedMapStatusCalculationTypeChanged ($linkedMapStatusCalcRow, value) {
if ($linkedMapStatusCalcRow.length === 0 || !validRowOnSelectedItem($linkedMapStatusCalcRow)) return;
if ($linkedMapStatusCalcRow.length === 0) return;
switch (value) {
case "weight":
@ -5215,7 +5215,7 @@ function linkedMapStatusCalculationTypeChanged ($linkedMapStatusCalcRow, value)
}
function linkedMapChanged ($linkedMapRow, value) {
if ($linkedMapRow.length === 0 || !validRowOnSelectedItem($linkedMapRow)) return;
if ($linkedMapRow.length === 0) return;
if (value === 0) {
$linkedMapRow
@ -5229,9 +5229,6 @@ function linkedMapChanged ($linkedMapRow, value) {
.hide();
} else {
var $linkedMapStatusCalcRow = $linkedMapRow.siblings("#linked_map_status_calculation_row");
if (!validRowOnSelectedItem($linkedMapStatusCalcRow)) return;
var calcType = $linkedMapStatusCalcRow.find("select").val();
$linkedMapStatusCalcRow.show();
linkedMapStatusCalculationTypeChanged($linkedMapStatusCalcRow, calcType);
@ -5249,7 +5246,3 @@ function onLinkedMapStatusCalculationTypeChange (event) {
var value = event.target.value || "default";
linkedMapStatusCalculationTypeChanged($linkedMapStatusCalcRow, value);
}
function validRowOnSelectedItem ($element) {
return $element.hasClass(selectedItem);
}

View File

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

View File

@ -2941,15 +2941,18 @@ function group_get_groups_list($id_user = false, $user_strict = false, $access =
function groups_get_group_deep ($id_group) {
global $config;
$parents = groups_get_parents($id_group, false);
$groups = users_get_groups(false, "AR", true, true);
$parents = groups_get_parents($id_group, false, $groups);
if (empty($parents)) {
$deep = "";
}
else {
$deep = str_repeat("  ", count($parents));
}
return $deep;
}

View File

@ -411,111 +411,37 @@ function groupview_monitor_fired_alerts ($group_array, $strict_user = false, $id
AND times_fired > 0");
}
function groupview_get_groups_list($id_user = false, $user_strict = false, $access = 'AR', $force_group_and_tag = true, $returnAllGroup = false) {
global $config;
if ($id_user == false) {
$id_user = $config['id_user'];
}
$acltags = users_get_groups($id_user, $access, true, true);
$result_list = groupview_get_data ($id_user, $user_strict, $acltags,
$returnAllGroup, array(), array(), $access);
return $result_list;
}
function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $returnAllGroup = false, $agent_filter = array(), $module_filter = array(), $access = 'AR') {
function groupview_get_groups_list($id_user = false, $access = 'AR') {
global $config;
if ($id_user == false) {
$id_user = $config['id_user'];
}
$user_groups = array();
$user_tags = array();
$user_groups = users_get_groups($id_user, $access, true, false);
foreach ($acltags as $item) {
$user_groups[$item["id_grupo"]] = $item["nombre"];
if ($item["tags"] != '') {
$tags_group = explode(',', $item["tags"]);
$groups_with_privileges = implode(',', array_keys($user_groups));
foreach ($tags_group as $tag) {
$user_tags[$tag] = tags_get_name($tag);
}
}
}
$groups_with_privileges = implode(',', array_keys($acltags));
//change ALL for 0
$user_groups[0] = 0;
if (!$user_strict)
$acltags[0] = 0;
$user_groups_ids = implode(',', array_keys($user_groups));
$user_groups_ids = implode(',', array_keys($acltags));
if (!empty($user_groups_ids)) {
if (is_metaconsole()) {
switch ($config["dbtype"]) {
case "mysql":
$list_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ")
AND (
id_grupo IN (SELECT id_grupo FROM tmetaconsole_agent WHERE disabled = 0)
OR id_grupo IN (SELECT id_group FROM tmetaconsole_agent_secondary_group WHERE id_group IN (" . $user_groups_ids . "))
)
ORDER BY nombre COLLATE utf8_general_ci ASC");
break;
case "postgresql":
$list_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ")
AND id_grupo IN (SELECT id_grupo FROM tmetaconsole_agent WHERE disabled = 0)
ORDER BY nombre ASC");
break;
case "oracle":
$list_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ")
AND id_grupo IN (SELECT id_grupo FROM tmetaconsole_agent WHERE disabled = 0)
ORDER BY nombre ASC");
break;
}
}
else {
switch ($config["dbtype"]) {
case "mysql":
$list_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ")
AND (
id_grupo IN (SELECT id_grupo FROM tagente WHERE disabled = 0)
OR id_grupo IN (SELECT id_group FROM tagent_secondary_group WHERE id_group IN (" . $user_groups_ids . "))
)
ORDER BY nombre COLLATE utf8_general_ci ASC");
break;
case "postgresql":
$list_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ")
AND id_grupo IN (SELECT id_grupo FROM tagente WHERE disabled = 0)
ORDER BY nombre ASC");
break;
case "oracle":
$list_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $user_groups_ids . ")
AND id_grupo IN (SELECT id_grupo FROM tagente WHERE disabled = 0)
ORDER BY nombre ASC");
break;
}
}
$table = is_metaconsole() ? 'tmetaconsole_agent' : 'tagente';
$table_secondary = is_metaconsole()
? 'tmetaconsole_agent_secondary_group'
: 'tagent_secondary_group';
$list_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN ($user_groups_ids)
AND (
id_grupo IN (SELECT id_grupo FROM $table WHERE disabled = 0)
OR id_grupo IN (SELECT id_group FROM $table_secondary WHERE id_group IN ($user_groups_ids))
)
ORDER BY nombre COLLATE utf8_general_ci ASC"
);
}
//Add the group "All" at first
@ -527,66 +453,64 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
$list_groups = array($group_all);
}
if (!$user_strict) {
//Takes the parents even without agents, first ids
$fathers_id = '';
$list_father_groups = array();
foreach ($list_groups as $group) {
if ($group['parent'] != '') {
$grup = $group['parent'];
while ($grup != 0) {
$recursive_fathers = db_get_row_sql ("SELECT parent FROM tgrupo
WHERE id_grupo = " . $grup);
$grup = $recursive_fathers['parent'];
if (!strpos($fathers_id, $grup)) {
$fathers_id .= ',' . $grup;
}
}
if (!strpos($fathers_id, $group['parent'])) {
$fathers_id .= ',' . $group['parent'];
//Takes the parents even without agents, first ids
$fathers_id = '';
$list_father_groups = array();
foreach ($list_groups as $group) {
if ($group['parent'] != '') {
$grup = $group['parent'];
while ($grup != 0) {
$recursive_fathers = db_get_row_sql ("SELECT parent FROM tgrupo
WHERE id_grupo = " . $grup);
$grup = $recursive_fathers['parent'];
if (!strpos($fathers_id, $grup)) {
$fathers_id .= ',' . $grup;
}
}
}
//Eliminate the first comma
$fathers_id = substr($fathers_id, 1);
while ($fathers_id{0} == ',') {
$fathers_id = substr($fathers_id, 1);
}
//Takes the parents even without agents, complete groups
if ($fathers_id) {
$list_father_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $fathers_id . ")
AND id_grupo IN (" . $groups_with_privileges . ")
ORDER BY nombre COLLATE utf8_general_ci ASC");
if (!empty($list_father_groups)) {
//Merges the arrays and eliminates the duplicates groups
$list_groups = array_merge($list_groups, $list_father_groups);
if (!strpos($fathers_id, $group['parent'])) {
$fathers_id .= ',' . $group['parent'];
}
}
$list_groups = groupview_array_unique_multidim($list_groups, 'id_grupo');
//Order groups (Father-children)
$ordered_groups = groupview_order_groups_for_parents($list_groups);
$ordered_ids = array();
$ordered_ids = groupview_order_group_ids($ordered_groups, $ordered_ids);
$final_list = array();
array_push($final_list, $group_all);
foreach ($ordered_ids as $key) {
if ($key == 'All') {
continue;
}
$complete_group = db_get_row_sql("
SELECT *
FROM tgrupo
WHERE nombre = '" . $key . "'");
array_push($final_list, $complete_group);
}
$list_groups = $final_list;
}
//Eliminate the first comma
$fathers_id = substr($fathers_id, 1);
while ($fathers_id{0} == ',') {
$fathers_id = substr($fathers_id, 1);
}
//Takes the parents even without agents, complete groups
if ($fathers_id) {
$list_father_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $fathers_id . ")
AND id_grupo IN (" . $groups_with_privileges . ")
ORDER BY nombre COLLATE utf8_general_ci ASC");
if (!empty($list_father_groups)) {
//Merges the arrays and eliminates the duplicates groups
$list_groups = array_merge($list_groups, $list_father_groups);
}
}
$list_groups = groupview_array_unique_multidim($list_groups, 'id_grupo');
//Order groups (Father-children)
$ordered_groups = groupview_order_groups_for_parents($list_groups);
$ordered_ids = array();
$ordered_ids = groupview_order_group_ids($ordered_groups, $ordered_ids);
$final_list = array();
array_push($final_list, $group_all);
foreach ($ordered_ids as $key) {
if ($key == 'All') {
continue;
}
$complete_group = db_get_row_sql("
SELECT *
FROM tgrupo
WHERE nombre = '" . $key . "'");
array_push($final_list, $complete_group);
}
$list_groups = $final_list;
$list = array();
foreach ($list_groups as $group) {
$list[$group['id_grupo']]['_name_'] = $group['nombre'];

View File

@ -698,7 +698,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
'percentile_item', 'module_graph', 'simple_value',
'icon', 'label', 'datos', 'donut_graph');
$form_items_advance['map_linked_row']['html'] = '<td align="left">'.
__('Map linked') . '</td>' .
__('Linked map') . '</td>' .
'<td align="left">' . html_print_select_from_sql (
'SELECT id, name
FROM tlayout
@ -710,7 +710,10 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
"service" => __("By critical elements")
);
$form_items_advance['linked_map_status_calculation_row'] = array();
$form_items_advance['linked_map_status_calculation_row']['items'] = array('static_graph');
$form_items_advance['linked_map_status_calculation_row']['items'] = array(
'group_item', 'static_graph', 'percentile_bar',
'percentile_item', 'module_graph', 'simple_value',
'icon', 'label', 'datos', 'donut_graph');
$form_items_advance['linked_map_status_calculation_row']['html'] = '<td align="left">'.
__('Type of the status calculation of the linked map') . '</td>'
. '<td align="left">'
@ -728,35 +731,44 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
. '</td>';
$form_items_advance['map_linked_weight'] = array();
$form_items_advance['map_linked_weight']['items'] = array('static_graph');
$form_items_advance['map_linked_weight']['items'] = array(
'group_item', 'static_graph', 'percentile_bar',
'percentile_item', 'module_graph', 'simple_value',
'icon', 'label', 'datos', 'donut_graph');
$form_items_advance['map_linked_weight']['html'] = '<td align="left">'
. __('Map linked weight') . '</td>'
. __('Linked map weight') . '</td>'
. '<td align="left">'
. html_print_input_text(
'map_linked_weight', 80, '', 3, 3, true, false, false, "", "type_number percentage"
'map_linked_weight', 80, '', 5, 5, true, false, false, "", "type_number percentage"
)
. '<span>%</span>'
. ui_print_help_icon("linked_map_weight", true)
. '</td>';
$form_items_advance['linked_map_status_service_critical_row'] = array();
$form_items_advance['linked_map_status_service_critical_row']['items'] = array('static_graph');
$form_items_advance['linked_map_status_service_critical_row']['items'] = array(
'group_item', 'static_graph', 'percentile_bar',
'percentile_item', 'module_graph', 'simple_value',
'icon', 'label', 'datos', 'donut_graph');
$form_items_advance['linked_map_status_service_critical_row']['html'] = '<td align="left">'
. __('Critical weight') . '</td>'
. '<td align="left">'
. html_print_input_text(
'linked_map_status_service_critical', 80, '', 3, 3, true, false, false, "", "type_number percentage"
'linked_map_status_service_critical', 80, '', 5, 5, true, false, false, "", "type_number percentage"
)
. '<span>%</span>'
. '</td>';
$form_items_advance['linked_map_status_service_warning_row'] = array();
$form_items_advance['linked_map_status_service_warning_row']['items'] = array('static_graph');
$form_items_advance['linked_map_status_service_warning_row']['items'] = array(
'group_item', 'static_graph', 'percentile_bar',
'percentile_item', 'module_graph', 'simple_value',
'icon', 'label', 'datos', 'donut_graph');
$form_items_advance['linked_map_status_service_warning_row']['html'] = '<td align="left">'
. __('Warning weight') . '</td>'
. '<td align="left">'
. html_print_input_text(
'linked_map_status_service_warning', 50, '', 3, 3, true, false, false, "", "type_number percentage"
'linked_map_status_service_warning', 50, '', 5, 5, true, false, false, "", "type_number percentage"
)
. '<span>%</span>'
. '</td>';

View File

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

View File

@ -187,7 +187,7 @@ class Groups {
$user = User::getInstance();
$all_data = groupview_status_modules_agents ($system->getConfig('id_user'), false, 'AR', false);
$result_groups = groupview_get_groups_list($system->getConfig('id_user'), false, 'AR', true, true);
$result_groups = groupview_get_groups_list($system->getConfig('id_user'),'AR');
foreach ($all_data as $group_all_data) {
$result_groups[0]['_total_agents_'] += $group_all_data["_total_agents_"];

View File

@ -69,8 +69,6 @@ else {
// Header
ui_print_page_header (__("Group view"), "images/group.png", false, "", false, $updated_time);
$strict_user = false;
$total_agentes = 0;
$monitor_ok = 0;
$monitor_warning = 0;
@ -83,8 +81,11 @@ $agents_notinit = 0;
$all_alerts_fired = 0;
//Groups and tags
$result_groups = groupview_get_groups_list($config['id_user'], $strict_user,
($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR'), true, true);
$result_groups = groupview_get_groups_list(
$config['id_user'],
($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR')
);
$count = count($result_groups);
if ($result_groups[0]["_id_"] == 0) {

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.726
%define release 180906
%define release 180907
# 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.726
%define release 180906
%define release 180907
%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.726-180906
Version: 7.0NG.726-180907
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.726-180906"
pandora_version="7.0NG.726-180907"
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.726";
my $pandora_build = "180906";
my $pandora_build = "180907";
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.726";
my $pandora_build = "180906";
my $pandora_build = "180907";
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.726
%define release 180906
%define release 180907
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.726"
PI_BUILD="180906"
PI_BUILD="180907"
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.726 PS180906";
my $version = "7.0NG.726 PS180907";
# 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.726 PS180906";
my $version = "7.0NG.726 PS180907";
# save program name for logging
my $progname = basename($0);