mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
Merge remote-tracking branch 'origin/develop' into ent-6384-consola-visual-nuevo-elemento-interfaz-de-red
This commit is contained in:
commit
27ba6a3adf
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.750-201027
|
Version: 7.0NG.750-201029
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.750-201027"
|
pandora_version="7.0NG.750-201029"
|
||||||
|
|
||||||
echo "Test if you has the tools for to make the packages."
|
echo "Test if you has the tools for to make the packages."
|
||||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||||
|
@ -55,7 +55,7 @@ my $Sem = undef;
|
|||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.750';
|
use constant AGENT_VERSION => '7.0NG.750';
|
||||||
use constant AGENT_BUILD => '201027';
|
use constant AGENT_BUILD => '201029';
|
||||||
|
|
||||||
# Agent log default file size maximum and instances
|
# Agent log default file size maximum and instances
|
||||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.750
|
%define version 7.0NG.750
|
||||||
%define release 201027
|
%define release 201029
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.750
|
%define version 7.0NG.750
|
||||||
%define release 201027
|
%define release 201029
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.750"
|
PI_VERSION="7.0NG.750"
|
||||||
PI_BUILD="201027"
|
PI_BUILD="201029"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{201027}
|
{201029}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||||||
using namespace Pandora_Strutils;
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define PATH_SIZE _MAX_PATH+1
|
#define PATH_SIZE _MAX_PATH+1
|
||||||
#define PANDORA_VERSION ("7.0NG.750(Build 201027)")
|
#define PANDORA_VERSION ("7.0NG.750(Build 201029)")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
@ -11,7 +11,7 @@ BEGIN
|
|||||||
VALUE "LegalCopyright", "Artica ST"
|
VALUE "LegalCopyright", "Artica ST"
|
||||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||||
VALUE "ProductVersion", "(7.0NG.750(Build 201027))"
|
VALUE "ProductVersion", "(7.0NG.750(Build 201029))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.750-201027
|
Version: 7.0NG.750-201029
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.750-201027"
|
pandora_version="7.0NG.750-201029"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -668,7 +668,7 @@ function mainAgentsModules()
|
|||||||
if ($recursion) {
|
if ($recursion) {
|
||||||
$filter_groups['id_grupo'] = array_merge(
|
$filter_groups['id_grupo'] = array_merge(
|
||||||
$group_id,
|
$group_id,
|
||||||
groups_get_id_recursive($group_id, true)
|
groups_get_children_ids($group_id, true)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$filter_groups['id_grupo'] = $group_id;
|
$filter_groups['id_grupo'] = $group_id;
|
||||||
|
@ -86,7 +86,6 @@ function mainModuleGroups()
|
|||||||
);
|
);
|
||||||
$info = $tree_group->getArray();
|
$info = $tree_group->getArray();
|
||||||
$info = groupview_plain_groups($info);
|
$info = groupview_plain_groups($info);
|
||||||
$counter = count($info);
|
|
||||||
$offset = get_parameter('offset', 0);
|
$offset = get_parameter('offset', 0);
|
||||||
$agent_group_search = get_parameter('agent_group_search', '');
|
$agent_group_search = get_parameter('agent_group_search', '');
|
||||||
$module_group_search = get_parameter('module_group_search', '');
|
$module_group_search = get_parameter('module_group_search', '');
|
||||||
@ -134,6 +133,8 @@ function mainModuleGroups()
|
|||||||
$ids_group = -1;
|
$ids_group = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$counter = count($info);
|
||||||
|
|
||||||
$condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT);
|
$condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT);
|
||||||
$condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT);
|
$condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT);
|
||||||
$condition_unknown = modules_get_state_condition(AGENT_MODULE_STATUS_UNKNOWN);
|
$condition_unknown = modules_get_state_condition(AGENT_MODULE_STATUS_UNKNOWN);
|
||||||
|
@ -408,7 +408,7 @@ if ($ag_group > 0) {
|
|||||||
$ag_groups = [];
|
$ag_groups = [];
|
||||||
$ag_groups = (array) $ag_group;
|
$ag_groups = (array) $ag_group;
|
||||||
if ($recursion) {
|
if ($recursion) {
|
||||||
$ag_groups = groups_get_id_recursive($ag_group, true);
|
$ag_groups = groups_get_children_ids($ag_group, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_groups_to_sql = implode(',', $ag_groups);
|
$user_groups_to_sql = implode(',', $ag_groups);
|
||||||
|
@ -877,7 +877,7 @@ if ($id_downtime > 0) {
|
|||||||
$filter_cond = '';
|
$filter_cond = '';
|
||||||
if ($filter_group > 0) {
|
if ($filter_group > 0) {
|
||||||
if ($recursion) {
|
if ($recursion) {
|
||||||
$rg = groups_get_id_recursive($filter_group, true);
|
$rg = groups_get_children_ids($filter_group, true);
|
||||||
$filter_cond .= ' AND id_grupo IN (';
|
$filter_cond .= ' AND id_grupo IN (';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
@ -131,7 +131,7 @@ if (check_acl($config['id_user'], 0, 'LM')) {
|
|||||||
|
|
||||||
$table->data[2][0] = __('Template');
|
$table->data[2][0] = __('Template');
|
||||||
$own_info = get_user_info($config['id_user']);
|
$own_info = get_user_info($config['id_user']);
|
||||||
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
if ($own_info['is_admin']) {
|
||||||
$templates = alerts_get_alert_templates(false, ['id', 'name']);
|
$templates = alerts_get_alert_templates(false, ['id', 'name']);
|
||||||
} else {
|
} else {
|
||||||
$usr_groups = users_get_groups($config['id_user'], 'LW', true);
|
$usr_groups = users_get_groups($config['id_user'], 'LW', true);
|
||||||
|
@ -168,7 +168,15 @@ if ($id_group) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$table->data[2][1] = '<div class="w250px inline">';
|
$table->data[2][1] = '<div class="w250px inline">';
|
||||||
$table->data[2][1] .= html_print_select_groups(false, 'AR', true, 'id_parent', $id_parent, '', '', '', true);
|
$table->data[2][1] .= html_print_input(
|
||||||
|
[
|
||||||
|
'type' => 'select_groups',
|
||||||
|
'name' => 'id_parent',
|
||||||
|
'selected' => $id_parent,
|
||||||
|
'return' => true,
|
||||||
|
'returnAllGroup' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
$table->data[2][1] .= '</div>';
|
$table->data[2][1] .= '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ if (is_ajax()) {
|
|||||||
$keys_prefix = (string) get_parameter('keys_prefix', '');
|
$keys_prefix = (string) get_parameter('keys_prefix', '');
|
||||||
|
|
||||||
if ($recursion) {
|
if ($recursion) {
|
||||||
$groups = groups_get_id_recursive($id_group, true);
|
$groups = groups_get_children_ids($id_group, true);
|
||||||
} else {
|
} else {
|
||||||
$groups = [$id_group];
|
$groups = [$id_group];
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ if ($id_modulo === COMPONENT_TYPE_WIZARD) {
|
|||||||
if ($execution_type === EXECUTION_TYPE_PLUGIN || $module_protocol === 'wmi') {
|
if ($execution_type === EXECUTION_TYPE_PLUGIN || $module_protocol === 'wmi') {
|
||||||
// Search all parameters received with extra_fields.
|
// Search all parameters received with extra_fields.
|
||||||
foreach ($_REQUEST as $parameter => $thisValue) {
|
foreach ($_REQUEST as $parameter => $thisValue) {
|
||||||
// Extra fields (OIDs Macros or WMI Extra fields)
|
// Extra fields (OIDs Macros or WMI Extra fields).
|
||||||
if (preg_match('/extra_field_'.$module_protocol.'_/', $parameter) !== 0) {
|
if (preg_match('/extra_field_'.$module_protocol.'_/', $parameter) !== 0) {
|
||||||
$tmpParameter = explode('_', $parameter);
|
$tmpParameter = explode('_', $parameter);
|
||||||
$extra_fields['extra_field_'.$tmpParameter[3]] = get_parameter($parameter);
|
$extra_fields['extra_field_'.$tmpParameter[3]] = get_parameter($parameter);
|
||||||
@ -330,7 +330,7 @@ if ($create_component) {
|
|||||||
|
|
||||||
if ($name && !$name_check) {
|
if ($name && !$name_check) {
|
||||||
$id = network_components_create_network_component(
|
$id = network_components_create_network_component(
|
||||||
strip_tags(io_safe_input($name), '<br>'),
|
$name,
|
||||||
$type,
|
$type,
|
||||||
$id_group,
|
$id_group,
|
||||||
[
|
[
|
||||||
@ -431,7 +431,7 @@ if ($update_component) {
|
|||||||
$id,
|
$id,
|
||||||
[
|
[
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'name' => strip_tags(io_safe_input($name, '<br>')),
|
'name' => $name,
|
||||||
'id_group' => $id_group,
|
'id_group' => $id_group,
|
||||||
'description' => $description,
|
'description' => $description,
|
||||||
'module_interval' => $module_interval,
|
'module_interval' => $module_interval,
|
||||||
|
@ -278,7 +278,7 @@ if ($ag_group > 0) {
|
|||||||
$ag_groups = [];
|
$ag_groups = [];
|
||||||
$ag_groups = (array) $ag_group;
|
$ag_groups = (array) $ag_group;
|
||||||
if ($recursion) {
|
if ($recursion) {
|
||||||
$ag_groups = groups_get_id_recursive($ag_group, true);
|
$ag_groups = groups_get_children_ids($ag_group, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,8 +223,9 @@ switch ($action) {
|
|||||||
$server_name = $item['server_name'];
|
$server_name = $item['server_name'];
|
||||||
|
|
||||||
// Metaconsole db connection.
|
// Metaconsole db connection.
|
||||||
if ($meta && !empty($server_name)) {
|
if ($meta && empty($server_name) === false) {
|
||||||
$connection = metaconsole_get_connection($server_name);
|
$connection = metaconsole_get_connection($server_name);
|
||||||
|
$server_id = $connection['id'];
|
||||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
if (metaconsole_load_external_db($connection) != NOERR) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1383,8 +1384,7 @@ $class = 'databox filters';
|
|||||||
|
|
||||||
html_print_input_hidden('id_agent', $idAgent);
|
html_print_input_hidden('id_agent', $idAgent);
|
||||||
html_print_input_hidden('server_name', $server_name);
|
html_print_input_hidden('server_name', $server_name);
|
||||||
html_print_input_hidden('server_id', $server_name);
|
html_print_input_hidden('server_id', $server_id);
|
||||||
html_print_input_hidden('id_server', '');
|
|
||||||
|
|
||||||
$params = [];
|
$params = [];
|
||||||
$params['show_helptip'] = false;
|
$params['show_helptip'] = false;
|
||||||
@ -3744,6 +3744,16 @@ $(document).ready (function () {
|
|||||||
|
|
||||||
$("#combo_group").change (
|
$("#combo_group").change (
|
||||||
function () {
|
function () {
|
||||||
|
|
||||||
|
// Alert report group must show all matches when selecting All group
|
||||||
|
// ignoring 'recursion' option. #6497.
|
||||||
|
if ($("#combo_group").val() == 0) {
|
||||||
|
$('#checkbox-recursion').attr('disabled',true)
|
||||||
|
$('#checkbox-recursion').attr('checked','checked')
|
||||||
|
} else {
|
||||||
|
$('#checkbox-recursion').removeAttr('disabled')
|
||||||
|
}
|
||||||
|
|
||||||
$("#id_agents").html('');
|
$("#id_agents").html('');
|
||||||
$("#id_agents2").html('');
|
$("#id_agents2").html('');
|
||||||
$("#module").html('');
|
$("#module").html('');
|
||||||
@ -3772,6 +3782,7 @@ $(document).ready (function () {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
$("#combo_group").change();
|
||||||
|
|
||||||
$("#checkbox-recursion").change (
|
$("#checkbox-recursion").change (
|
||||||
function () {
|
function () {
|
||||||
|
@ -1380,11 +1380,12 @@ switch ($action) {
|
|||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'update':
|
case 'update':
|
||||||
$values = [];
|
$values = [];
|
||||||
$server_name = get_parameter('server_id');
|
$server_id = get_parameter('server_id', 0);
|
||||||
if (is_metaconsole() && $server_name != '') {
|
if (is_metaconsole() === true
|
||||||
$id_meta = metaconsole_get_id_server($server_name);
|
&& empty($server_id) === false
|
||||||
|
) {
|
||||||
$connection = metaconsole_get_connection_by_id(
|
$connection = metaconsole_get_connection_by_id(
|
||||||
$id_meta
|
$server_id
|
||||||
);
|
);
|
||||||
metaconsole_connect($connection);
|
metaconsole_connect($connection);
|
||||||
$values['server_name'] = $connection['server_name'];
|
$values['server_name'] = $connection['server_name'];
|
||||||
@ -1811,7 +1812,6 @@ switch ($action) {
|
|||||||
'combo_modulegroup'
|
'combo_modulegroup'
|
||||||
);
|
);
|
||||||
$values['id_group'] = get_parameter('combo_group');
|
$values['id_group'] = get_parameter('combo_group');
|
||||||
$values['server_name'] = get_parameter('server_name');
|
|
||||||
|
|
||||||
if ($values['server_name'] == '') {
|
if ($values['server_name'] == '') {
|
||||||
$values['server_name'] = get_parameter(
|
$values['server_name'] = get_parameter(
|
||||||
@ -1867,9 +1867,7 @@ switch ($action) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// If metaconsole is activated.
|
// If metaconsole is activated.
|
||||||
if ($config['metaconsole'] == 1
|
if (is_metaconsole() === true) {
|
||||||
&& defined('METACONSOLE')
|
|
||||||
) {
|
|
||||||
if (($values['type'] == 'custom_graph')
|
if (($values['type'] == 'custom_graph')
|
||||||
|| ($values['type'] == 'automatic_custom_graph')
|
|| ($values['type'] == 'automatic_custom_graph')
|
||||||
) {
|
) {
|
||||||
|
@ -143,7 +143,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
|
|||||||
$ag_groups = [];
|
$ag_groups = [];
|
||||||
$ag_groups = (array) $ag_group;
|
$ag_groups = (array) $ag_group;
|
||||||
if ($recursion) {
|
if ($recursion) {
|
||||||
$ag_groups = groups_get_id_recursive($ag_group, true);
|
$ag_groups = groups_get_children_ids($ag_group, true);
|
||||||
}
|
}
|
||||||
} else if ($own_info['is_admin']) {
|
} else if ($own_info['is_admin']) {
|
||||||
$returnAllGroups = 1;
|
$returnAllGroups = 1;
|
||||||
|
@ -1313,6 +1313,7 @@ $(document).ready (function () {
|
|||||||
|
|
||||||
var img_delete = '<?php echo $delete_image; ?>';
|
var img_delete = '<?php echo $delete_image; ?>';
|
||||||
var id_user = '<?php echo io_safe_output($id); ?>';
|
var id_user = '<?php echo io_safe_output($id); ?>';
|
||||||
|
var is_metaconsole = '<?php echo $meta; ?>';
|
||||||
var data = [];
|
var data = [];
|
||||||
|
|
||||||
$('input:image[name="add"]').click(function (e) {
|
$('input:image[name="add"]').click(function (e) {
|
||||||
@ -1357,7 +1358,7 @@ $(document).ready (function () {
|
|||||||
$('input:image[name="del"]').click(function (e) {
|
$('input:image[name="del"]').click(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var rows = $("#table_profiles tr").length;
|
var rows = $("#table_profiles tr").length;
|
||||||
if (rows <= 3) {
|
if ((is_metaconsole === '1' && rows <= 4) || (is_metaconsole === '' && rows <= 3)) {
|
||||||
if (!confirm('<?php echo __('Deleting last profile will delete this user'); ?>' + '. ' + '<?php echo __('Are you sure?'); ?>')) {
|
if (!confirm('<?php echo __('Deleting last profile will delete this user'); ?>' + '. ' + '<?php echo __('Are you sure?'); ?>')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1379,7 +1380,7 @@ $(document).ready (function () {
|
|||||||
success: function (data) {
|
success: function (data) {
|
||||||
row.remove();
|
row.remove();
|
||||||
var rows = $("#table_profiles tr").length;
|
var rows = $("#table_profiles tr").length;
|
||||||
if (rows <= 2) {
|
if ((is_metaconsole === '1' && rows <= 3) || (is_metaconsole === '' && rows <= 2)) {
|
||||||
window.location.replace("<?php echo ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure=0', false, false, false); ?>");
|
window.location.replace("<?php echo ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure=0', false, false, false); ?>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1389,7 +1390,7 @@ $(document).ready (function () {
|
|||||||
$('#submit-crtbutton').click(function (e) {
|
$('#submit-crtbutton').click(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var rows = $("#table_profiles tr").length;
|
var rows = $("#table_profiles tr").length;
|
||||||
if (rows <= 2) {
|
if ((is_metaconsole === '1' && rows <= 3) || (is_metaconsole === '' && rows <= 2)) {
|
||||||
alert('<?php echo __('please add a profile'); ?>');
|
alert('<?php echo __('please add a profile'); ?>');
|
||||||
} else {
|
} else {
|
||||||
this.form.submit();
|
this.form.submit();
|
||||||
|
@ -1170,6 +1170,380 @@ class HostDevices extends Wizard
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Input: SNMP enabled.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => __('SNMP enabled'),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'snmp_enabled',
|
||||||
|
'type' => 'switch',
|
||||||
|
'return' => true,
|
||||||
|
'value' => (isset($this->task['snmp_enabled'])) ? $this->task['snmp_enabled'] : 1,
|
||||||
|
'onclick' => 'extraSNMP();',
|
||||||
|
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// SNMP CONFIGURATION.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'hidden' => 1,
|
||||||
|
'block_id' => 'snmp_extra',
|
||||||
|
'class' => 'indented',
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => __('SNMP version'),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'snmp_version',
|
||||||
|
'fields' => [
|
||||||
|
'1' => 'v. 1',
|
||||||
|
'2c' => 'v. 2c',
|
||||||
|
'3' => 'v. 3',
|
||||||
|
],
|
||||||
|
'type' => 'select',
|
||||||
|
'script' => 'SNMPExtraShow(this.value)',
|
||||||
|
'selected' => $this->task['snmp_version'],
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// SNMP Options pack v1.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'hidden' => 1,
|
||||||
|
'block_id' => 'snmp_options_basic',
|
||||||
|
'class' => 'indented',
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => __('SNMP communities to try with').ui_print_help_tip(
|
||||||
|
__(
|
||||||
|
'You can specify several values, separated by commas, for example: public,mysecret,1234'
|
||||||
|
),
|
||||||
|
true
|
||||||
|
),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'community',
|
||||||
|
'type' => 'text',
|
||||||
|
'value' => $this->task['snmp_community'],
|
||||||
|
'size' => 25,
|
||||||
|
'return' => true,
|
||||||
|
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// SNMP Options pack v3.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'hidden' => 1,
|
||||||
|
'block_id' => 'snmp_options_v3',
|
||||||
|
'class' => 'indented',
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => '<b>'.__('Context').'</b>',
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'snmp_context',
|
||||||
|
'type' => 'text',
|
||||||
|
'value' => $this->task['snmp_community'],
|
||||||
|
'size' => 15,
|
||||||
|
'return' => true,
|
||||||
|
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => '<b>'.__('Auth user').'</b>',
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'snmp_auth_user',
|
||||||
|
'type' => 'text',
|
||||||
|
'value' => $this->task['snmp_auth_user'],
|
||||||
|
'size' => 15,
|
||||||
|
'return' => true,
|
||||||
|
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => '<b>'.__('Auth password').'</b>'.ui_print_help_tip(
|
||||||
|
__(
|
||||||
|
'The pass length must be eight character minimum.'
|
||||||
|
),
|
||||||
|
true
|
||||||
|
),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'snmp_auth_pass',
|
||||||
|
'type' => 'password',
|
||||||
|
'value' => $this->task['snmp_auth_pass'],
|
||||||
|
'size' => 15,
|
||||||
|
'return' => true,
|
||||||
|
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => '<b>'.__('Privacy method').'</b>',
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'snmp_privacy_method',
|
||||||
|
'type' => 'select',
|
||||||
|
'fields' => [
|
||||||
|
'DES' => __('DES'),
|
||||||
|
'AES' => __('AES'),
|
||||||
|
],
|
||||||
|
'selected' => $this->task['snmp_privacy_method'],
|
||||||
|
'size' => 15,
|
||||||
|
'return' => true,
|
||||||
|
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => '<b>'.__('Privacy pass').'</b>'.ui_print_help_tip(
|
||||||
|
__(
|
||||||
|
'The pass length must be eight character minimum.'
|
||||||
|
),
|
||||||
|
true
|
||||||
|
),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'snmp_privacy_pass',
|
||||||
|
'type' => 'password',
|
||||||
|
'value' => $this->task['snmp_privacy_pass'],
|
||||||
|
'size' => 15,
|
||||||
|
'return' => true,
|
||||||
|
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => '<b>'.__('Auth method').'</b>',
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'snmp_auth_method',
|
||||||
|
'type' => 'select',
|
||||||
|
'fields' => [
|
||||||
|
'MD5' => __('MD5'),
|
||||||
|
'SHA' => __('SHA'),
|
||||||
|
],
|
||||||
|
'selected' => $this->task['snmp_auth_method'],
|
||||||
|
'size' => 15,
|
||||||
|
'return' => true,
|
||||||
|
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => '<b>'.__('Security level').'</b>',
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'snmp_security_level',
|
||||||
|
'type' => 'select',
|
||||||
|
'fields' => [
|
||||||
|
'noAuthNoPriv' => __('Not auth and not privacy method'),
|
||||||
|
'authNoPriv' => __('Auth and not privacy method'),
|
||||||
|
'authPriv' => __('Auth and privacy method'),
|
||||||
|
],
|
||||||
|
'selected' => $this->task['snmp_security_level'],
|
||||||
|
'size' => 15,
|
||||||
|
'return' => true,
|
||||||
|
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Input: Enforce os detection.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => __('OS detection'),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'os_detect',
|
||||||
|
'type' => 'switch',
|
||||||
|
'return' => true,
|
||||||
|
'value' => (isset($this->task['os_detect'])) ? $this->task['os_detect'] : 1,
|
||||||
|
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Input: Name resolution.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => __('Name resolution'),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'resolve_names',
|
||||||
|
'type' => 'switch',
|
||||||
|
'return' => true,
|
||||||
|
'value' => (isset($this->task['resolve_names'])) ? $this->task['resolve_names'] : 1,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Input: Parent detection.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => __('Parent detection'),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'parent_detection',
|
||||||
|
'type' => 'switch',
|
||||||
|
'return' => true,
|
||||||
|
'value' => (isset($this->task['parent_detection'])) ? $this->task['parent_detection'] : 1,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Input: Parent recursion.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => __('Parent recursion'),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'parent_recursion',
|
||||||
|
'type' => 'switch',
|
||||||
|
'return' => true,
|
||||||
|
'value' => (isset($this->task['parent_recursion'])) ? $this->task['parent_recursion'] : 1,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Input: VLAN enabled.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => __('VLAN enabled'),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'vlan_enabled',
|
||||||
|
'type' => 'switch',
|
||||||
|
'return' => true,
|
||||||
|
'value' => (isset($this->task['vlan_enabled'])) ? $this->task['vlan_enabled'] : 1,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Input: WMI enabled.
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'label' => __('WMI enabled'),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'wmi_enabled',
|
||||||
|
'type' => 'switch',
|
||||||
|
'value' => (isset($this->task['wmi_enabled'])) ? $this->task['wmi_enabled'] : 0,
|
||||||
|
'return' => true,
|
||||||
|
'onclick' => 'toggleAuth();',
|
||||||
|
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// AUTH CONFIGURATION.
|
||||||
|
$show_auth = false;
|
||||||
|
if ((isset($this->task['wmi_enabled']) && $this->task['wmi_enabled'] > 0)
|
||||||
|
|| (isset($this->task['rcmd_enabled']) && $this->task['rcmd_enabled'] > 0)
|
||||||
|
) {
|
||||||
|
$show_auth = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once $config['homedir'].'/include/class/CredentialStore.class.php';
|
||||||
|
$available_keys = CredentialStore::getKeys('CUSTOM');
|
||||||
|
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||||
|
$link_to_cs = '<a class="ext_link" href="'.ui_get_full_url(
|
||||||
|
'index.php?sec=gagente&sec2=godmode/groups/group_list&tab=credbox'
|
||||||
|
).'" >';
|
||||||
|
$link_to_cs .= __('No credentials available').', ';
|
||||||
|
$link_to_cs .= strtolower(__('Manage credentials')).'</a>';
|
||||||
|
} else {
|
||||||
|
$link_to_cs = __('No credentials available');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($available_keys) > 0) {
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'block_id' => 'auth_block',
|
||||||
|
'class' => 'indented',
|
||||||
|
'hidden' => !$show_auth,
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => __('Credentials to try with'),
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'select',
|
||||||
|
'name' => 'auth_strings[]',
|
||||||
|
'fields' => CredentialStore::getKeys('CUSTOM'),
|
||||||
|
'selected' => explode(
|
||||||
|
',',
|
||||||
|
$this->task['auth_strings']
|
||||||
|
),
|
||||||
|
|
||||||
|
'multiple' => true,
|
||||||
|
'class' => 'select_multiple',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$form['inputs'][] = [
|
||||||
|
'block_id' => 'auth_block',
|
||||||
|
'class' => 'indented',
|
||||||
|
'hidden' => !$show_auth,
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => __('Credentials'),
|
||||||
|
'extra' => $link_to_cs,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_require_jquery_file('tag-editor.min');
|
||||||
|
ui_require_jquery_file('caret.min');
|
||||||
|
ui_require_css_file('jquery.tag-editor');
|
||||||
|
|
||||||
|
$form['js'] = '
|
||||||
|
$(\'#text-community\').tagEditor({
|
||||||
|
forceLowercase: false
|
||||||
|
});
|
||||||
|
|
||||||
|
function SNMPExtraShow(target) {
|
||||||
|
$("#snmp_options_basic").hide();
|
||||||
|
$("#snmp_options_v3").hide();
|
||||||
|
if (document.getElementsByName("snmp_enabled")[0].checked) {
|
||||||
|
$("#snmp_extra").show();
|
||||||
|
if (target == 3) {
|
||||||
|
$("#snmp_options_v3").show();
|
||||||
|
} else {
|
||||||
|
$("#snmp_options_basic").show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function extraSNMP() {
|
||||||
|
if (document.getElementsByName("snmp_enabled")[0].checked) {
|
||||||
|
SNMPExtraShow($("#snmp_version").val());
|
||||||
|
$("#snmp_extra").show();
|
||||||
|
|
||||||
|
// Enable snmp dependant checks
|
||||||
|
if (!document.getElementsByName("parent_recursion")[0].checked)
|
||||||
|
$("input[name=parent_recursion]").click();
|
||||||
|
|
||||||
|
if (!document.getElementsByName("parent_detection")[0].checked)
|
||||||
|
$("input[name=parent_detection]").click();
|
||||||
|
|
||||||
|
if (!document.getElementsByName("resolve_names")[0].checked)
|
||||||
|
$("input[name=resolve_names]").click();
|
||||||
|
|
||||||
|
if (!document.getElementsByName("vlan_enabled")[0].checked)
|
||||||
|
$("input[name=vlan_enabled]").click();
|
||||||
|
} else {
|
||||||
|
// Hide unusable sections
|
||||||
|
$("#snmp_extra").hide();
|
||||||
|
$("#snmp_options_basic").hide();
|
||||||
|
$("#snmp_options_v3").hide();
|
||||||
|
|
||||||
|
// Disable snmp dependant checks
|
||||||
|
if (document.getElementsByName("parent_recursion")[0].checked)
|
||||||
|
$("input[name=parent_recursion]").click();
|
||||||
|
|
||||||
|
if (document.getElementsByName("parent_detection")[0].checked)
|
||||||
|
$("input[name=parent_detection]").click();
|
||||||
|
|
||||||
|
if (document.getElementsByName("resolve_names")[0].checked)
|
||||||
|
$("input[name=resolve_names]").click();
|
||||||
|
|
||||||
|
if (document.getElementsByName("vlan_enabled")[0].checked)
|
||||||
|
$("input[name=vlan_enabled]").click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleAuth() {
|
||||||
|
if (document.getElementsByName("wmi_enabled")[0].checked
|
||||||
|
|| (typeof document.getElementsByName("rcmd_enabled")[0] != "undefined"
|
||||||
|
&& document.getElementsByName("rcmd_enabled")[0].checked)
|
||||||
|
) {
|
||||||
|
$("#auth_block").show();
|
||||||
|
} else {
|
||||||
|
$("#auth_block").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
SNMPExtraShow($("#snmp_version").val());
|
||||||
|
});
|
||||||
|
';
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
// Feature configuration.
|
// Feature configuration.
|
||||||
$extra = enterprise_hook('hd_showextrainputs', [$this]);
|
$extra = enterprise_hook('hd_showextrainputs', [$this]);
|
||||||
@ -1178,7 +1552,7 @@ class HostDevices extends Wizard
|
|||||||
$form['inputs'],
|
$form['inputs'],
|
||||||
$extra['inputs']
|
$extra['inputs']
|
||||||
);
|
);
|
||||||
$form['js'] = $extra['js'];
|
$form['js'] .= $extra['js'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
|
|||||||
} else if ($search_agents && is_metaconsole()) {
|
} else if ($search_agents && is_metaconsole()) {
|
||||||
$id_agent = (int) get_parameter('id_agent');
|
$id_agent = (int) get_parameter('id_agent');
|
||||||
$string = (string) get_parameter('q');
|
$string = (string) get_parameter('q');
|
||||||
// q is what autocomplete plugin gives
|
// Q is what autocomplete plugin gives.
|
||||||
$id_group = (int) get_parameter('id_group', -1);
|
$id_group = (int) get_parameter('id_group', -1);
|
||||||
$addedItems = html_entity_decode((string) get_parameter('add'));
|
$addedItems = html_entity_decode((string) get_parameter('add'));
|
||||||
$addedItems = json_decode($addedItems);
|
$addedItems = json_decode($addedItems);
|
||||||
@ -236,6 +236,7 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
|
|||||||
'alias',
|
'alias',
|
||||||
'direccion',
|
'direccion',
|
||||||
'id_tmetaconsole_setup AS id_server',
|
'id_tmetaconsole_setup AS id_server',
|
||||||
|
'server_name',
|
||||||
];
|
];
|
||||||
|
|
||||||
$filter = [];
|
$filter = [];
|
||||||
@ -254,36 +255,33 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
|
|||||||
case 'enabled':
|
case 'enabled':
|
||||||
$filter['disabled'] = 0;
|
$filter['disabled'] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Not possible.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($id_agent)) {
|
if (empty($id_agent) === false) {
|
||||||
$filter['id_agente'] = $id_agent;
|
$filter['id_agente'] = $id_agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($string)) {
|
if (empty($string) === false) {
|
||||||
// Get agents for only the alias.
|
// Get agents for only the alias.
|
||||||
$filter_alias = $filter;
|
$filter_alias = $filter;
|
||||||
switch ($config['dbtype']) {
|
$filter_alias[] = '(alias COLLATE utf8_general_ci LIKE "%'.$string.'%")';
|
||||||
case 'mysql':
|
|
||||||
$filter_alias[] = '(alias COLLATE utf8_general_ci LIKE "%'.$string.'%")';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'postgresql':
|
$agents = db_get_all_rows_filter(
|
||||||
$filter_alias[] = '(alias LIKE \'%'.$string.'%\')';
|
'tmetaconsole_agent',
|
||||||
break;
|
$filter_alias,
|
||||||
|
$fields
|
||||||
|
);
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$filter_alias[] = '(UPPER(alias) LIKE UPPER(\'%'.$string.'%\'))';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_alias, $fields);
|
|
||||||
if ($agents !== false) {
|
if ($agents !== false) {
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'id' => $agent['id_agente'],
|
'id' => $agent['id_agente'],
|
||||||
'name' => io_safe_output($agent['nombre']),
|
'name' => io_safe_output($agent['nombre']),
|
||||||
'alias' => io_safe_output($agent['alias']),
|
'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')',
|
||||||
'ip' => io_safe_output($agent['direccion']),
|
'ip' => io_safe_output($agent['direccion']),
|
||||||
'id_server' => $agent['id_server'],
|
'id_server' => $agent['id_server'],
|
||||||
'filter' => 'alias',
|
'filter' => 'alias',
|
||||||
@ -293,27 +291,20 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
|
|||||||
|
|
||||||
// Get agents for only the name.
|
// Get agents for only the name.
|
||||||
$filter_agents = $filter;
|
$filter_agents = $filter;
|
||||||
switch ($config['dbtype']) {
|
$filter_agents[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci LIKE "%'.$string.'%")';
|
||||||
case 'mysql':
|
|
||||||
$filter_agents[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci LIKE "%'.$string.'%")';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'postgresql':
|
$agents = db_get_all_rows_filter(
|
||||||
$filter_agents[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre LIKE \'%'.$string.'%\')';
|
'tmetaconsole_agent',
|
||||||
break;
|
$filter_agents,
|
||||||
|
$fields
|
||||||
|
);
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$filter_agents[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) LIKE UPPER(\'%'.$string.'%\'))';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_agents, $fields);
|
|
||||||
if ($agents !== false) {
|
if ($agents !== false) {
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'id' => $agent['id_agente'],
|
'id' => $agent['id_agente'],
|
||||||
'name' => io_safe_output($agent['nombre']),
|
'name' => io_safe_output($agent['nombre']),
|
||||||
'alias' => io_safe_output($agent['alias']),
|
'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')',
|
||||||
'ip' => io_safe_output($agent['direccion']),
|
'ip' => io_safe_output($agent['direccion']),
|
||||||
'id_server' => $agent['id_server'],
|
'id_server' => $agent['id_server'],
|
||||||
'filter' => 'agent',
|
'filter' => 'agent',
|
||||||
@ -321,29 +312,22 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get agents for only the address
|
// Get agents for only the address.
|
||||||
$filter_address = $filter;
|
$filter_address = $filter;
|
||||||
switch ($config['dbtype']) {
|
$filter_address[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion LIKE "%'.$string.'%")';
|
||||||
case 'mysql':
|
|
||||||
$filter_address[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion LIKE "%'.$string.'%")';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'postgresql':
|
$agents = db_get_all_rows_filter(
|
||||||
$filter_address[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre NOT LIKE \'%'.$string.'%\' AND direccion LIKE \'%'.$string.'%\')';
|
'tmetaconsole_agent',
|
||||||
break;
|
$filter_address,
|
||||||
|
$fields
|
||||||
|
);
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$filter_address[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) LIKE UPPER(\'%'.$string.'%\'))';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_address, $fields);
|
|
||||||
if ($agents !== false) {
|
if ($agents !== false) {
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'id' => $agent['id_agente'],
|
'id' => $agent['id_agente'],
|
||||||
'name' => io_safe_output($agent['nombre']),
|
'name' => io_safe_output($agent['nombre']),
|
||||||
'alias' => io_safe_output($agent['alias']),
|
'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')',
|
||||||
'ip' => io_safe_output($agent['direccion']),
|
'ip' => io_safe_output($agent['direccion']),
|
||||||
'id_server' => $agent['id_server'],
|
'id_server' => $agent['id_server'],
|
||||||
'filter' => 'address',
|
'filter' => 'address',
|
||||||
@ -351,29 +335,22 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get agents for only the description
|
// Get agents for only the description.
|
||||||
$filter_description = $filter;
|
$filter_description = $filter;
|
||||||
switch ($config['dbtype']) {
|
$filter_description[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion NOT LIKE "%'.$string.'%" AND comentarios LIKE "%'.$string.'%")';
|
||||||
case 'mysql':
|
|
||||||
$filter_description[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion NOT LIKE "%'.$string.'%" AND comentarios LIKE "%'.$string.'%")';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'postgresql':
|
$agents = db_get_all_rows_filter(
|
||||||
$filter_description[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre NOT LIKE \'%'.$string.'%\' AND direccion NOT LIKE \'%'.$string.'%\' AND comentarios LIKE \'%'.$string.'%\')';
|
'tmetaconsole_agent',
|
||||||
break;
|
$filter_description,
|
||||||
|
$fields
|
||||||
|
);
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$filter_description[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_description, $fields);
|
|
||||||
if ($agents !== false) {
|
if ($agents !== false) {
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'id' => $agent['id_agente'],
|
'id' => $agent['id_agente'],
|
||||||
'name' => io_safe_output($agent['nombre']),
|
'name' => io_safe_output($agent['nombre']),
|
||||||
'alias' => io_safe_output($agent['alias']),
|
'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')',
|
||||||
'ip' => io_safe_output($agent['direccion']),
|
'ip' => io_safe_output($agent['direccion']),
|
||||||
'id_server' => $agent['id_server'],
|
'id_server' => $agent['id_server'],
|
||||||
'filter' => 'description',
|
'filter' => 'description',
|
||||||
|
@ -3002,7 +3002,7 @@ class AgentWizard extends HTML
|
|||||||
$newModule = $module;
|
$newModule = $module;
|
||||||
// Split the values got to obtain the name.
|
// Split the values got to obtain the name.
|
||||||
$tmpFirst = explode('.', $value);
|
$tmpFirst = explode('.', $value);
|
||||||
$tmpSecond = explode(' ', $tmpFirst[1]);
|
$tmpSecond = explode(' ', $tmpFirst[(count($tmpFirst) - 1)]);
|
||||||
// Position 0 is the index, Position 3 is the MIB name.
|
// Position 0 is the index, Position 3 is the MIB name.
|
||||||
$snmpwalkNames[$tmpSecond[0]] = $tmpSecond[3];
|
$snmpwalkNames[$tmpSecond[0]] = $tmpSecond[3];
|
||||||
// Perform the operations for get the values.
|
// Perform the operations for get the values.
|
||||||
@ -3011,6 +3011,11 @@ class AgentWizard extends HTML
|
|||||||
$currentOid = $oid.'.'.$tmpSecond[0];
|
$currentOid = $oid.'.'.$tmpSecond[0];
|
||||||
$macros['macros'][$oidName] = $currentOid;
|
$macros['macros'][$oidName] = $currentOid;
|
||||||
$currentOidValue = $this->snmpgetValue($currentOid);
|
$currentOidValue = $this->snmpgetValue($currentOid);
|
||||||
|
// If for any reason the value comes empty, add 1.
|
||||||
|
if ($currentOidValue == '') {
|
||||||
|
$currentOidValue = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$thisOperation = preg_replace(
|
$thisOperation = preg_replace(
|
||||||
'/'.$oidName.'/',
|
'/'.$oidName.'/',
|
||||||
$currentOidValue,
|
$currentOidValue,
|
||||||
@ -4566,7 +4571,7 @@ class AgentWizard extends HTML
|
|||||||
|
|
||||||
// Definition object.
|
// Definition object.
|
||||||
$definition = [];
|
$definition = [];
|
||||||
// ifHCInOctets.
|
// IfHCInOctets.
|
||||||
$moduleName = $name.'ifHCInOctets';
|
$moduleName = $name.'ifHCInOctets';
|
||||||
$definition['ifHCInOctets'] = [
|
$definition['ifHCInOctets'] = [
|
||||||
'module_name' => $moduleName,
|
'module_name' => $moduleName,
|
||||||
@ -4592,7 +4597,7 @@ class AgentWizard extends HTML
|
|||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
// ifHCOutOctets.
|
// IfHCOutOctets.
|
||||||
$moduleName = $name.'ifHCOutOctets';
|
$moduleName = $name.'ifHCOutOctets';
|
||||||
$definition['ifHCOutOctets'] = [
|
$definition['ifHCOutOctets'] = [
|
||||||
'module_name' => $moduleName,
|
'module_name' => $moduleName,
|
||||||
@ -4618,7 +4623,7 @@ class AgentWizard extends HTML
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
// ifHCInUcastPkts.
|
// IfHCInUcastPkts.
|
||||||
$moduleName = $name.'ifHCInUcastPkts';
|
$moduleName = $name.'ifHCInUcastPkts';
|
||||||
$definition['ifHCInUcastPkts'] = [
|
$definition['ifHCInUcastPkts'] = [
|
||||||
'module_name' => $moduleName,
|
'module_name' => $moduleName,
|
||||||
@ -4644,7 +4649,7 @@ class AgentWizard extends HTML
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
// ifHCOutUcastPkts.
|
// IfHCOutUcastPkts.
|
||||||
$moduleName = $name.'ifHCOutUcastPkts';
|
$moduleName = $name.'ifHCOutUcastPkts';
|
||||||
$definition['ifHCOutUcastPkts'] = [
|
$definition['ifHCOutUcastPkts'] = [
|
||||||
'module_name' => $moduleName,
|
'module_name' => $moduleName,
|
||||||
@ -4669,7 +4674,7 @@ class AgentWizard extends HTML
|
|||||||
'inv_critical' => false,
|
'inv_critical' => false,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
// ifHCInNUcastPkts.
|
// IfHCInNUcastPkts.
|
||||||
$moduleName = $name.'ifHCInNUcastPkts';
|
$moduleName = $name.'ifHCInNUcastPkts';
|
||||||
$definition['ifHCInNUcastPkts'] = [
|
$definition['ifHCInNUcastPkts'] = [
|
||||||
'module_name' => $moduleName,
|
'module_name' => $moduleName,
|
||||||
@ -4733,17 +4738,18 @@ class AgentWizard extends HTML
|
|||||||
* @param integer|null $type Module type.
|
* @param integer|null $type Module type.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws Exception Handle of unwanted operations.
|
||||||
*/
|
*/
|
||||||
private function evalOperation(
|
private function evalOperation(
|
||||||
string $operation,
|
string $operation,
|
||||||
string $unit='',
|
string $unit='',
|
||||||
?int $type=0
|
?int $type=0
|
||||||
) {
|
) {
|
||||||
// Avoid non-numeric or arithmetic chars for security reasons.
|
try {
|
||||||
if (preg_match('/(([^0-9\s\+\-\*\/\(\).,])+)/', $operation) === 1) {
|
// Avoid non-numeric or arithmetic chars for security reasons.
|
||||||
$output = 'ERROR';
|
if (preg_match('/(([^0-9\s\+\-\*\/\(\).,])+)/', $operation) === 1) {
|
||||||
} else {
|
throw new Exception(sprintf(__("The operation '%s' is not permitted. Review for remote components."), $operation));
|
||||||
try {
|
} else {
|
||||||
// Get the result of the operation and set it.
|
// Get the result of the operation and set it.
|
||||||
$output = '';
|
$output = '';
|
||||||
eval('$output = '.$operation.';');
|
eval('$output = '.$operation.';');
|
||||||
@ -4753,9 +4759,11 @@ class AgentWizard extends HTML
|
|||||||
$unit,
|
$unit,
|
||||||
$type
|
$type
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
|
||||||
$output = 'ERROR';
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->message['type'][] = 'error';
|
||||||
|
$this->message['message'][] = $e->getMessage();
|
||||||
|
$this->showMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
@ -5034,15 +5042,13 @@ class AgentWizard extends HTML
|
|||||||
var imageInfoModules = $("#image-info-modules-" + blockNumber);
|
var imageInfoModules = $("#image-info-modules-" + blockNumber);
|
||||||
var totalCount = 0;
|
var totalCount = 0;
|
||||||
var markedCount = 0;
|
var markedCount = 0;
|
||||||
var hidden_input = document.getElementById("hidden-module-active-"+switchName[2]+"_"+switchName[3]);
|
|
||||||
var id_input = hidden_input.id.split("_");
|
|
||||||
if (type == 'block') {
|
if (type == 'block') {
|
||||||
selectedBlock
|
selectedBlock
|
||||||
.parent()
|
.parent()
|
||||||
.removeClass("alpha50");
|
.removeClass("alpha50");
|
||||||
if (selectedBlock.prop("checked")) {
|
if (selectedBlock.prop("checked")) {
|
||||||
// Set to active the values of fields.
|
// Set to active the values of fields.
|
||||||
$("[id*='"+id_input[0]+"']")
|
$("[id*=hidden-module-active-"+blockNumber+"]")
|
||||||
.each(function(){
|
.each(function(){
|
||||||
$(this).val('1');
|
$(this).val('1');
|
||||||
});
|
});
|
||||||
@ -5054,7 +5060,7 @@ class AgentWizard extends HTML
|
|||||||
imageInfoModules.removeClass('hidden');
|
imageInfoModules.removeClass('hidden');
|
||||||
} else {
|
} else {
|
||||||
// Set to inactive the values of fields.
|
// Set to inactive the values of fields.
|
||||||
$("[id*='"+id_input[0]+"']")
|
$("[id*=hidden-module-active-"+blockNumber+"]")
|
||||||
.each(function(){
|
.each(function(){
|
||||||
$(this).val('0');
|
$(this).val('0');
|
||||||
});
|
});
|
||||||
|
@ -248,7 +248,7 @@ class CredentialStore extends Wizard
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$groups = [ $filter['filter_id_group'] ];
|
$groups = [ $filter['filter_id_group'] ];
|
||||||
$childrens = groups_get_childrens($id_group, null, true);
|
$childrens = groups_get_children($id_group, null, true);
|
||||||
if (!empty($childrens)) {
|
if (!empty($childrens)) {
|
||||||
foreach ($childrens as $child) {
|
foreach ($childrens as $child) {
|
||||||
$groups[] = (int) $child['id_grupo'];
|
$groups[] = (int) $child['id_grupo'];
|
||||||
|
@ -810,7 +810,7 @@ class NetworkMap
|
|||||||
$filter['id_grupo'] = $this->idGroup;
|
$filter['id_grupo'] = $this->idGroup;
|
||||||
} else {
|
} else {
|
||||||
// Show current group and children.
|
// Show current group and children.
|
||||||
$childrens = groups_get_childrens($this->idGroup, null, true);
|
$childrens = groups_get_children($this->idGroup, null, true);
|
||||||
if (!empty($childrens)) {
|
if (!empty($childrens)) {
|
||||||
$childrens = array_keys($childrens);
|
$childrens = array_keys($childrens);
|
||||||
|
|
||||||
|
@ -264,6 +264,7 @@ class TreeService extends Tree
|
|||||||
ts.id_agent_module,
|
ts.id_agent_module,
|
||||||
ts.name,
|
ts.name,
|
||||||
ts.name as `alias`,
|
ts.name as `alias`,
|
||||||
|
ts.description as `description`,
|
||||||
ts.id as `rootID`,
|
ts.id as `rootID`,
|
||||||
"services" as `rootType`,
|
"services" as `rootType`,
|
||||||
"services" as `type`,
|
"services" as `type`,
|
||||||
@ -311,6 +312,7 @@ class TreeService extends Tree
|
|||||||
];
|
];
|
||||||
$services[$service['id']]['name'] = $service['name'];
|
$services[$service['id']]['name'] = $service['name'];
|
||||||
$services[$service['id']]['id'] = $service['id'];
|
$services[$service['id']]['id'] = $service['id'];
|
||||||
|
$services[$service['id']]['description'] = $service['description'];
|
||||||
$services[$service['id']]['serviceDetail'] = 'index.php?sec=network&sec2=enterprise/operation/services/services&tab=service_map&id_service='.(int) $service['id'];
|
$services[$service['id']]['serviceDetail'] = 'index.php?sec=network&sec2=enterprise/operation/services/services&tab=service_map&id_service='.(int) $service['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -512,6 +514,8 @@ class TreeService extends Tree
|
|||||||
$tmp['id'] = (int) $item->service()->id();
|
$tmp['id'] = (int) $item->service()->id();
|
||||||
$tmp['name'] = $item->service()->name();
|
$tmp['name'] = $item->service()->name();
|
||||||
$tmp['alias'] = $item->service()->name();
|
$tmp['alias'] = $item->service()->name();
|
||||||
|
$tmp['description'] = $item->service()->description();
|
||||||
|
$tmp['elementDescription'] = $item->description();
|
||||||
|
|
||||||
if ($this->connectedToNode === false
|
if ($this->connectedToNode === false
|
||||||
&& is_metaconsole() === true
|
&& is_metaconsole() === true
|
||||||
@ -643,6 +647,8 @@ class TreeService extends Tree
|
|||||||
ts.id_agent_module,
|
ts.id_agent_module,
|
||||||
ts.name,
|
ts.name,
|
||||||
ts.name as `alias`,
|
ts.name as `alias`,
|
||||||
|
ts.description as `description`,
|
||||||
|
tse.description as `elementDescription`,
|
||||||
tse.id_service as `rootID`,
|
tse.id_service as `rootID`,
|
||||||
"services" as `rootType`,
|
"services" as `rootType`,
|
||||||
"services" as `type`,
|
"services" as `type`,
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* Pandora build version and version
|
* Pandora build version and version
|
||||||
*/
|
*/
|
||||||
$build_version = 'PC201027';
|
$build_version = 'PC201029';
|
||||||
$pandora_version = 'v7.0NG.750';
|
$pandora_version = 'v7.0NG.750';
|
||||||
|
|
||||||
// Do not overwrite default timezone set if defined.
|
// Do not overwrite default timezone set if defined.
|
||||||
|
@ -1342,6 +1342,73 @@ function get_priority_name($priority)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translates status into string.
|
||||||
|
*
|
||||||
|
* @param integer $status Agent status.
|
||||||
|
*
|
||||||
|
* @return string Translation.
|
||||||
|
*/
|
||||||
|
function get_agent_status_string($status)
|
||||||
|
{
|
||||||
|
switch ($status) {
|
||||||
|
case AGENT_STATUS_CRITICAL:
|
||||||
|
return __('CRITICAL');
|
||||||
|
|
||||||
|
case AGENT_STATUS_WARNING:
|
||||||
|
return __('WARNING');
|
||||||
|
|
||||||
|
case AGENT_STATUS_ALERT_FIRED:
|
||||||
|
return __('ALERT FIRED');
|
||||||
|
|
||||||
|
case AGENT_STATUS_NOT_INIT:
|
||||||
|
return __('NO DATA');
|
||||||
|
|
||||||
|
case AGENT_STATUS_NORMAL:
|
||||||
|
return __('NORMAL');
|
||||||
|
|
||||||
|
case AGENT_STATUS_UNKNOWN:
|
||||||
|
default:
|
||||||
|
return __('UNKNOWN');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translates status into string.
|
||||||
|
*
|
||||||
|
* @param integer $status Module status.
|
||||||
|
*
|
||||||
|
* @return string Translation.
|
||||||
|
*/
|
||||||
|
function get_module_status_string($status)
|
||||||
|
{
|
||||||
|
switch ($status) {
|
||||||
|
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||||
|
return __('CRITICAL');
|
||||||
|
|
||||||
|
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||||
|
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||||
|
return __('ALERT FIRED');
|
||||||
|
|
||||||
|
case AGENT_MODULE_STATUS_WARNING:
|
||||||
|
return __('WARNING');
|
||||||
|
|
||||||
|
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||||
|
return __('UNKNOWN');
|
||||||
|
|
||||||
|
case AGENT_MODULE_STATUS_NO_DATA:
|
||||||
|
case AGENT_MODULE_STATUS_NOT_INIT:
|
||||||
|
return __('NO DATA');
|
||||||
|
|
||||||
|
case AGENT_MODULE_STATUS_NORMAL_ALERT:
|
||||||
|
case AGENT_MODULE_STATUS_NORMAL:
|
||||||
|
default:
|
||||||
|
return __('NORMAL');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get priority class (CSS class) from priority value.
|
* Get priority class (CSS class) from priority value.
|
||||||
*
|
*
|
||||||
@ -3753,7 +3820,16 @@ function series_type_graph_array($data, $show_elements_graph)
|
|||||||
$name_legend .= __('Unit ').' ';
|
$name_legend .= __('Unit ').' ';
|
||||||
$name_legend .= $show_elements_graph['unit'].': ';
|
$name_legend .= $show_elements_graph['unit'].': ';
|
||||||
} else {
|
} else {
|
||||||
$name_legend = $show_elements_graph['labels'][$value['agent_module_id']].': ';
|
if (isset($show_elements_graph['from_interface']) === true
|
||||||
|
&& (bool) $show_elements_graph['from_interface'] === true
|
||||||
|
) {
|
||||||
|
$label_interfaces = array_flip($show_elements_graph['modules_series']);
|
||||||
|
$name_legend = $show_elements_graph['labels'][$value['agent_module_id']][$label_interfaces[$value['agent_module_id']]].': ';
|
||||||
|
} else if (is_array($show_elements_graph['labels'][$value['agent_module_id']]) === true) {
|
||||||
|
$name_legend = 'Avg: ';
|
||||||
|
} else {
|
||||||
|
$name_legend = $show_elements_graph['labels'][$value['agent_module_id']].': ';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (strpos($key, 'baseline') !== false) {
|
if (strpos($key, 'baseline') !== false) {
|
||||||
|
@ -19,17 +19,18 @@
|
|||||||
|
|
||||||
require_once $config['homedir'].'/include/functions.php';
|
require_once $config['homedir'].'/include/functions.php';
|
||||||
require_once $config['homedir'].'/include/functions_modules.php';
|
require_once $config['homedir'].'/include/functions_modules.php';
|
||||||
require_once $config['homedir'].'/include/functions_users.php';/**
|
require_once $config['homedir'].'/include/functions_users.php';
|
||||||
* Return the agent if exists in the DB.
|
|
||||||
*
|
|
||||||
* @param integer $id_agent The agent id.
|
|
||||||
* @param boolean $show_disabled Show the agent found althought it is disabled. By default false.
|
|
||||||
* @param boolean $force_meta
|
|
||||||
*
|
|
||||||
* @return boolean The result to check if the agent is in the DB.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the agent if exists in the DB.
|
||||||
|
*
|
||||||
|
* @param integer $id_agent The agent id.
|
||||||
|
* @param boolean $show_disabled Show the agent found althought it is disabled. By default false.
|
||||||
|
* @param boolean $force_meta
|
||||||
|
*
|
||||||
|
* @return boolean The result to check if the agent is in the DB.
|
||||||
|
*/
|
||||||
function agents_get_agent($id_agent, $show_disabled=true, $force_meta=false)
|
function agents_get_agent($id_agent, $show_disabled=true, $force_meta=false)
|
||||||
{
|
{
|
||||||
$agent = db_get_row_filter(
|
$agent = db_get_row_filter(
|
||||||
@ -335,6 +336,11 @@ function agents_get_alerts_simple($id_agent=false, $filter='', $options=false, $
|
|||||||
|
|
||||||
// Filter by agents id.
|
// Filter by agents id.
|
||||||
$id_agents_list = implode(',', $id_agent);
|
$id_agents_list = implode(',', $id_agent);
|
||||||
|
|
||||||
|
if ($id_agents_list === '') {
|
||||||
|
$id_agents_list = '0';
|
||||||
|
}
|
||||||
|
|
||||||
$subQuery .= ' AND id_agente in ('.$id_agents_list.')';
|
$subQuery .= ' AND id_agente in ('.$id_agents_list.')';
|
||||||
} else if ($id_agent === false || empty($id_agent)) {
|
} else if ($id_agent === false || empty($id_agent)) {
|
||||||
if ($allModules) {
|
if ($allModules) {
|
||||||
@ -1108,11 +1114,14 @@ function agents_get_group_agents(
|
|||||||
foreach ($id_group as $parent) {
|
foreach ($id_group as $parent) {
|
||||||
$id_group = array_merge(
|
$id_group = array_merge(
|
||||||
$id_group,
|
$id_group,
|
||||||
groups_get_id_recursive($parent, false)
|
groups_get_children_ids($parent, $noACL)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$id_group = groups_get_id_recursive($id_group, false);
|
$id_group = array_merge(
|
||||||
|
[$id_group],
|
||||||
|
groups_get_children_ids($id_group, $noACL)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check available groups for target user only if asking for 'All' group.
|
// Check available groups for target user only if asking for 'All' group.
|
||||||
|
@ -1973,7 +1973,7 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType)
|
|||||||
$ag_groups = $other['data'][1];
|
$ag_groups = $other['data'][1];
|
||||||
// Recursion.
|
// Recursion.
|
||||||
if ($other['data'][6] === '1') {
|
if ($other['data'][6] === '1') {
|
||||||
$ag_groups = groups_get_id_recursive($ag_groups, true);
|
$ag_groups = groups_get_children_ids($ag_groups, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ag_groups = implode(',', (array) $ag_groups);
|
$ag_groups = implode(',', (array) $ag_groups);
|
||||||
@ -12513,7 +12513,13 @@ function api_set_create_event($id, $trash1, $other, $returnType)
|
|||||||
|
|
||||||
if ($other['data'][18] != '') {
|
if ($other['data'][18] != '') {
|
||||||
$values['id_extra'] = $other['data'][18];
|
$values['id_extra'] = $other['data'][18];
|
||||||
$sql_validation = 'SELECT id_evento FROM tevento where estado IN (0,2) and id_extra ="'.$other['data'][18].'";';
|
if (is_metaconsole()) {
|
||||||
|
$table_event = 'tmetaconsole_event';
|
||||||
|
} else {
|
||||||
|
$table_event = 'tevento';
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql_validation = 'SELECT id_evento FROM '.$table_event.' where estado IN (0,2) and id_extra ="'.$other['data'][18].'";';
|
||||||
$validation = db_get_all_rows_sql($sql_validation);
|
$validation = db_get_all_rows_sql($sql_validation);
|
||||||
if ($validation) {
|
if ($validation) {
|
||||||
foreach ($validation as $val) {
|
foreach ($validation as $val) {
|
||||||
|
@ -367,7 +367,7 @@ function agent_counters_custom_fields($filters)
|
|||||||
if ($filters['group']) {
|
if ($filters['group']) {
|
||||||
// Recursion check acl.
|
// Recursion check acl.
|
||||||
if ($filters['recursion']) {
|
if ($filters['recursion']) {
|
||||||
$recursion_groups = groups_get_id_recursive($filters['group'], true);
|
$recursion_groups = groups_get_children_ids($filters['group'], true);
|
||||||
if (!users_can_manage_group_all('AR')) {
|
if (!users_can_manage_group_all('AR')) {
|
||||||
if (isset($user_groups) && is_array($user_groups)) {
|
if (isset($user_groups) && is_array($user_groups)) {
|
||||||
$groups_intersect = array_intersect($user_groups, $recursion_groups);
|
$groups_intersect = array_intersect($user_groups, $recursion_groups);
|
||||||
|
@ -871,37 +871,23 @@ function events_get_all(
|
|||||||
}
|
}
|
||||||
|
|
||||||
$groups = $filter['id_group_filter'];
|
$groups = $filter['id_group_filter'];
|
||||||
if (isset($groups) && $groups > 0) {
|
if (isset($groups) === true && $groups > 0) {
|
||||||
$propagate = db_get_value(
|
$children = groups_get_children($groups);
|
||||||
'propagate',
|
|
||||||
'tgrupo',
|
|
||||||
'id_grupo',
|
|
||||||
$groups
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!$propagate && isset($groups)) {
|
$_groups = [ $groups ];
|
||||||
$sql_filters[] = sprintf(
|
if (empty($children) === false) {
|
||||||
' AND (te.id_grupo = %d OR tasg.id_group = %d)',
|
foreach ($children as $child) {
|
||||||
$groups,
|
$_groups[] = (int) $child['id_grupo'];
|
||||||
$groups
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$children = groups_get_children($groups);
|
|
||||||
$_groups = [ $groups ];
|
|
||||||
if (!empty($children)) {
|
|
||||||
foreach ($children as $child) {
|
|
||||||
$_groups[] = (int) $child['id_grupo'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$groups = $_groups;
|
|
||||||
|
|
||||||
$sql_filters[] = sprintf(
|
|
||||||
' AND (te.id_grupo IN (%s) OR tasg.id_group IN (%s))',
|
|
||||||
join(',', $groups),
|
|
||||||
join(',', $groups)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$groups = $_groups;
|
||||||
|
|
||||||
|
$sql_filters[] = sprintf(
|
||||||
|
' AND (te.id_grupo IN (%s) OR tasg.id_group IN (%s))',
|
||||||
|
join(',', $groups),
|
||||||
|
join(',', $groups)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip system messages if user is not PM.
|
// Skip system messages if user is not PM.
|
||||||
@ -1258,7 +1244,11 @@ function events_get_all(
|
|||||||
// Order.
|
// Order.
|
||||||
$order_by = '';
|
$order_by = '';
|
||||||
if (isset($order, $sort_field)) {
|
if (isset($order, $sort_field)) {
|
||||||
$order_by = events_get_sql_order($sort_field, $order);
|
if (isset($filter['group_rep']) && $filter['group_rep'] == 1) {
|
||||||
|
$order_by = events_get_sql_order('MAX('.$sort_field.')', $order);
|
||||||
|
} else {
|
||||||
|
$order_by = events_get_sql_order($sort_field, $order);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pagination.
|
// Pagination.
|
||||||
|
@ -266,48 +266,25 @@ function groups_check_used($idGroup)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a array of id_group of childrens (to branches down)
|
* Return a array of id_group of children of given parent INCLUDING PARENT!!.
|
||||||
*
|
|
||||||
* @param integer $parent The id_group parent to search the childrens.
|
|
||||||
* @param array $groups The groups, its for optimize the querys to DB.
|
|
||||||
*/
|
|
||||||
function groups_get_childrens_ids($parent, $groups=null)
|
|
||||||
{
|
|
||||||
if (empty($groups)) {
|
|
||||||
$groups = db_get_all_rows_in_table('tgrupo');
|
|
||||||
}
|
|
||||||
|
|
||||||
$return = '';
|
|
||||||
|
|
||||||
foreach ($groups as $key => $group) {
|
|
||||||
if ($group['id_grupo'] == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($group['parent'] == $parent) {
|
|
||||||
$return .= $group['id_grupo'].',';
|
|
||||||
$propagate = db_get_value('propagate', 'tgrupo', 'id_grupo', $group['id_grupo']);
|
|
||||||
if ($propagate) {
|
|
||||||
$return .= groups_get_childrens_ids($group['id_grupo']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a array of id_group of children of given parent.
|
|
||||||
*
|
*
|
||||||
* @param integer $parent The id_grupo parent to search its children.
|
* @param integer $parent The id_grupo parent to search its children.
|
||||||
* @param array $ignorePropagate Ignore propagate.
|
* @param array $ignorePropagate Ignore propagate.
|
||||||
|
* @param string $privilege Default privilege.
|
||||||
|
* @param boolean $selfInclude Include group "id_parent" in return.
|
||||||
|
*
|
||||||
|
* @return array Of Groups, children of $parent.
|
||||||
*/
|
*/
|
||||||
function groups_get_children($parent, $ignorePropagate=false)
|
function groups_get_children(
|
||||||
{
|
$parent,
|
||||||
|
$ignorePropagate=false,
|
||||||
|
$privilege='AR',
|
||||||
|
$selfInclude=true
|
||||||
|
) {
|
||||||
static $groups;
|
static $groups;
|
||||||
|
static $user_groups;
|
||||||
|
|
||||||
if (empty($groups)) {
|
if (empty($groups) === true) {
|
||||||
$aux_groups = [];
|
$aux_groups = [];
|
||||||
$groups = db_get_all_rows_in_table('tgrupo');
|
$groups = db_get_all_rows_in_table('tgrupo');
|
||||||
foreach ($groups as $key => $value) {
|
foreach ($groups as $key => $value) {
|
||||||
@ -317,19 +294,45 @@ function groups_get_children($parent, $ignorePropagate=false)
|
|||||||
$groups = $aux_groups;
|
$groups = $aux_groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($user_groups) === true) {
|
||||||
|
$user_groups = users_get_groups(false, $privilege, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Admin see always all groups.
|
||||||
|
$ignorePropagate = users_is_admin() || $ignorePropagate;
|
||||||
|
|
||||||
|
// Prepare array.
|
||||||
$return = [];
|
$return = [];
|
||||||
|
|
||||||
|
if ($selfInclude === true) {
|
||||||
|
if (array_key_exists($parent, $user_groups) === true) {
|
||||||
|
$return[$parent] = $groups[$parent];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($groups as $key => $g) {
|
foreach ($groups as $key => $g) {
|
||||||
if ($g['id_grupo'] == 0) {
|
if ($g['id_grupo'] == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ignorePropagate || $parent == 0 || $groups[$parent]['propagate']) {
|
// IgnorePropagate will be true if user can access child.
|
||||||
|
$allowed = $ignorePropagate || array_key_exists(
|
||||||
|
$g['id_grupo'],
|
||||||
|
$user_groups
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($allowed === true
|
||||||
|
|| (int) $parent === 0
|
||||||
|
|| (bool) $groups[$parent]['propagate'] === true
|
||||||
|
) {
|
||||||
if ($g['parent'] == $parent) {
|
if ($g['parent'] == $parent) {
|
||||||
$return += [$g['id_grupo'] => $g];
|
$return += [$g['id_grupo'] => $g];
|
||||||
if ($g['propagate'] || $ignorePropagate) {
|
if ($g['propagate'] || $ignorePropagate) {
|
||||||
$return += groups_get_children(
|
$return += groups_get_children(
|
||||||
$g['id_grupo'],
|
$g['id_grupo'],
|
||||||
$ignorePropagate
|
$ignorePropagate,
|
||||||
|
$privilege,
|
||||||
|
$selfInclude
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -340,38 +343,6 @@ function groups_get_children($parent, $ignorePropagate=false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated This is not working. Expects 'propagate' on CHILD not on PARENT!!!
|
|
||||||
*
|
|
||||||
* Return a array of id_group of childrens (to branches down)
|
|
||||||
*
|
|
||||||
* @param integer $parent The id_group parent to search the childrens.
|
|
||||||
* @param array $groups The groups, its for optimize the querys to DB.
|
|
||||||
*/
|
|
||||||
function groups_get_childrens($parent, $groups=null, $onlyPropagate=false)
|
|
||||||
{
|
|
||||||
if (empty($groups)) {
|
|
||||||
$groups = db_get_all_rows_in_table('tgrupo');
|
|
||||||
}
|
|
||||||
|
|
||||||
$return = [];
|
|
||||||
|
|
||||||
foreach ($groups as $key => $group) {
|
|
||||||
if ($group['id_grupo'] == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($group['propagate'] || $onlyPropagate) {
|
|
||||||
if ($group['parent'] == $parent) {
|
|
||||||
$return = ($return + [$group['id_grupo'] => $group] + groups_get_childrens($group['id_grupo'], $groups, $onlyPropagate));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a array of id_group of parents (to roots up).
|
* Return a array of id_group of parents (to roots up).
|
||||||
*
|
*
|
||||||
@ -534,42 +505,30 @@ function groups_get_all($groupWithAgents=false)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all groups recursive from an initial group.
|
* Get all groups recursive from an initial group INCLUDING PARENT!!.
|
||||||
*
|
*
|
||||||
* @param int Id of the parent group
|
* @param integer $id_parent Id of the parent group.
|
||||||
* @param bool Whether to force recursive search ignoring propagation (true) or not (false)
|
* @param boolean $ignorePropagate Whether to force recursive search ignoring
|
||||||
|
* propagation (true) or not (false).
|
||||||
|
* @param boolean $selfInclude Include group "id_parent" in return.
|
||||||
|
* @param string $privilege Privilege flag to search for default 'AR'.
|
||||||
*
|
*
|
||||||
* @return array with all result groups
|
* @return array With all result groups.
|
||||||
*/
|
*/
|
||||||
function groups_get_id_recursive($id_parent, $all=false)
|
function groups_get_children_ids(
|
||||||
{
|
$id_parent,
|
||||||
$return = [];
|
$ignorePropagate=false,
|
||||||
|
$selfInclude=true,
|
||||||
|
$privilege='AR'
|
||||||
|
) {
|
||||||
|
$return = groups_get_children(
|
||||||
|
$id_parent,
|
||||||
|
$ignorePropagate,
|
||||||
|
$privilege,
|
||||||
|
$selfInclude
|
||||||
|
);
|
||||||
|
|
||||||
$return = array_merge($return, [$id_parent]);
|
return array_keys($return);
|
||||||
|
|
||||||
// Check propagate
|
|
||||||
$propagate = db_get_value_filter('propagate', 'tgrupo', ['id_grupo' => $id_parent]);
|
|
||||||
|
|
||||||
if (($propagate == 1) || $all) {
|
|
||||||
$children = db_get_all_rows_filter('tgrupo', ['parent' => $id_parent, 'disabled' => 0], ['id_grupo']);
|
|
||||||
|
|
||||||
if ($children === false) {
|
|
||||||
$children = [];
|
|
||||||
} else {
|
|
||||||
$temp = [];
|
|
||||||
foreach ($children as $id_children) {
|
|
||||||
$temp = array_merge($temp, [$id_children['id_grupo']]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$children = $temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($children as $id_children) {
|
|
||||||
$return = array_merge($return, groups_get_id_recursive($id_children, $all));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ function html_print_select_style($fields, $name, $selected='', $style='', $scrip
|
|||||||
* @param boolean $disabled Disabled or enabled.
|
* @param boolean $disabled Disabled or enabled.
|
||||||
* @param boolean $style CSS inline style.
|
* @param boolean $style CSS inline style.
|
||||||
* @param string $option_style CSS inline style in array format.
|
* @param string $option_style CSS inline style in array format.
|
||||||
* @param array $id_group Groups to be manually added.
|
* @param integer $id_group Exclude group branch from id_group.
|
||||||
* @param string $keys_field Field to be used as array key, (id).
|
* @param string $keys_field Field to be used as array key, (id).
|
||||||
* @param boolean $strict_user Strict.
|
* @param boolean $strict_user Strict.
|
||||||
* @param array $delete_groups Remove groups from select.
|
* @param array $delete_groups Remove groups from select.
|
||||||
@ -500,6 +500,15 @@ function html_print_select_groups(
|
|||||||
$name = 'group_select'.$idcounter[$name];
|
$name = 'group_select'.$idcounter[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($id_group !== false) {
|
||||||
|
$children = groups_get_children($id_group);
|
||||||
|
foreach ($children as $child) {
|
||||||
|
$delete_groups[] = $child['id_grupo'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$delete_groups[] = $id_group;
|
||||||
|
}
|
||||||
|
|
||||||
$fields = [];
|
$fields = [];
|
||||||
// Preload selector.
|
// Preload selector.
|
||||||
if (is_array($selected) === false) {
|
if (is_array($selected) === false) {
|
||||||
@ -510,7 +519,15 @@ function html_print_select_groups(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($selected as $k) {
|
foreach ($selected as $k) {
|
||||||
$fields[$k] = groups_get_name($k);
|
if ($k === null || $k === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fields[$k] = groups_get_name($k, $returnAllGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($fields) === true && $returnAllGroup) {
|
||||||
|
$fields[0] = groups_get_name(null, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ function networkmap_generate_dot(
|
|||||||
if ($dont_show_subgroups) {
|
if ($dont_show_subgroups) {
|
||||||
$filter['id_grupo'] = $group;
|
$filter['id_grupo'] = $group;
|
||||||
} else {
|
} else {
|
||||||
$childrens = groups_get_childrens($group, null, true);
|
$childrens = groups_get_children($group, null, true);
|
||||||
if (!empty($childrens)) {
|
if (!empty($childrens)) {
|
||||||
$childrens = array_keys($childrens);
|
$childrens = array_keys($childrens);
|
||||||
|
|
||||||
|
@ -3912,7 +3912,7 @@ function reporting_alert_report_group($report, $content)
|
|||||||
|
|
||||||
$agent_modules = alerts_get_agent_modules(
|
$agent_modules = alerts_get_agent_modules(
|
||||||
$content['id_group'],
|
$content['id_group'],
|
||||||
$content['recursion']
|
(((string) $content['id_group'] === '0') ? true : $content['recursion'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if (empty($alerts)) {
|
if (empty($alerts)) {
|
||||||
@ -4979,6 +4979,16 @@ function reporting_agent_configuration($report, $content)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Report Min, Max and Avg.
|
||||||
|
*
|
||||||
|
* @param array $report Info report.
|
||||||
|
* @param array $content Content report.
|
||||||
|
* @param string $type Type report.
|
||||||
|
* @param boolean $pdf Is pdf.
|
||||||
|
*
|
||||||
|
* @return array Data draw report.
|
||||||
|
*/
|
||||||
function reporting_value($report, $content, $type, $pdf=false)
|
function reporting_value($report, $content, $type, $pdf=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
@ -4993,16 +5003,17 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||||||
$return['type'] = 'min_value';
|
$return['type'] = 'min_value';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'avg':
|
|
||||||
$return['type'] = 'avg_value';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'sum':
|
case 'sum':
|
||||||
$return['type'] = 'sumatory';
|
$return['type'] = 'sumatory';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'avg':
|
||||||
|
default:
|
||||||
|
$return['type'] = 'avg_value';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($content['name'])) {
|
if (empty($content['name']) === true) {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'max':
|
case 'max':
|
||||||
$content['name'] = __('Max. Value');
|
$content['name'] = __('Max. Value');
|
||||||
@ -5012,17 +5023,18 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||||||
$content['name'] = __('Min. Value');
|
$content['name'] = __('Min. Value');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'avg':
|
|
||||||
$content['name'] = __('AVG. Value');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'sum':
|
case 'sum':
|
||||||
$content['name'] = __('Summatory');
|
$content['name'] = __('Summatory');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'avg':
|
||||||
|
default:
|
||||||
|
$content['name'] = __('AVG. Value');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($config['metaconsole']) {
|
if (is_metaconsole() === true) {
|
||||||
$id_meta = metaconsole_get_id_server($content['server_name']);
|
$id_meta = metaconsole_get_id_server($content['server_name']);
|
||||||
|
|
||||||
$server = metaconsole_get_connection_by_id($id_meta);
|
$server = metaconsole_get_connection_by_id($id_meta);
|
||||||
@ -5060,14 +5072,15 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||||||
$return['agent_name'] = $agent_name;
|
$return['agent_name'] = $agent_name;
|
||||||
$return['module_name'] = $module_name;
|
$return['module_name'] = $module_name;
|
||||||
|
|
||||||
|
$only_image = false;
|
||||||
if ($pdf) {
|
if ($pdf) {
|
||||||
$only_image = 1;
|
$only_image = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = [
|
$params = [
|
||||||
'agent_module_id' => $content['id_agent_module'],
|
'agent_module_id' => $content['id_agent_module'],
|
||||||
'period' => $content['period'],
|
'period' => $content['period'],
|
||||||
'width' => '600px',
|
'width' => '90%',
|
||||||
'pure' => false,
|
'pure' => false,
|
||||||
'date' => $report['datetime'],
|
'date' => $report['datetime'],
|
||||||
'only_image' => $only_image,
|
'only_image' => $only_image,
|
||||||
@ -5086,6 +5099,7 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||||||
case 'max':
|
case 'max':
|
||||||
case 'min':
|
case 'min':
|
||||||
case 'avg':
|
case 'avg':
|
||||||
|
default:
|
||||||
$divisor = get_data_multiplier($unit);
|
$divisor = get_data_multiplier($unit);
|
||||||
|
|
||||||
if ($content['lapse_calc'] == 0) {
|
if ($content['lapse_calc'] == 0) {
|
||||||
@ -5107,6 +5121,7 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'avg':
|
case 'avg':
|
||||||
|
default:
|
||||||
$value = reporting_get_agentmodule_data_average(
|
$value = reporting_get_agentmodule_data_average(
|
||||||
$content['id_agent_module'],
|
$content['id_agent_module'],
|
||||||
$content['period'],
|
$content['period'],
|
||||||
@ -5118,7 +5133,14 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||||||
if (!$config['simple_module_value']) {
|
if (!$config['simple_module_value']) {
|
||||||
$formated_value = $value;
|
$formated_value = $value;
|
||||||
} else {
|
} else {
|
||||||
$formated_value = format_for_graph($value, $config['graph_precision'], '.', ',', $divisor, $unit);
|
$formated_value = format_for_graph(
|
||||||
|
$value,
|
||||||
|
$config['graph_precision'],
|
||||||
|
'.',
|
||||||
|
',',
|
||||||
|
$divisor,
|
||||||
|
$unit
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$return['visual_format'] = $content['visual_format'];
|
$return['visual_format'] = $content['visual_format'];
|
||||||
@ -5126,17 +5148,51 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'max':
|
case 'max':
|
||||||
$params['force_interval'] = 'max_only';
|
$params['force_interval'] = 'max_only';
|
||||||
$value = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision'], '.', ',', $divisor, $unit);
|
$value = format_for_graph(
|
||||||
|
reporting_get_agentmodule_data_max(
|
||||||
|
$content['id_agent_module'],
|
||||||
|
$content['period'],
|
||||||
|
$report['datetime']
|
||||||
|
),
|
||||||
|
$config['graph_precision'],
|
||||||
|
'.',
|
||||||
|
',',
|
||||||
|
$divisor,
|
||||||
|
$unit
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'min':
|
case 'min':
|
||||||
$params['force_interval'] = 'min_only';
|
$params['force_interval'] = 'min_only';
|
||||||
$value = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision'], '.', ',', $divisor, $unit);
|
$value = format_for_graph(
|
||||||
|
reporting_get_agentmodule_data_min(
|
||||||
|
$content['id_agent_module'],
|
||||||
|
$content['period'],
|
||||||
|
$report['datetime']
|
||||||
|
),
|
||||||
|
$config['graph_precision'],
|
||||||
|
'.',
|
||||||
|
',',
|
||||||
|
$divisor,
|
||||||
|
$unit
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'avg':
|
case 'avg':
|
||||||
|
default:
|
||||||
$params['force_interval'] = 'avg_only';
|
$params['force_interval'] = 'avg_only';
|
||||||
$value = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision'], '.', ',', $divisor, $unit);
|
$value = format_for_graph(
|
||||||
|
reporting_get_agentmodule_data_average(
|
||||||
|
$content['id_agent_module'],
|
||||||
|
$content['period'],
|
||||||
|
$report['datetime']
|
||||||
|
),
|
||||||
|
$config['graph_precision'],
|
||||||
|
'.',
|
||||||
|
',',
|
||||||
|
$divisor,
|
||||||
|
$unit
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5166,15 +5222,49 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||||||
if ($i > $time_begin['utimestamp']) {
|
if ($i > $time_begin['utimestamp']) {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'max':
|
case 'max':
|
||||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision'], '.', ',', $divisor, $unit);
|
$row[__('Maximun')] = format_for_graph(
|
||||||
|
reporting_get_agentmodule_data_max(
|
||||||
|
$content['id_agent_module'],
|
||||||
|
$content['lapse'],
|
||||||
|
($i + $content['lapse'])
|
||||||
|
),
|
||||||
|
$config['graph_precision'],
|
||||||
|
'.',
|
||||||
|
',',
|
||||||
|
$divisor,
|
||||||
|
$unit
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'min':
|
case 'min':
|
||||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision'], '.', ',', $divisor, $unit);
|
$row[__('Maximun')] = format_for_graph(
|
||||||
|
reporting_get_agentmodule_data_min(
|
||||||
|
$content['id_agent_module'],
|
||||||
|
$content['lapse'],
|
||||||
|
($i + $content['lapse'])
|
||||||
|
),
|
||||||
|
$config['graph_precision'],
|
||||||
|
'.',
|
||||||
|
',',
|
||||||
|
$divisor,
|
||||||
|
$unit
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'avg':
|
case 'avg':
|
||||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision'], '.', ',', $divisor, $unit);
|
default:
|
||||||
|
$row[__('Maximun')] = format_for_graph(
|
||||||
|
reporting_get_agentmodule_data_average(
|
||||||
|
$content['id_agent_module'],
|
||||||
|
$content['lapse'],
|
||||||
|
($i + $content['lapse'])
|
||||||
|
),
|
||||||
|
$config['graph_precision'],
|
||||||
|
'.',
|
||||||
|
',',
|
||||||
|
$divisor,
|
||||||
|
$unit
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -5185,7 +5275,7 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($config['metaconsole']) {
|
if (is_metaconsole() === true) {
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5205,7 +5295,14 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||||||
} else {
|
} else {
|
||||||
$divisor = get_data_multiplier($unit);
|
$divisor = get_data_multiplier($unit);
|
||||||
|
|
||||||
$formated_value = format_for_graph($value, $config['graph_precision'], '.', ',', $divisor, $unit);
|
$formated_value = format_for_graph(
|
||||||
|
$value,
|
||||||
|
$config['graph_precision'],
|
||||||
|
'.',
|
||||||
|
',',
|
||||||
|
$divisor,
|
||||||
|
$unit
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5215,7 +5312,7 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||||||
'formated_value' => $formated_value,
|
'formated_value' => $formated_value,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($config['metaconsole']) {
|
if (is_metaconsole() === true) {
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9072,7 +9169,7 @@ function reporting_get_group_stats($id_group=0, $access='AR')
|
|||||||
$covered_groups = [];
|
$covered_groups = [];
|
||||||
$group_array = [];
|
$group_array = [];
|
||||||
foreach ($id_group as $group) {
|
foreach ($id_group as $group) {
|
||||||
$children = groups_get_childrens($group);
|
$children = groups_get_children($group);
|
||||||
|
|
||||||
// Show empty groups only if they have children with agents
|
// Show empty groups only if they have children with agents
|
||||||
// $group_array = array();
|
// $group_array = array();
|
||||||
|
@ -501,6 +501,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
|||||||
$table1->head[5] = __('Status');
|
$table1->head[5] = __('Status');
|
||||||
|
|
||||||
$table1->headstyle = [];
|
$table1->headstyle = [];
|
||||||
|
$table1->headstyle[0] = 'text-align: left';
|
||||||
|
$table1->headstyle[1] = 'text-align: left';
|
||||||
$table1->headstyle[2] = 'text-align: right';
|
$table1->headstyle[2] = 'text-align: right';
|
||||||
$table1->headstyle[3] = 'text-align: right';
|
$table1->headstyle[3] = 'text-align: right';
|
||||||
$table1->headstyle[4] = 'text-align: right';
|
$table1->headstyle[4] = 'text-align: right';
|
||||||
@ -536,6 +538,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
|||||||
$table2->head[6] = __('Downtime');
|
$table2->head[6] = __('Downtime');
|
||||||
|
|
||||||
$table2->headstyle = [];
|
$table2->headstyle = [];
|
||||||
|
$table2->headstyle[0] = 'text-align: left';
|
||||||
|
$table2->headstyle[1] = 'text-align: left';
|
||||||
$table2->headstyle[2] = 'text-align: right';
|
$table2->headstyle[2] = 'text-align: right';
|
||||||
$table2->headstyle[3] = 'text-align: right';
|
$table2->headstyle[3] = 'text-align: right';
|
||||||
$table2->headstyle[4] = 'text-align: right';
|
$table2->headstyle[4] = 'text-align: right';
|
||||||
@ -548,7 +552,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
|||||||
|
|
||||||
$table3->align = [];
|
$table3->align = [];
|
||||||
$table3->align[0] = 'left';
|
$table3->align[0] = 'left';
|
||||||
$table3->align[1] = 'left';
|
$table3->align[1] = 'right';
|
||||||
$table3->align[2] = 'right';
|
$table3->align[2] = 'right';
|
||||||
$table3->align[3] = 'right';
|
$table3->align[3] = 'right';
|
||||||
$table3->align[4] = 'right';
|
$table3->align[4] = 'right';
|
||||||
@ -565,6 +569,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
|||||||
$table3->head[4] = __('Checks Unknown');
|
$table3->head[4] = __('Checks Unknown');
|
||||||
|
|
||||||
$table3->headstyle = [];
|
$table3->headstyle = [];
|
||||||
|
$table3->headstyle[0] = 'text-align: left';
|
||||||
|
$table3->headstyle[1] = 'text-align: right';
|
||||||
$table3->headstyle[2] = 'text-align: right';
|
$table3->headstyle[2] = 'text-align: right';
|
||||||
$table3->headstyle[3] = 'text-align: right';
|
$table3->headstyle[3] = 'text-align: right';
|
||||||
$table3->headstyle[4] = 'text-align: right';
|
$table3->headstyle[4] = 'text-align: right';
|
||||||
@ -721,23 +727,23 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$table1->title = $item['title'];
|
// $table1->title = $item['title'];
|
||||||
$table1->titleclass = 'title_table_pdf';
|
// $table1->titleclass = 'title_table_pdf';
|
||||||
$table1->titlestyle = 'text-align:left;';
|
// $table1->titlestyle = 'text-align:left;';
|
||||||
$return_pdf .= html_print_table(
|
$return_pdf .= html_print_table(
|
||||||
$table1,
|
$table1,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
$table2->title = $item['title'];
|
// $table2->title = $item['title'];
|
||||||
$table2->titleclass = 'title_table_pdf';
|
// $table2->titleclass = 'title_table_pdf';
|
||||||
$table2->titlestyle = 'text-align:left;';
|
// $table2->titlestyle = 'text-align:left;';
|
||||||
$return_pdf .= html_print_table(
|
$return_pdf .= html_print_table(
|
||||||
$table2,
|
$table2,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
$table3->title = $item['title'];
|
// $table3->title = $item['title'];
|
||||||
$table3->titleclass = 'title_table_pdf';
|
// $table3->titleclass = 'title_table_pdf';
|
||||||
$table3->titlestyle = 'text-align:left;';
|
// $table3->titlestyle = 'text-align:left;';
|
||||||
$return_pdf .= html_print_table(
|
$return_pdf .= html_print_table(
|
||||||
$table3,
|
$table3,
|
||||||
true
|
true
|
||||||
@ -782,9 +788,9 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$table1->title = $item['title'];
|
// $table1->title = $item['title'];
|
||||||
$table1->titleclass = 'title_table_pdf';
|
// $table1->titleclass = 'title_table_pdf';
|
||||||
$table1->titlestyle = 'text-align:left;';
|
// $table1->titlestyle = 'text-align:left;';
|
||||||
$return_pdf .= html_print_table(
|
$return_pdf .= html_print_table(
|
||||||
$table1,
|
$table1,
|
||||||
true
|
true
|
||||||
@ -2965,8 +2971,26 @@ function reporting_html_min_value(&$table, $item, $mini)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
/**
|
||||||
{
|
* Htlm report AVg, min, Max, Only.
|
||||||
|
*
|
||||||
|
* @param array $table Table.
|
||||||
|
* @param array $item Data.
|
||||||
|
* @param boolean $mini Is mini.
|
||||||
|
* @param boolean $only_value Only value.
|
||||||
|
* @param boolean $check_empty Empty.
|
||||||
|
* @param integer $pdf PDF Mode.
|
||||||
|
*
|
||||||
|
* @return string Html output.
|
||||||
|
*/
|
||||||
|
function reporting_html_value(
|
||||||
|
$table,
|
||||||
|
$item,
|
||||||
|
$mini,
|
||||||
|
$only_value=false,
|
||||||
|
$check_empty=false,
|
||||||
|
$pdf=0
|
||||||
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if ($mini) {
|
if ($mini) {
|
||||||
@ -2975,8 +2999,12 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e
|
|||||||
$font_size = $config['font_size_item_report'].'em';
|
$font_size = $config['font_size_item_report'].'em';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($item['visual_format']) && $item['visual_format'] != 0
|
$return_pdf = '';
|
||||||
&& ($item['type'] == 'max_value' || $item['type'] == 'min_value' || $item['type'] == 'avg_value')
|
|
||||||
|
if (isset($item['visual_format']) === true && $item['visual_format'] != 0
|
||||||
|
&& ($item['type'] == 'max_value'
|
||||||
|
|| $item['type'] == 'min_value'
|
||||||
|
|| $item['type'] == 'avg_value')
|
||||||
) {
|
) {
|
||||||
$table2 = new stdClass();
|
$table2 = new stdClass();
|
||||||
$table2->width = '100%';
|
$table2->width = '100%';
|
||||||
@ -2998,6 +3026,7 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'avg_value':
|
case 'avg_value':
|
||||||
|
default:
|
||||||
$table2->head = [
|
$table2->head = [
|
||||||
__('Agent'),
|
__('Agent'),
|
||||||
__('Module'),
|
__('Module'),
|
||||||
@ -3025,15 +3054,28 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e
|
|||||||
$table->colspan[2][0] = 3;
|
$table->colspan[2][0] = 3;
|
||||||
$table->colspan[3][0] = 3;
|
$table->colspan[3][0] = 3;
|
||||||
|
|
||||||
array_push($table->data, html_print_table($table2, true));
|
if ($pdf === 0) {
|
||||||
|
array_push($table->data, html_print_table($table2, true));
|
||||||
|
} else {
|
||||||
|
$return_pdf .= html_print_table($table2, true);
|
||||||
|
}
|
||||||
|
|
||||||
unset($item['data'][0]);
|
unset($item['data'][0]);
|
||||||
|
|
||||||
if ($item['visual_format'] != 1) {
|
if ($item['visual_format'] != 1) {
|
||||||
$value = $item['data'][1]['value'];
|
$value = $item['data'][1]['value'];
|
||||||
array_push($table->data, $value);
|
if ($pdf === 0) {
|
||||||
unset($item['data'][1]);
|
array_push($table->data, $value);
|
||||||
|
} else {
|
||||||
|
$style_div_pdf = 'text-align:center;margin-bottom:20px;';
|
||||||
|
$return_pdf .= '<div style="'.$style_div_pdf.'">';
|
||||||
|
$return_pdf .= $value;
|
||||||
|
$return_pdf .= '</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($item['data'][1]);
|
||||||
|
|
||||||
if ($item['visual_format'] != 2) {
|
if ($item['visual_format'] != 2) {
|
||||||
$table1 = new stdClass();
|
$table1 = new stdClass();
|
||||||
$table1->width = '100%';
|
$table1->width = '100%';
|
||||||
@ -3053,6 +3095,7 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'avg_value':
|
case 'avg_value':
|
||||||
|
default:
|
||||||
$table1->head = [
|
$table1->head = [
|
||||||
__('Lapse'),
|
__('Lapse'),
|
||||||
__('Average'),
|
__('Average'),
|
||||||
@ -3061,8 +3104,9 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e
|
|||||||
}
|
}
|
||||||
|
|
||||||
$table1->data = [];
|
$table1->data = [];
|
||||||
|
$row = [];
|
||||||
foreach ($item['data'] as $data) {
|
foreach ($item['data'] as $data) {
|
||||||
if (!is_numeric($data[__('Maximun')])) {
|
if (is_numeric($data[__('Maximun')]) === false) {
|
||||||
$row = [
|
$row = [
|
||||||
$data[__('Lapse')],
|
$data[__('Lapse')],
|
||||||
$data[__('Maximun')],
|
$data[__('Maximun')],
|
||||||
@ -3070,7 +3114,12 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e
|
|||||||
} else {
|
} else {
|
||||||
$row = [
|
$row = [
|
||||||
$data[__('Lapse')],
|
$data[__('Lapse')],
|
||||||
remove_right_zeros(number_format($data[__('Maximun')], $config['graph_precision'])),
|
remove_right_zeros(
|
||||||
|
number_format(
|
||||||
|
$data[__('Maximun')],
|
||||||
|
$config['graph_precision']
|
||||||
|
)
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3080,10 +3129,22 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e
|
|||||||
$table1->title = $item['title'];
|
$table1->title = $item['title'];
|
||||||
$table1->titleclass = 'title_table_pdf';
|
$table1->titleclass = 'title_table_pdf';
|
||||||
$table1->titlestyle = 'text-align:left;';
|
$table1->titlestyle = 'text-align:left;';
|
||||||
|
if ($pdf === 0) {
|
||||||
|
array_push($table->data, html_print_table($table1, true));
|
||||||
|
} else {
|
||||||
|
$return_pdf .= html_print_table($table1, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
array_push($table->data, html_print_table($table1, true));
|
if ($pdf !== 0) {
|
||||||
|
return $return_pdf;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if ($pdf !== 0) {
|
||||||
|
$table = new stdClass();
|
||||||
|
$table->width = '100%';
|
||||||
|
}
|
||||||
|
|
||||||
$table->colspan['data']['cell'] = 3;
|
$table->colspan['data']['cell'] = 3;
|
||||||
$table->cellstyle['data']['cell'] = 'text-align: left;';
|
$table->cellstyle['data']['cell'] = 'text-align: left;';
|
||||||
|
|
||||||
@ -3098,6 +3159,10 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e
|
|||||||
}
|
}
|
||||||
|
|
||||||
$table->data['data']['cell'] .= '</p>';
|
$table->data['data']['cell'] .= '</p>';
|
||||||
|
|
||||||
|
if ($pdf !== 0) {
|
||||||
|
return html_print_table($table, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3617,9 +3682,9 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||||||
$data[0] = html_print_table($table1, true);
|
$data[0] = html_print_table($table1, true);
|
||||||
array_push($table->data, $data);
|
array_push($table->data, $data);
|
||||||
} else {
|
} else {
|
||||||
$table1->title = $item['title'];
|
// $table1->title = $item['title'];
|
||||||
$table1->titleclass = 'title_table_pdf';
|
// $table1->titleclass = 'title_table_pdf';
|
||||||
$table1->titlestyle = 'text-align:left;';
|
// $table1->titlestyle = 'text-align:left;';
|
||||||
$return_pdf .= html_print_table($table1, true);
|
$return_pdf .= html_print_table($table1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3629,9 +3694,9 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||||||
$data2[0] = html_print_table($table2, true);
|
$data2[0] = html_print_table($table2, true);
|
||||||
array_push($table->data, $data2);
|
array_push($table->data, $data2);
|
||||||
} else {
|
} else {
|
||||||
$table2->title = $item['title'];
|
// $table2->title = $item['title'];
|
||||||
$table2->titleclass = 'title_table_pdf';
|
// $table2->titleclass = 'title_table_pdf';
|
||||||
$table2->titlestyle = 'text-align:left;';
|
// $table2->titlestyle = 'text-align:left;';
|
||||||
$return_pdf .= html_print_table($table2, true);
|
$return_pdf .= html_print_table($table2, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3699,9 +3764,9 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||||||
);
|
);
|
||||||
array_push($table->data, $data);
|
array_push($table->data, $data);
|
||||||
} else {
|
} else {
|
||||||
$table1->title = $item['title'];
|
// $table1->title = $item['title'];
|
||||||
$table1->titleclass = 'title_table_pdf';
|
// $table1->titleclass = 'title_table_pdf';
|
||||||
$table1->titlestyle = 'text-align:left;';
|
// $table1->titlestyle = 'text-align:left;';
|
||||||
$return_pdf .= html_print_table(
|
$return_pdf .= html_print_table(
|
||||||
$table1,
|
$table1,
|
||||||
true
|
true
|
||||||
|
@ -941,7 +941,7 @@ function tags_get_acl_tags_event_condition(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Group condition (The module belongs to an agent of the group X)
|
// Group condition (The module belongs to an agent of the group X)
|
||||||
// $group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_id_recursive($group_id, true))));.
|
// $group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_children_ids($group_id, true))));.
|
||||||
$group_condition = '('.$id_grupo_table_pretag.'id_grupo = '.$group_id.' OR '.$alt_id_grupo_table_pretag.'id_group = '.$group_id.')';
|
$group_condition = '('.$id_grupo_table_pretag.'id_grupo = '.$group_id.' OR '.$alt_id_grupo_table_pretag.'id_group = '.$group_id.')';
|
||||||
|
|
||||||
// Tags condition (The module has at least one of the restricted tags).
|
// Tags condition (The module has at least one of the restricted tags).
|
||||||
@ -1350,7 +1350,7 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags=[], $children
|
|||||||
foreach ($user_tags as $user_tag) {
|
foreach ($user_tags as $user_tag) {
|
||||||
$tags_user = $user_tag['tags'];
|
$tags_user = $user_tag['tags'];
|
||||||
$id_group_user = $user_tag['id_grupo'];
|
$id_group_user = $user_tag['id_grupo'];
|
||||||
$childrens = groups_get_childrens($id_group_user, null, true);
|
$childrens = groups_get_children($id_group_user, null, true);
|
||||||
|
|
||||||
if (empty($childrens)) {
|
if (empty($childrens)) {
|
||||||
$group_ids = $id_group_user;
|
$group_ids = $id_group_user;
|
||||||
@ -1421,7 +1421,7 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
|
|||||||
$tags_arr = explode(',', $tags);
|
$tags_arr = explode(',', $tags);
|
||||||
foreach ($tags_arr as $tag) {
|
foreach ($tags_arr as $tag) {
|
||||||
if ($tag == $id_tag) {
|
if ($tag == $id_tag) {
|
||||||
$hierarchy_groups = groups_get_id_recursive($group_id);
|
$hierarchy_groups = groups_get_children_ids($group_id);
|
||||||
$groups_id = array_merge($groups_id, $hierarchy_groups);
|
$groups_id = array_merge($groups_id, $hierarchy_groups);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1923,7 +1923,7 @@ function tags_get_monitors_counter($id_tag, $groups_and_tags=[], $agent_filter=[
|
|||||||
$tags_arr = explode(',', $tags);
|
$tags_arr = explode(',', $tags);
|
||||||
foreach ($tags_arr as $tag) {
|
foreach ($tags_arr as $tag) {
|
||||||
if ($tag == $id_tag) {
|
if ($tag == $id_tag) {
|
||||||
$hierarchy_groups = groups_get_id_recursive($group_id);
|
$hierarchy_groups = groups_get_children_ids($group_id);
|
||||||
$groups_id = array_merge($groups_id, $hierarchy_groups);
|
$groups_id = array_merge($groups_id, $hierarchy_groups);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2219,7 +2219,7 @@ function tags_monitors_fired_alerts($id_tag, $groups_and_tags=[], $id_agente=fal
|
|||||||
$tags_arr = explode(',', $tags);
|
$tags_arr = explode(',', $tags);
|
||||||
foreach ($tags_arr as $tag) {
|
foreach ($tags_arr as $tag) {
|
||||||
if ($tag == $id_tag) {
|
if ($tag == $id_tag) {
|
||||||
$hierarchy_groups = groups_get_id_recursive($group_id);
|
$hierarchy_groups = groups_get_children_ids($group_id);
|
||||||
$groups_id = array_merge($groups_id, $hierarchy_groups);
|
$groups_id = array_merge($groups_id, $hierarchy_groups);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2283,7 +2283,7 @@ function tags_get_monitors_alerts($id_tag, $groups_and_tags=[], $id_agente=false
|
|||||||
$tags_arr = explode(',', $tags);
|
$tags_arr = explode(',', $tags);
|
||||||
foreach ($tags_arr as $tag) {
|
foreach ($tags_arr as $tag) {
|
||||||
if ($tag == $id_tag) {
|
if ($tag == $id_tag) {
|
||||||
$hierarchy_groups = groups_get_id_recursive($group_id);
|
$hierarchy_groups = groups_get_children_ids($group_id);
|
||||||
$groups_id = array_merge($groups_id, $hierarchy_groups);
|
$groups_id = array_merge($groups_id, $hierarchy_groups);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2024,7 +2024,7 @@ function getServerUrl() {
|
|||||||
server_url = get_php_value("homeurl");
|
server_url = get_php_value("homeurl");
|
||||||
} catch (SyntaxError) {
|
} catch (SyntaxError) {
|
||||||
console.warn("Pandora homeurl cannot be found.");
|
console.warn("Pandora homeurl cannot be found.");
|
||||||
server_url = window.location.origin + "/pandora_console";
|
server_url = $("#hidden-homeurl").val();
|
||||||
}
|
}
|
||||||
return server_url;
|
return server_url;
|
||||||
}
|
}
|
||||||
|
@ -637,7 +637,20 @@ var TreeController = {
|
|||||||
.css("cursor", "pointer");
|
.css("cursor", "pointer");
|
||||||
|
|
||||||
$content.append($serviceDetailImage);
|
$content.append($serviceDetailImage);
|
||||||
$content.append(" " + element.name);
|
if (
|
||||||
|
typeof element.elementDescription !== "undefined" &&
|
||||||
|
element.elementDescription != ""
|
||||||
|
) {
|
||||||
|
$content.append(" " + element.elementDescription);
|
||||||
|
} else if (
|
||||||
|
typeof element.description !== "undefined" &&
|
||||||
|
element.description != ""
|
||||||
|
) {
|
||||||
|
$content.append(" " + element.description);
|
||||||
|
} else {
|
||||||
|
$content.append(" " + element.name);
|
||||||
|
}
|
||||||
|
// $content.append(" " + element.name);
|
||||||
} else {
|
} else {
|
||||||
$content.remove($node);
|
$content.remove($node);
|
||||||
}
|
}
|
||||||
|
@ -278,6 +278,11 @@ class TopNEventByGroupWidget extends Widget
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Groups.
|
// Groups.
|
||||||
|
$selected_groups = [];
|
||||||
|
if ($values['groupId']) {
|
||||||
|
$selected_groups = explode(',', $values['groupId'][0]);
|
||||||
|
}
|
||||||
|
|
||||||
$inputs[] = [
|
$inputs[] = [
|
||||||
'label' => __('Groups'),
|
'label' => __('Groups'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
@ -285,7 +290,7 @@ class TopNEventByGroupWidget extends Widget
|
|||||||
'name' => 'groupId[]',
|
'name' => 'groupId[]',
|
||||||
'returnAllGroup' => true,
|
'returnAllGroup' => true,
|
||||||
'privilege' => 'AR',
|
'privilege' => 'AR',
|
||||||
'selected' => explode(',', $values['groupId'][0]),
|
'selected' => $selected_groups,
|
||||||
'return' => true,
|
'return' => true,
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
],
|
],
|
||||||
|
@ -277,6 +277,11 @@ class TopNEventByModuleWidget extends Widget
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$selected_groups = [];
|
||||||
|
if ($values['groupId']) {
|
||||||
|
$selected_groups = explode(',', $values['groupId'][0]);
|
||||||
|
}
|
||||||
|
|
||||||
// Groups.
|
// Groups.
|
||||||
$inputs[] = [
|
$inputs[] = [
|
||||||
'label' => __('Groups'),
|
'label' => __('Groups'),
|
||||||
@ -285,7 +290,7 @@ class TopNEventByModuleWidget extends Widget
|
|||||||
'name' => 'groupId[]',
|
'name' => 'groupId[]',
|
||||||
'returnAllGroup' => true,
|
'returnAllGroup' => true,
|
||||||
'privilege' => 'AR',
|
'privilege' => 'AR',
|
||||||
'selected' => explode(',', $values['groupId'][0]),
|
'selected' => $selected_groups,
|
||||||
'return' => true,
|
'return' => true,
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
],
|
],
|
||||||
|
@ -1480,6 +1480,7 @@ table.databox {
|
|||||||
padding: 9px 7px;
|
padding: 9px 7px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
text-align: justify;
|
||||||
}
|
}
|
||||||
|
|
||||||
.databox > th * {
|
.databox > th * {
|
||||||
|
@ -11,6 +11,10 @@ ul.wizard {
|
|||||||
ul.wizard li {
|
ul.wizard li {
|
||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.wizard li > label:not(.p-switch) {
|
ul.wizard li > label:not(.p-switch) {
|
||||||
|
@ -129,7 +129,7 @@
|
|||||||
<div style='height: 10px'>
|
<div style='height: 10px'>
|
||||||
<?php
|
<?php
|
||||||
$version = '7.0NG.750';
|
$version = '7.0NG.750';
|
||||||
$build = '201027';
|
$build = '201029';
|
||||||
$banner = "v$version Build $build";
|
$banner = "v$version Build $build";
|
||||||
|
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
|
@ -546,7 +546,7 @@ if (!empty($search_custom)) {
|
|||||||
if ($group_id > 0) {
|
if ($group_id > 0) {
|
||||||
$groups = [$group_id];
|
$groups = [$group_id];
|
||||||
if ($recursion) {
|
if ($recursion) {
|
||||||
$groups = groups_get_id_recursive($group_id, true);
|
$groups = groups_get_children_ids($group_id, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$groups = [];
|
$groups = [];
|
||||||
@ -576,7 +576,7 @@ if ($strict_user) {
|
|||||||
if ($group_id > 0) {
|
if ($group_id > 0) {
|
||||||
$groups = [$group_id];
|
$groups = [$group_id];
|
||||||
if ($recursion) {
|
if ($recursion) {
|
||||||
$groups = groups_get_id_recursive($group_id, true);
|
$groups = groups_get_children_ids($group_id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter['id_group'] = implode(',', $groups);
|
$filter['id_group'] = implode(',', $groups);
|
||||||
|
@ -88,7 +88,7 @@ if (is_ajax()) {
|
|||||||
|
|
||||||
if ($get_agents_group_json) {
|
if ($get_agents_group_json) {
|
||||||
$id_group = (int) get_parameter('id_group');
|
$id_group = (int) get_parameter('id_group');
|
||||||
$recursion = (bool) get_parameter('recursion');
|
$recursion = (get_parameter_switch('recursion', 'false') === 'true');
|
||||||
$id_os = get_parameter('id_os', '');
|
$id_os = get_parameter('id_os', '');
|
||||||
$agent_name = get_parameter('name', '');
|
$agent_name = get_parameter('name', '');
|
||||||
|
|
||||||
@ -146,14 +146,24 @@ if (is_ajax()) {
|
|||||||
|
|
||||||
// Perform search.
|
// Perform search.
|
||||||
$agents = agents_get_group_agents(
|
$agents = agents_get_group_agents(
|
||||||
|
// Id_group.
|
||||||
$id_group,
|
$id_group,
|
||||||
|
// Search.
|
||||||
$filter,
|
$filter,
|
||||||
|
// Case.
|
||||||
'lower',
|
'lower',
|
||||||
false,
|
// NoACL.
|
||||||
|
true,
|
||||||
|
// ChildGroups.
|
||||||
$recursion,
|
$recursion,
|
||||||
|
// Serialized.
|
||||||
false,
|
false,
|
||||||
|
// Separator.
|
||||||
'|',
|
'|',
|
||||||
$cluster_mode
|
// Add_alert_bulk_op.
|
||||||
|
$cluster_mode,
|
||||||
|
// Force_serialized.
|
||||||
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
if (empty($agents)) {
|
if (empty($agents)) {
|
||||||
|
@ -28,7 +28,7 @@ if ($id_group > 0) {
|
|||||||
if ($propagate) {
|
if ($propagate) {
|
||||||
$childrens_ids = [$id_group];
|
$childrens_ids = [$id_group];
|
||||||
|
|
||||||
$childrens = groups_get_childrens($id_group, null, true);
|
$childrens = groups_get_children($id_group, null, true);
|
||||||
|
|
||||||
if (!empty($childrens)) {
|
if (!empty($childrens)) {
|
||||||
foreach ($childrens as $child) {
|
foreach ($childrens as $child) {
|
||||||
|
@ -358,6 +358,21 @@ if (is_ajax()) {
|
|||||||
$tmp->comments = ui_print_comments($tmp->comments);
|
$tmp->comments = ui_print_comments($tmp->comments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show last event.
|
||||||
|
if (isset($tmp->max_id_evento) && $tmp->max_id_evento !== $tmp->id_evento) {
|
||||||
|
$max_event = db_get_row_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT criticity, timestamp FROM %s
|
||||||
|
WHERE id_evento = %s',
|
||||||
|
($tmp->meta) ? 'tmetaconsole_event' : 'tevento',
|
||||||
|
$tmp->max_id_evento
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$tmp->timestamp = $max_event['timestamp'];
|
||||||
|
$tmp->criticity = $max_event['criticity'];
|
||||||
|
}
|
||||||
|
|
||||||
$tmp->agent_name = io_safe_output($tmp->agent_name);
|
$tmp->agent_name = io_safe_output($tmp->agent_name);
|
||||||
$tmp->ack_utimestamp = ui_print_timestamp(
|
$tmp->ack_utimestamp = ui_print_timestamp(
|
||||||
$tmp->ack_utimestamp,
|
$tmp->ack_utimestamp,
|
||||||
|
@ -43,6 +43,8 @@ enterprise_include('index.php');
|
|||||||
$url_css = ui_get_full_url('include/styles/visual_maps.css', false, false, false);
|
$url_css = ui_get_full_url('include/styles/visual_maps.css', false, false, false);
|
||||||
echo '<link rel="stylesheet" href="'.$url_css.'" type="text/css" />';
|
echo '<link rel="stylesheet" href="'.$url_css.'" type="text/css" />';
|
||||||
|
|
||||||
|
html_print_input_hidden('homeurl', $config['homeurl']);
|
||||||
|
|
||||||
$url_css_modal = ui_get_full_url('include/styles/register.css', false, false, false);
|
$url_css_modal = ui_get_full_url('include/styles/register.css', false, false, false);
|
||||||
echo '<link rel="stylesheet" href="'.$url_css_modal.'" type="text/css" />';
|
echo '<link rel="stylesheet" href="'.$url_css_modal.'" type="text/css" />';
|
||||||
// Connection lost alert.
|
// Connection lost alert.
|
||||||
|
@ -31,6 +31,8 @@ require_once $config['homedir'].'/vendor/autoload.php';
|
|||||||
ui_require_css_file('visual_maps');
|
ui_require_css_file('visual_maps');
|
||||||
ui_require_css_file('register');
|
ui_require_css_file('register');
|
||||||
|
|
||||||
|
html_print_input_hidden('homeurl', $config['homeurl']);
|
||||||
|
|
||||||
// Connection lost alert.
|
// Connection lost alert.
|
||||||
$conn_title = __('Connection with server has been lost');
|
$conn_title = __('Connection with server has been lost');
|
||||||
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.750
|
%define version 7.0NG.750
|
||||||
%define release 201027
|
%define release 201029
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.750
|
%define version 7.0NG.750
|
||||||
%define release 201027
|
%define release 201029
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.750
|
%define version 7.0NG.750
|
||||||
%define release 201027
|
%define release 201029
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name apache2
|
%define httpd_name apache2
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-server
|
package: pandorafms-server
|
||||||
Version: 7.0NG.750-201027
|
Version: 7.0NG.750-201029
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.750-201027"
|
pandora_version="7.0NG.750-201029"
|
||||||
|
|
||||||
package_cpan=0
|
package_cpan=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
|||||||
|
|
||||||
# version: Defines actual version of Pandora Server for this module only
|
# version: Defines actual version of Pandora Server for this module only
|
||||||
my $pandora_version = "7.0NG.750";
|
my $pandora_version = "7.0NG.750";
|
||||||
my $pandora_build = "201027";
|
my $pandora_build = "201029";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
# Setup hash
|
# Setup hash
|
||||||
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
|||||||
|
|
||||||
# version: Defines actual version of Pandora Server for this module only
|
# version: Defines actual version of Pandora Server for this module only
|
||||||
my $pandora_version = "7.0NG.750";
|
my $pandora_version = "7.0NG.750";
|
||||||
my $pandora_build = "201027";
|
my $pandora_build = "201029";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.750
|
%define version 7.0NG.750
|
||||||
%define release 201027
|
%define release 201029
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.750
|
%define version 7.0NG.750
|
||||||
%define release 201027
|
%define release 201029
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.750"
|
PI_VERSION="7.0NG.750"
|
||||||
PI_BUILD="201027"
|
PI_BUILD="201029"
|
||||||
|
|
||||||
MODE=$1
|
MODE=$1
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
|||||||
use PandoraFMS::DB;
|
use PandoraFMS::DB;
|
||||||
|
|
||||||
# version: define current version
|
# version: define current version
|
||||||
my $version = "7.0NG.750 PS201027";
|
my $version = "7.0NG.750 PS201029";
|
||||||
|
|
||||||
# Pandora server configuration
|
# Pandora server configuration
|
||||||
my %conf;
|
my %conf;
|
||||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||||||
Encode::Locale::decode_argv;
|
Encode::Locale::decode_argv;
|
||||||
|
|
||||||
# version: define current version
|
# version: define current version
|
||||||
my $version = "7.0NG.750 PS201027";
|
my $version = "7.0NG.750 PS201029";
|
||||||
|
|
||||||
# save program name for logging
|
# save program name for logging
|
||||||
my $progname = basename($0);
|
my $progname = basename($0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user