Merge branch 'develop' into ent-3779-7612-Revision-de-llamadas-a-api-y-cli-agent-name-alias-name

This commit is contained in:
alejandro-campos 2019-10-21 09:43:43 +02:00
commit 6cf08dde1e
85 changed files with 8232 additions and 819 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.739-190927
Version: 7.0NG.739-191018
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.739"
PI_BUILD="190927"
PI_BUILD="191018"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{190927}
{191018}
ViewReadme
{Yes}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.739-190927
Version: 7.0NG.739-191018
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -239,17 +239,18 @@ function output_xml_report($id)
echo '<column_separator><![CDATA['.io_safe_output($item['header_definition']).']]></column_separator>';
break;
case 'TTRT':
break;
/*
case 'TTRT':
break;
case 'TTO':
break;
case 'TTO':
break;
case 'MTBF':
break;
case 'MTBF':
break;
case 'MTTR':
break;
case 'MTTR':
break;*/
}
echo "</item>\n";

View File

@ -376,17 +376,18 @@ function process_upload_xml_report($xml, $group_filter=0)
$values['column_separator'] = io_safe_input($item['column_separator']);
break;
case 'TTRT':
break;
/*
case 'TTRT':
break;
case 'TTO':
break;
case 'TTO':
break;
case 'MTBF':
break;
case 'MTBF':
break;
case 'MTTR':
break;
case 'MTTR':
break;*/
}
if (empty($agents_item)) {

View File

@ -765,7 +765,7 @@ $table_adv_agent_icon .= html_print_select(
).'</div>';
if ($config['activate_gis']) {
$table_adv_gis = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Ignore new GIS data:').'</p>';
$table_adv_gis = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Update new GIS data:').'</p>';
if ($new_agent) {
$update_gis_data = true;
}

View File

@ -1382,8 +1382,8 @@ if ($update_module || $create_module) {
$ff_event_normal = (int) get_parameter('ff_event_normal');
$ff_event_warning = (int) get_parameter('ff_event_warning');
$ff_event_critical = (int) get_parameter('ff_event_critical');
$ff_type = (int) get_parameter('ff_type');
$each_ff = (int) get_parameter('each_ff');
$ff_type = (int) get_parameter('ff_type', $module['ff_type']);
$each_ff = (int) get_parameter('each_ff', $module['each_ff']);
$ff_timeout = (int) get_parameter('ff_timeout');
$unit = (string) get_parameter('unit');
$id_tag = (array) get_parameter('id_tag_selected');

View File

@ -1191,49 +1191,54 @@ $table_relations->data[-1][3] .= html_print_image('images/lock.png', true).'</a>
$table_relations->data[-1][4] = '<a id="delete_relation_button" href="">';
$table_relations->data[-1][4] .= html_print_image('images/cross.png', true).'</a>';
$module_relations = modules_get_relations(['id_module' => $id_agent_module]);
if (!$module_relations) {
$module_relations = [];
}
$relations_count = 0;
foreach ($module_relations as $key => $module_relation) {
if ($module_relation['module_a'] == $id_agent_module) {
$module_id = $module_relation['module_b'];
$agent_id = modules_give_agent_id_from_module_id(
$module_relation['module_b']
);
} else {
$module_id = $module_relation['module_a'];
$agent_id = modules_give_agent_id_from_module_id(
$module_relation['module_a']
);
if ($id_agent_module) {
$module_relations = modules_get_relations(['id_module' => $id_agent_module]);
if (!$module_relations) {
$module_relations = [];
}
$agent_name = ui_print_agent_name($agent_id, true);
$relations_count = 0;
foreach ($module_relations as $key => $module_relation) {
if ($module_relation['module_a'] == $id_agent_module) {
$module_id = $module_relation['module_b'];
$agent_id = modules_give_agent_id_from_module_id(
$module_relation['module_b']
);
} else {
$module_id = $module_relation['module_a'];
$agent_id = modules_give_agent_id_from_module_id(
$module_relation['module_a']
);
}
$module_name = modules_get_agentmodule_name($module_id);
if (empty($module_name) || $module_name == 'false') {
$module_name = $module_id;
$agent_name = ui_print_agent_name($agent_id, true);
$module_name = modules_get_agentmodule_name($module_id);
if (empty($module_name) || $module_name == 'false') {
$module_name = $module_id;
}
if ($module_relation['disable_update']) {
$disabled_update_class = '';
} else {
$disabled_update_class = 'alpha50';
}
// Agent name.
$table_relations->data[$relations_count][0] = $agent_name;
// Module name.
$table_relations->data[$relations_count][1] = "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$agent_id.'&tab=module&edit_module=1&id_agent_module='.$module_id."'>".ui_print_truncate_text($module_name, 'module_medium', true, true, true, '[&hellip;]').'</a>';
// Type.
$table_relations->data[$relations_count][2] = ($module_relation['type'] === 'direct') ? __('Direct') : __('Failover');
// Lock relationship updates.
$table_relations->data[$relations_count][3] = '<a id="disable_updates_button" class="'.$disabled_update_class.'"href="javascript: change_lock_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/lock.png', true).'</a>';
// Delete relationship.
$table_relations->data[$relations_count][4] = '<a id="delete_relation_button" href="javascript: delete_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/cross.png', true).'</a>';
$relations_count++;
}
if ($module_relation['disable_update']) {
$disabled_update_class = '';
} else {
$disabled_update_class = 'alpha50';
}
// Agent name.
$table_relations->data[$relations_count][0] = $agent_name;
// Module name.
$table_relations->data[$relations_count][1] = "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$agent_id.'&tab=module&edit_module=1&id_agent_module='.$module_id."'>".ui_print_truncate_text($module_name, 'module_medium', true, true, true, '[&hellip;]').'</a>';
// Type.
$table_relations->data[$relations_count][2] = ($module_relation['type'] === 'direct') ? __('Direct') : __('Failover');
// Lock relationship updates.
$table_relations->data[$relations_count][3] = '<a id="disable_updates_button" class="'.$disabled_update_class.'"href="javascript: change_lock_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/lock.png', true).'</a>';
// Delete relationship.
$table_relations->data[$relations_count][4] = '<a id="delete_relation_button" href="javascript: delete_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/cross.png', true).'</a>';
$relations_count++;
}
html_print_input_hidden('module_relations_count', $relations_count);

View File

@ -59,8 +59,10 @@ if ($update_agents) {
$values['id_grupo'] = get_parameter('group');
}
if (get_parameter('interval', 0) != 0) {
$values['intervalo'] = get_parameter('interval');
if (!(get_parameter('interval_select') == -1 && empty(get_parameter('interval_text')))) {
if (get_parameter('interval', 0) != 0) {
$values['intervalo'] = get_parameter('interval');
}
}
if (get_parameter('id_os', '') != -1) {
@ -199,7 +201,7 @@ if ($update_agents) {
}
// Update the configuration files.
if ($result && ($old_interval_value != $values['intervalo'])) {
if ($result && ($old_interval_value != $values['intervalo']) && !empty($values['intervalo'])) {
enterprise_hook(
'config_agents_update_config_token',
[
@ -523,7 +525,7 @@ $table->data[1][1] = html_print_select_groups(false, 'AR', false, 'group', $grou
$table->data[2][0] = __('Interval');
$table->data[2][1] = html_print_extended_select_for_time('interval', 0, '', __('No change'), '0', 10, true, 'width: 150px');
$table->data[2][1] = html_print_extended_select_for_time('interval', 0, '', __('No change'), '0', 10, true, 'width: 150px', false);
$table->data[3][0] = __('OS');
$table->data[3][1] = html_print_select_from_sql(

View File

@ -21,27 +21,42 @@ require_once 'include/functions_menu.php';
$menu_godmode = [];
$menu_godmode['class'] = 'godmode';
if (check_acl($config['id_user'], 0, 'PM')) {
if (check_acl($config['id_user'], 0, 'AR')
|| check_acl($config['id_user'], 0, 'AW')
|| check_acl($config['id_user'], 0, 'RR')
|| check_acl($config['id_user'], 0, 'RW')
|| check_acl($config['id_user'], 0, 'PM')
) {
$sub = [];
$sub['godmode/servers/discovery&wiz=main']['text'] = __('Main');
$sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery';
$sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list');
$sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist';
$sub2 = [];
$sub2['godmode/servers/discovery&wiz=hd&mode=netscan']['text'] = __('Network scan');
enterprise_hook('hostdevices_submenu');
$sub2['godmode/servers/discovery&wiz=hd&mode=customnetscan']['text'] = __('Custom network scan');
$sub2['godmode/servers/discovery&wiz=hd&mode=managenetscanscripts']['text'] = __('Manage scan scripts');
$sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
$sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
$sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
if (check_acl($config['id_user'], 0, 'AW')
|| check_acl($config['id_user'], 0, 'PM')
) {
if (check_acl($config['id_user'], 0, 'AW')) {
$sub2 = [];
$sub2['godmode/servers/discovery&wiz=hd&mode=netscan']['text'] = __('Network scan');
enterprise_hook('hostdevices_submenu');
$sub2['godmode/servers/discovery&wiz=hd&mode=customnetscan']['text'] = __('Custom network scan');
}
enterprise_hook('applications_menu');
enterprise_hook('cloud_menu');
enterprise_hook('console_task_menu');
if (check_acl($config['id_user'], 0, 'PM')) {
$sub2['godmode/servers/discovery&wiz=hd&mode=managenetscanscripts']['text'] = __('Manage scan scripts');
}
$sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
$sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
$sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
}
if (check_acl($config['id_user'], 0, 'AW')) {
enterprise_hook('applications_menu');
enterprise_hook('cloud_menu');
enterprise_hook('console_task_menu');
}
// Add to menu.
$menu_godmode['discovery']['text'] = __('Discovery');
@ -92,7 +107,7 @@ if (!empty($sub)) {
}
$sub = [];
if (check_acl($config['id_user'], 0, 'AW')) {
if (check_acl($config['id_user'], 0, 'PM')) {
$sub['godmode/groups/group_list']['text'] = __('Manage agents groups');
$sub['godmode/groups/group_list']['id'] = 'Manage agents groups';
}
@ -384,9 +399,6 @@ if (is_array($config['extensions'])) {
if (strlen($extmenu['fatherId']) > 0) {
if (array_key_exists('subfatherId', $extmenu)) {
if (strlen($extmenu['subfatherId']) > 0) {
if ($extmenu['name'] = 'DB schema check') {
}
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['text'] = __($extmenu['name']);
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['id'] = $extmenu['name'];
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['refr'] = 0;

View File

@ -16,10 +16,10 @@ global $config;
// Check user credentials
check_login();
if (! check_acl($config['id_user'], 0, 'RR')) {
if (! check_acl($config['id_user'], 0, 'RR') || enterprise_installed() === false) {
db_pandora_audit(
'ACL Violation',
'Trying to access Inventory Module Management'
'Trying to access Graph container'
);
include 'general/noaccess.php';
return;

View File

@ -71,10 +71,12 @@ switch ($activeTab) {
break;
}
$buttons['graph_container'] = [
'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">'.html_print_image('images/graph-container.png', true, ['title' => __('Graphs containers')]).'</a>',
];
if ($enterpriseEnable) {
$buttons['graph_container'] = [
'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">'.html_print_image('images/graph-container.png', true, ['title' => __('Graphs containers')]).'</a>',
];
}
$delete_graph = (bool) get_parameter('delete_graph');
$view_graph = (bool) get_parameter('view_graph');
@ -257,11 +259,6 @@ $table_aux = new stdClass();
$table->cellspacing = 0;
$table->align = [];
$table->head = [];
if ($report_w || $report_m) {
$table->align[5] = 'left';
$table->head[5] = html_print_checkbox('all_delete', 0, false, true, false);
$table->size[5] = '20px';
}
$table->head[0] = __('Graph name');
$table->head[1] = __('Description');
@ -280,6 +277,12 @@ $table_aux = new stdClass();
$table->size[4] = '90px';
}
if ($report_w || $report_m) {
$table->align[5] = 'left';
$table->head[5] = html_print_checkbox('all_delete', 0, false, true, false);
$table->size[5] = '20px';
}
$table->data = [];
$result_graphs = array_slice($graphs, $offset, $config['block_size']);
@ -287,10 +290,6 @@ $table_aux = new stdClass();
foreach ($result_graphs as $graph) {
$data = [];
if ($report_m) {
$data[5] .= html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
}
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text($graph['name'], 70).'</a>';
$data[1] = ui_print_truncate_text($graph['description'], 70);
@ -309,6 +308,10 @@ $table_aux = new stdClass();
return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).'</a>';
}
if ($report_m) {
$data[5] .= html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
}
array_push($table->data, $data);
}

View File

@ -233,6 +233,8 @@ switch ($action) {
$style = json_decode(io_safe_output($item['style']), true);
$name_from_template = $style['name_label'];
$show_in_same_row = $style['show_in_same_row'];
$show_in_landscape = $style['show_in_landscape'];
$hide_notinit_agents = $style['hide_notinit_agents'];
@ -480,7 +482,8 @@ switch ($action) {
$period = $item['period'];
break;
case 'TTRT':
/*
case 'TTRT':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = db_get_value_filter(
@ -489,9 +492,9 @@ switch ($action) {
['id_agente_modulo' => $idAgentModule]
);
$period = $item['period'];
break;
break;
case 'TTO':
case 'TTO':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = db_get_value_filter(
@ -500,9 +503,9 @@ switch ($action) {
['id_agente_modulo' => $idAgentModule]
);
$period = $item['period'];
break;
break;
case 'MTBF':
case 'MTBF':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = db_get_value_filter(
@ -511,9 +514,9 @@ switch ($action) {
['id_agente_modulo' => $idAgentModule]
);
$period = $item['period'];
break;
break;
case 'MTTR':
case 'MTTR':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = db_get_value_filter(
@ -522,8 +525,8 @@ switch ($action) {
['id_agente_modulo' => $idAgentModule]
);
$period = $item['period'];
break;
break;
*/
case 'alert_report_module':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
@ -788,10 +791,11 @@ switch ($action) {
case 'avg_value':
case 'projection_graph':
case 'prediction_date':
case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':
/*
case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':*/
case 'simple_baseline_graph':
case 'event_report_log':
case 'increment':
@ -869,18 +873,33 @@ $class = 'databox filters';
</td>
<td style="">
<?php
html_print_input_text(
'name',
$name,
'',
80,
100,
false,
false,
false,
'',
'fullwidth'
);
if ($name_from_template != '') {
html_print_input_text(
'name',
$name_from_template,
'',
80,
100,
false,
false,
false,
'',
'fullwidth'
);
} else {
html_print_input_text(
'name',
$name,
'',
80,
100,
false,
false,
false,
'',
'fullwidth'
);
}
?>
</td>
</tr>
@ -3738,10 +3757,10 @@ $(document).ready (function () {
case 'event_report_module':
case 'simple_graph':
case 'simple_baseline_graph':
case 'TTRT':
/* case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':
case 'MTTR':*/
case 'prediction_date':
case 'projection_graph':
case 'avg_value':
@ -3779,10 +3798,10 @@ $(document).ready (function () {
case 'event_report_module':
case 'simple_graph':
case 'simple_baseline_graph':
case 'TTRT':
/* case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':
case 'MTTR':*/
case 'prediction_date':
case 'projection_graph':
case 'avg_value':
@ -4814,7 +4833,7 @@ function chooseType() {
$("#row_period").show();
$("#row_historical_db_check").hide();
break;
/*
case 'TTRT':
$("#row_description").show();
$("#row_agent").show();
@ -4845,7 +4864,7 @@ function chooseType() {
$("#row_module").show();
$("#row_period").show();
$("#row_historical_db_check").hide();
break;
break;*/
case 'alert_report_module':
$("#row_description").show();
@ -5199,10 +5218,10 @@ function chooseType() {
case 'min_value':
case 'max_value':
case 'avg_value':
case 'TTRT':
/* case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':
case 'MTTR':*/
case 'simple_baseline_graph':
$("#row_label").show();
break;

View File

@ -489,11 +489,18 @@ foreach ($items as $item) {
$row[4] = '-';
}
if ($item['name'] == '' && $item['description'] == '') {
$row[5] = '-';
} else {
$text = empty($item['name']) ? $item['description'] : $item['name'];
$style = json_decode(io_safe_output($item['style']), true);
if ($style['name_label'] != '') {
$text = empty($style['name_label']) ? $item['description'] : $style['name_label'];
$row[5] = ui_print_truncate_text($text, 'description', true, true);
} else {
if ($item['name'] == '' && $item['description'] == '') {
$row[5] = '-';
} else {
$text = empty($item['name']) ? $item['description'] : $item['name'];
$row[5] = ui_print_truncate_text($text, 'description', true, true);
}
}
$row[6] = '';

View File

@ -2006,10 +2006,11 @@ switch ($action) {
case 'avg_value':
case 'projection_graph':
case 'prediction_date':
case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':
/*
case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':*/
case 'simple_baseline_graph':
case 'nt_top_n':
if ($label != '') {
@ -2612,10 +2613,11 @@ switch ($action) {
case 'avg_value':
case 'projection_graph':
case 'prediction_date':
case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':
/*
case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':*/
case 'simple_baseline_graph':
case 'nt_top_n':
if ($label != '') {
@ -3142,17 +3144,19 @@ if ($enterpriseEnable && defined('METACONSOLE')) {
break;
}
ui_print_page_header(
$textReportName,
'images/op_reporting.png',
false,
$helpers,
false,
$buttons,
false,
'',
60
);
if ($action !== 'update') {
ui_print_page_header(
$textReportName,
'images/op_reporting.png',
false,
$helpers,
false,
$buttons,
false,
'',
60
);
}
}
if ($resultOperationDB !== null) {
@ -3174,6 +3178,24 @@ if ($resultOperationDB !== null) {
__('Successfull action'),
__('Unsuccessful action<br><br>'.$err)
);
if ($action == 'update') {
$buttons[$activeTab]['active'] = false;
$activeTab = 'list_items';
$buttons[$activeTab]['active'] = true;
ui_print_page_header(
$textReportName,
'images/op_reporting.png',
false,
$helpers,
false,
$buttons,
false,
'',
60
);
}
}
switch ($activeTab) {

View File

@ -4,7 +4,14 @@ global $config;
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
if (! check_acl($config['id_user'], 0, 'AR')
&& ! check_acl($config['id_user'], 0, 'AW')
&& ! check_acl($config['id_user'], 0, 'AM')
&& ! check_acl($config['id_user'], 0, 'RR')
&& ! check_acl($config['id_user'], 0, 'RW')
&& ! check_acl($config['id_user'], 0, 'RM')
&& ! check_acl($config['id_user'], 0, 'PM')
) {
db_pandora_audit(
'ACL Violation',
'Trying to access Server Management'
@ -134,11 +141,18 @@ if ($classname_selected === null) {
$classname = basename($classpath, '.class.php');
$obj = new $classname();
$button = $obj->load();
if ($button === false) {
// No acess, skip.
continue;
}
// DiscoveryTaskList must be first button.
if ($classname == 'DiscoveryTaskList') {
array_unshift($wiz_data, $obj->load());
array_unshift($wiz_data, $button);
} else {
$wiz_data[] = $obj->load();
$wiz_data[] = $button;
}
}

View File

@ -928,10 +928,10 @@ if (($create != '') || ($view != '')) {
$other['plugin_type'] = $plugin_meta['plugin_type'];
$other['macros'] = urlencode($plugin_meta['macros']);
$other['parameters'] = urlencode($plugin_meta['parameters']);
$other = implode('%7C', $other);
$other = implode('%7E', $other);
$auth_token = json_decode($value['auth_token']);
$url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7C&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password";
$url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7E&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password";
$file_path = realpath($plugin_meta['execute']);
$post = '';
if (file_exists($file_path)) {

View File

@ -502,7 +502,7 @@ $table_remote->data['integria_test'] = $row;
// Print.
echo '<div style="text-align: center; padding-bottom: 20px;">';
echo '<a target="_blank" rel="noopener noreferrer" href="http://ehorus.com">';
echo '<a target="_blank" rel="noopener noreferrer" href="http://integriaims.com">';
html_print_image('images/integria_logo.png');
echo '</a>';
echo '<br />';

View File

@ -828,7 +828,7 @@ $values = [
0 => __('No'),
];
$table->data[12][0] = __('Home screen').ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type sec=estado&sec2=operation/agentes/estado_agente to show agent detail view'), true);
$table->data[12][0] = __('Home screen').ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 to show agent detail view'), true);
$values = [
'Default' => __('Default'),
'Visual console' => __('Visual console'),

View File

@ -200,7 +200,7 @@ class DiscoveryTaskList extends Wizard
{
global $config;
if (! check_acl($config['id_user'], 0, 'PM')) {
if (! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit(
'ACL Violation',
'Trying to access recon task viewer'
@ -241,7 +241,7 @@ class DiscoveryTaskList extends Wizard
{
global $config;
if (! check_acl($config['id_user'], 0, 'PM')) {
if (!$this->aclMulticheck('RR|RW|RM|PM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access recon task viewer'
@ -270,7 +270,7 @@ class DiscoveryTaskList extends Wizard
{
global $config;
if (! check_acl($config['id_user'], 0, 'PM')) {
if (! check_acl($config['id_user'], 0, 'RM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access recon task viewer'
@ -313,13 +313,9 @@ class DiscoveryTaskList extends Wizard
check_login();
if (! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access recon task viewer'
);
include 'general/noaccess.php';
return false;
if (!$this->aclMulticheck('AR|AW|AM')) {
// Tasklist are allowed only of agent managers.
return '';
}
// Get all discovery servers.
@ -341,7 +337,7 @@ class DiscoveryTaskList extends Wizard
// --------------------------------
// FORCE A RECON TASK
// --------------------------------
if (check_acl($config['id_user'], 0, 'PM')) {
if (check_acl($config['id_user'], 0, 'AW')) {
if (isset($_GET['force'])) {
$id = (int) get_parameter_get('force', 0);
servers_force_recon_task($id);
@ -387,8 +383,10 @@ class DiscoveryTaskList extends Wizard
// Operations.
$table->headstyle[9] .= 'min-width: 150px; width: 150px;';
$table->head[0] = __('Force');
$table->align[0] = 'left';
if (check_acl($config['id_user'], 0, 'AW')) {
$table->head[0] = __('Force');
$table->align[0] = 'left';
}
$table->head[1] = __('Task name');
$table->align[1] = 'left';
@ -455,11 +453,13 @@ class DiscoveryTaskList extends Wizard
}
if ($task['disabled'] == 0 && $server_name !== '') {
$data[0] = '<a href="'.ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_server.'&force='.$task['id_rt']
).'">';
$data[0] .= html_print_image('images/target.png', true, ['title' => __('Force')]);
$data[0] .= '</a>';
if (check_acl($config['id_user'], 0, 'AW')) {
$data[0] = '<a href="'.ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_server.'&force='.$task['id_rt']
).'">';
$data[0] .= html_print_image('images/target.png', true, ['title' => __('Force')]);
$data[0] .= '</a>';
}
} else if ($task['disabled'] == 2) {
$data[0] = ui_print_help_tip(
__('This task has not been completely defined, please edit it'),
@ -622,18 +622,20 @@ class DiscoveryTaskList extends Wizard
&& $task['type'] != DISCOVERY_APP_ORACLE
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS
) {
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image(
'images/dynamic_network_icon.png',
true
);
$data[9] .= '</a>';
if (check_acl($config['id_user'], 0, 'MR')) {
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image(
'images/dynamic_network_icon.png',
true
);
$data[9] .= '</a>';
}
}
if (check_acl(
$config['id_user'],
$task['id_group'],
'PM'
'AW'
)
) {
if ($ipam === true) {
@ -733,6 +735,16 @@ class DiscoveryTaskList extends Wizard
{
if ($script !== false) {
switch ($script['type']) {
case DISCOVERY_SCRIPT_APP_VMWARE:
return 'wiz=app&mode=vmware&page=0';
case DISCOVERY_SCRIPT_IPAM_RECON:
return '';
case DISCOVERY_SCRIPT_IPMI_RECON:
default:
return 'wiz=hd&mode=customnetscan';
case DISCOVERY_SCRIPT_CLOUD_AWS:
switch ($task['type']) {
case DISCOVERY_CLOUD_AWS_EC2:
@ -744,16 +756,6 @@ class DiscoveryTaskList extends Wizard
default:
return 'wiz=cloud';
}
case DISCOVERY_SCRIPT_APP_VMWARE:
return 'wiz=app&mode=vmware&page=0';
case DISCOVERY_SCRIPT_IPAM_RECON:
return '';
case DISCOVERY_SCRIPT_IPMI_RECON:
default:
return 'wiz=hd&mode=customnetscan';
}
}

View File

@ -87,6 +87,7 @@ class HostDevices extends Wizard
) {
$this->setBreadcrum([]);
$this->access = 'AW';
$this->task = [];
$this->msg = $msg;
$this->icon = $icon;
@ -100,6 +101,32 @@ class HostDevices extends Wizard
}
/**
* Checks if environment is ready,
* returns array
* icon: icon to be displayed
* label: label to be displayed
*
* @return array With data.
**/
public function load()
{
global $config;
// Check access.
check_login();
if (! $this->aclMulticheck('AW|PM')) {
return false;
}
return [
'icon' => $this->icon,
'label' => $this->label,
'url' => $this->url,
];
}
/**
* Run wizard manager.
*
@ -116,37 +143,42 @@ class HostDevices extends Wizard
if ($mode === null) {
$buttons = [];
$buttons[] = [
'url' => $this->url.'&mode=netscan',
'icon' => 'images/wizard/netscan.png',
'label' => __('Net Scan'),
];
if (enterprise_installed()) {
if (check_acl($config['id_user'], 0, $this->access)) {
$buttons[] = [
'url' => $this->url.'&mode=importcsv',
'icon' => ENTERPRISE_DIR.'/images/wizard/csv.png',
'label' => __('Import CSV'),
'url' => $this->url.'&mode=netscan',
'icon' => 'images/wizard/netscan.png',
'label' => __('Net Scan'),
];
if (enterprise_installed()) {
$buttons[] = [
'url' => $this->url.'&mode=importcsv',
'icon' => ENTERPRISE_DIR.'/images/wizard/csv.png',
'label' => __('Import CSV'),
];
$buttons[] = [
'url' => $this->url.'&mode=deploy',
'icon' => ENTERPRISE_DIR.'/images/wizard/deployment.png',
'label' => __('Agent deployment'),
];
}
$buttons[] = [
'url' => $this->url.'&mode=deploy',
'icon' => ENTERPRISE_DIR.'/images/wizard/deployment.png',
'label' => __('Agent deployment'),
'url' => $this->url.'&mode=customnetscan',
'icon' => '/images/wizard/customnetscan.png',
'label' => __('Custom NetScan'),
];
}
$buttons[] = [
'url' => $this->url.'&mode=customnetscan',
'icon' => '/images/wizard/customnetscan.png',
'label' => __('Custom NetScan'),
];
$buttons[] = [
'url' => $this->url.'&mode=managenetscanscripts',
'icon' => '/images/wizard/managenetscanscripts.png',
'label' => __('Manage NetScan scripts'),
];
if (check_acl($config['id_user'], 0, 'PM')) {
$buttons[] = [
'url' => $this->url.'&mode=managenetscanscripts',
'icon' => '/images/wizard/managenetscanscripts.png',
'label' => __('Manage NetScan scripts'),
];
}
$this->prepareBreadcrum(
[
@ -311,11 +343,11 @@ class HostDevices extends Wizard
) {
// Default values, no data received.
// User is accesing directly to this page.
if (users_is_admin() !== true && check_acl(
if (check_acl(
$config['id_usuario'],
$this->task['id_group'],
'PM'
) !== true
$this->access
) != true
) {
$this->msg = __('You have no access to edit this task.');
return false;
@ -487,7 +519,7 @@ class HostDevices extends Wizard
check_login();
if (! check_acl($config['id_user'], 0, 'PM')) {
if (! check_acl($config['id_user'], 0, $this->access)) {
db_pandora_audit(
'ACL Violation',
'Trying to access Agent Management'
@ -529,11 +561,11 @@ class HostDevices extends Wizard
// Check ACL. If user is not able to manage target task,
// redirect him to main page.
if (users_is_admin() !== true && check_acl(
if (check_acl(
$config['id_usuario'],
$this->task['id_group'],
'PM'
) !== true
$this->access
) != true
) {
$form['form']['action'] = $this->url.'&mode=netscan&page='.($this->page - 1);
}
@ -750,7 +782,7 @@ class HostDevices extends Wizard
[
'name' => 'id_group',
'returnAllGroup' => false,
'privilege' => 'PM',
'privilege' => $this->access,
'type' => 'select_groups',
'selected' => $this->task['id_group'],
'return' => true,

View File

@ -87,6 +87,13 @@ class Wizard
*/
public $msg;
/**
* Defines access level to use this util.
*
* @var string
*/
public $access = 'AR';
/**
* Setter for breadcrum
@ -234,6 +241,42 @@ class Wizard
public function run()
{
ui_require_css_file('wizard');
// Check access.
check_login();
if (! $this->aclMulticheck()) {
return;
}
}
/**
* Check multiple acl perms.
*
* @param string $access Access in PM|AR|RR format. Optional.
*
* @return boolean Alowed or not.
*/
public function aclMulticheck($access=null)
{
global $config;
if (isset($access)) {
$perms = explode('|', $access);
} else {
$perms = explode('|', $this->access);
}
$allowed = false;
foreach ($perms as $perm) {
$allowed = $allowed || (bool) check_acl(
$config['id_user'],
0,
$perm
);
}
return $allowed;
}
@ -247,6 +290,14 @@ class Wizard
**/
public function load()
{
global $config;
// Check access.
check_login();
if (! $this->aclMulticheck()) {
return false;
}
return [
'icon' => $this->icon,
'label' => $this->label,

View File

@ -209,6 +209,12 @@ class ConsoleSupervisor
$this->getUMMessages();
/*
* Check if the Server and Console has
* the same versions.
*/
$this->checkConsoleServerVersions();
}
@ -435,6 +441,12 @@ class ConsoleSupervisor
$this->getUMMessages();
/*
* Check if the Server and Console has
* the same versions.
*/
$this->checkConsoleServerVersions();
}
@ -2334,4 +2346,35 @@ class ConsoleSupervisor
}
/**
* Check if all servers and console versions are the same
*
* @return void
*/
public function checkConsoleServerVersions()
{
global $config;
// List all servers except satellite server
$server_version_list = db_get_all_rows_sql(
'SELECT name, version FROM tserver WHERE server_type != '.SERVER_TYPE_ENTERPRISE_SATELLITE
);
foreach ($server_version_list as $server) {
if (strpos($server['version'], $config['current_package_enterprise']) === false) {
$title_ver_misaligned = $server['name'].' version misaligned with Console';
$message_ver_misaligned = 'Server '.$server['name'].' and this console have different versions. This might cause several malfunctions. Please, update this server.';
$this->notify(
[
'type' => 'NOTIF.SERVER.MISALIGNED',
'title' => __($title_ver_misaligned),
'message' => __($message_ver_misaligned),
'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'),
]
);
}
}
}
}

View File

@ -65,6 +65,8 @@ class CustomNetScan extends Wizard
$this->url = ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
);
$this->access = 'AW';
$this->page = $page;
$this->breadcrum = $breadcrum;
}
@ -77,6 +79,8 @@ class CustomNetScan extends Wizard
*/
public function parseNetScan()
{
global $config;
if (isset($this->page) === true && $this->page === 0) {
// Check if we're updating a task.
$task_id = get_parameter('task', null);
@ -145,11 +149,11 @@ class CustomNetScan extends Wizard
) {
// Default values, no data received.
// User is accesing directly to this page.
if (users_is_admin() !== true && check_acl(
$config['id_usuario'],
if (check_acl(
$config['id_user'],
$this->task['id_group'],
'PM'
) !== true
$this->access
) != true
) {
$this->msg = __('You have no access to edit this task.');
return false;
@ -275,7 +279,7 @@ class CustomNetScan extends Wizard
{
global $config;
if (!check_acl($config['id_user'], 0, 'PM')) {
if (!check_acl($config['id_user'], 0, $this->access)) {
db_pandora_audit(
'ACL Violation',
'Trying to access Custom Net Scan.'
@ -317,11 +321,11 @@ class CustomNetScan extends Wizard
// Check ACL. If user is not able to manage target task,
// redirect him to main page.
if (users_is_admin() !== true && check_acl(
$config['id_usuario'],
if (check_acl(
$config['id_user'],
$this->task['id_group'],
'PM'
) !== true
$this->access
) != true
) {
$form['form']['action'] = $this->url.'&mode=customnetscan&page='.($this->page - 1);
}
@ -496,7 +500,7 @@ class CustomNetScan extends Wizard
'arguments' => [
'name' => 'id_group',
'returnAllGroup' => false,
'privilege' => 'PM',
'privilege' => $this->access,
'type' => 'select_groups',
'selected' => $this->task['id_group'],
'return' => true,

View File

@ -65,6 +65,8 @@ class ManageNetScanScripts extends Wizard
$this->url = ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
);
$this->access = 'PM';
$this->page = $page;
$this->breadcrum = $breadcrum;
}
@ -81,7 +83,7 @@ class ManageNetScanScripts extends Wizard
{
global $config;
if (check_acl($config['id_user'], 0, 'AW') === 0) {
if (check_acl($config['id_user'], 0, $this->access) === 0) {
db_pandora_audit(
'ACL Violation',
'Trying to access Net Scan Script.'

View File

@ -1075,6 +1075,8 @@ class Tree
ON ta.id_agente = tasg.id_agent
LEFT JOIN talert_template_modules tatm
ON tatm.id_agent_module = tam.id_agente_modulo
AND tatm.id_alert_template = 1
OR tatm.id_alert_template = NULL
$inner
WHERE tam.disabled = 0 AND ta.disabled = 0
$condition

View File

@ -104,7 +104,7 @@ class TreeService extends Tree
break;
case SERVICE_STATUS_WARNING:
$processed_items[$row['id']][$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_warning_ball.png" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
$processed_items[$row['id']]['statusImageHTML'] = '<img src="images/status_sets/default/agent_warning_ball.png" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
break;
case SERVICE_STATUS_UNKNOWN:

View File

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

View File

@ -1493,7 +1493,7 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
global $config;
if (!check_acl($config['id_user'], 0, 'AW')) {
returnError('forbidden', 'string');
returnError('forbidden', 'you havent got permissions to do this');
return;
}
@ -1501,127 +1501,101 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
return;
}
$alias = $other['data'][0];
$ip = $other['data'][1];
$idParent = $other['data'][2];
$idGroup = $other['data'][3];
$cascadeProtection = $other['data'][4];
$cascadeProtectionModule = $other['data'][5];
$intervalSeconds = $other['data'][6];
$idOS = $other['data'][7];
// $idServer = $other['data'][7];
$nameServer = $other['data'][8];
$customId = $other['data'][9];
$learningMode = $other['data'][10];
$disabled = $other['data'][11];
$description = $other['data'][12];
$alias_as_name = $other['data'][13];
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $other['data'][0])));
$direccion_agente = io_safe_input($other['data'][1]);
$nombre_agente = hash('sha256', $direccion_agente.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
$id_parent = (int) $other['data'][2];
$grupo = (int) $other['data'][3];
$cascade_protection = (int) $other['data'][4];
$cascade_protection_module = (int) $other['data'][5];
$intervalo = (string) $other['data'][6];
$id_os = (int) $other['data'][7];
$server_name = (string) $other['data'][8];
$custom_id = (string) $other['data'][9];
$modo = (int) $other['data'][10];
$disabled = (int) $other['data'][11];
$comentarios = (string) $other['data'][12];
$alias_as_name = (int) $other['data'][13];
$update_module_count = (int) $config['metaconsole_agent_cache'] == 1;
if ($alias_as_name && !empty($alias)) {
$name = $alias;
} else {
$name = hash('sha256', $alias.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
if (empty($alias)) {
$alias = $name;
}
}
if ($cascadeProtection == 1) {
if (($idParent != 0) && (db_get_value_sql(
if ($cascade_protection == 1) {
if (($id_parent != 0) && (db_get_value_sql(
'SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_agente = '.$idParent.' AND id_agente_modulo = '.$cascadeProtectionModule
FROM tagente_modulo
WHERE id_agente = '.$id_parent.' AND id_agente_modulo = '.$cascade_protection_module
) === false)
) {
returnError('parent_agent_not_exist', 'Is not a parent module to do cascade protection.');
return;
}
} else {
$cascadeProtectionModule = 0;
}
switch ($config['dbtype']) {
case 'mysql':
$sql1 = 'SELECT name
FROM tserver WHERE BINARY name LIKE "'.$nameServer.'"';
break;
$server_name = db_get_value_sql('SELECT name FROM tserver WHERE BINARY name LIKE "'.$server_name.'"');
case 'postgresql':
case 'oracle':
$sql1 = 'SELECT name
FROM tserver WHERE name LIKE \''.$nameServer.'\'';
break;
}
$nameServer = db_get_value_sql($sql1);
// Check ACL group
if (!check_acl($config['id_user'], $idGroup, 'AW')) {
returnError('forbidden', 'string');
return;
}
// Check selected parent
if ($idParent != 0) {
$parentCheck = agents_check_access_agent($idParent);
if ($parentCheck === null) {
returnError('parent_agent_not_exist', __('The agent parent don`t exist.'));
return;
}
if ($parentCheck === false) {
returnError('parent_agent_forbidden', __('The user cannot access to parent agent.'));
return;
}
}
if (agents_get_agent_id($name)) {
// Check if agent exists (BUG WC-50518-2).
if ($alias == '' && $alias_as_name === 0) {
returnError('alias_not_specified', 'No agent alias specified');
} else if (agents_get_agent_id($name)) {
returnError('agent_name_exist', 'The name of agent yet exist in DB.');
} else if (db_get_value_sql(
'SELECT id_grupo
FROM tgrupo
WHERE id_grupo = '.$idGroup
) === false
) {
} else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) {
returnError('id_grupo_not_exist', 'The group don`t exist.');
} else if (db_get_value_sql(
'SELECT id_os
FROM tconfig_os
WHERE id_os = '.$idOS
) === false
) {
} else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$id_os) === false) {
returnError('id_os_not_exist', 'The OS don`t exist.');
} else if (db_get_value_sql($sql1) === false) {
} else if ($server_name === false) {
returnError('server_not_exist', 'The '.get_product_name().' Server don`t exist.');
} else {
$idAgente = db_process_sql_insert(
'tagente',
[
'nombre' => $name,
'alias' => $alias,
'direccion' => $ip,
'id_grupo' => $idGroup,
'intervalo' => $intervalSeconds,
'comentarios' => $description,
'modo' => $learningMode,
'id_os' => $idOS,
'disabled' => $disabled,
'cascade_protection' => $cascadeProtection,
'cascade_protection_module' => $cascadeProtectionModule,
'server_name' => $nameServer,
'id_parent' => $idParent,
'custom_id' => $customId,
]
);
if (!empty($idAgente) && !empty($ip)) {
// register ip for this agent in 'taddress'
agents_add_address($idAgente, $ip);
if ($alias_as_name === 1) {
$exists_alias = db_get_row_sql('SELECT nombre FROM tagente WHERE nombre = "'.$alias.'"');
$nombre_agente = $alias;
}
if ($idGroup && !empty($idAgente)) {
if ($direccion_agente != '') {
$exists_ip = db_get_row_sql('SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"');
}
if (!$exists_alias && !$exists_ip) {
$id_agente = db_process_sql_insert(
'tagente',
[
'nombre' => $nombre_agente,
'alias' => $alias,
'alias_as_name' => $alias_as_name,
'direccion' => $direccion_agente,
'id_grupo' => $grupo,
'intervalo' => $intervalo,
'comentarios' => $comentarios,
'modo' => $modo,
'id_os' => $id_os,
'disabled' => $disabled,
'cascade_protection' => $cascade_protection,
'cascade_protection_module' => $cascade_protection_module,
'server_name' => $server_name,
'id_parent' => $id_parent,
'custom_id' => $custom_id,
'os_version' => '',
'agent_version' => '',
'timezone_offset' => 0,
'icon_path' => '',
'url_address' => '',
'update_module_count' => $update_module_count,
]
);
enterprise_hook('update_agent', [$id_agente]);
} else {
$id_agente = false;
}
if ($id_agente !== false) {
// Create address for this agent in taddress.
if ($direccion_agente != '') {
agents_add_address($id_agente, $direccion_agente);
}
$tpolicy_group_old = db_get_all_rows_sql(
'SELECT id_policy FROM tpolicy_groups
WHERE id_group = '.$idGroup
WHERE id_group = '.$grupo
);
if ($tpolicy_group_old) {
@ -1630,18 +1604,54 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
'tpolicy_agents',
[
'id_policy' => $old_group['id_policy'],
'id_agent' => $idAgente,
'id_agent' => $id_agente,
]
);
}
}
$info = '{"Name":"'.$nombre_agente.'",
"IP":"'.$direccion_agente.'",
"Group":"'.$grupo.'",
"Interval":"'.$intervalo.'",
"Comments":"'.$comentarios.'",
"Mode":"'.$modo.'",
"ID_parent:":"'.$id_parent.'",
"Server":"'.$server_name.'",
"ID os":"'.$id_os.'",
"Disabled":"'.$disabled.'",
"Custom ID":"'.$custom_id.'",
"Cascade protection":"'.$cascade_protection.'",
"Cascade protection module":"'.$cascade_protection_module.'"}';
$unsafe_alias = io_safe_output($alias);
db_pandora_audit(
'Agent management',
'Created agent '.$unsafe_alias,
false,
true,
$info
);
} else {
$id_agente = 0;
if ($exists_alias) {
$agent_creation_error = __('Could not be created, because name already exists');
} else if ($exists_ip) {
$agent_creation_error = __('Could not be created, because IP already exists');
} else {
$agent_creation_error = __('Could not be created for unknown reason');
}
returnError('generic error', $agent_creation_error);
return;
}
returnData(
'string',
[
'type' => 'string',
'data' => $idAgente,
'data' => $id_agente,
]
);
}
@ -6623,9 +6633,8 @@ function api_set_planned_downtimes_created($id, $thrash1, $other, $thrash3)
return;
}
$date_from = strtotime(html_entity_decode($other['data'][1]));
$date_to = strtotime(html_entity_decode($other['data'][2]));
$date_from = strtotime(html_entity_decode($other['data'][1].' '.$other['data'][11]));
$date_to = strtotime(html_entity_decode($other['data'][2].' '.$other['data'][12]));
$values = [];
$values['name'] = $id;
$values = [

View File

@ -124,8 +124,26 @@ function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=t
}
$groups = users_get_groups($id_user, $privileges, $returnAllGroup);
$all_graphs = [];
if (is_metaconsole()) {
$servers = metaconsole_get_connection_names();
foreach ($servers as $key => $server) {
$connection = metaconsole_get_connection($server);
if (metaconsole_connect($connection) != NOERR) {
continue;
}
$all_graph = db_get_all_rows_in_table('tgraph', 'name');
if ($all_graph !== false) {
$all_graphs = array_merge($all_graphs, $all_graph);
}
metaconsole_restore_db();
}
} else {
$all_graphs = db_get_all_rows_in_table('tgraph', 'name');
}
$all_graphs = db_get_all_rows_in_table('tgraph', 'name');
if ($all_graphs === false) {
return [];
}

View File

@ -4382,7 +4382,7 @@ function events_page_general($event)
$data = [];
$data[0] = __('Event name');
$data[1] = events_display_name($event['evento']);
$data[1] = '<span style="word-break: break-word;">'.events_display_name($event['evento']).'</span>';
$table_general->data[] = $data;
$data = [];
@ -4615,7 +4615,7 @@ function events_page_comments($event, $ajax=false)
foreach ($comm as $c) {
$data[0] = '<b>'.$c['action'].' by '.$c['id_user'].'</b>';
$data[0] .= '<br><br><i>'.date($config['date_format'], $c['utimestamp']).'</i>';
$data[1] = $c['comment'];
$data[1] = '<p style="word-break: break-word;">'.$c['comment'].'</p>';
$table_comments->data[] = $data;
}
}
@ -6879,3 +6879,56 @@ function events_get_field_value_by_event_id(
return $value;
}
function events_get_instructions($event)
{
if (!is_array($event)) {
return '';
}
switch ($event['event_type']) {
case 'going_unknown':
if ($event['unknown_instructions'] != '') {
$value = str_replace("\n", '<br>', io_safe_output($event['unknown_instructions']));
}
break;
case 'going_up_warning':
case 'going_down_warning':
if ($event['warning_instructions'] != '') {
$value = str_replace("\n", '<br>', io_safe_output($event['warning_instructions']));
}
break;
case 'going_up_critical':
case 'going_down_critical':
if ($event['critical_instructions'] != '') {
$value = str_replace("\n", '<br>', io_safe_output($event['critical_instructions']));
}
break;
}
if (!isset($value)) {
return '';
}
$max_text_length = 300;
$over_text = io_safe_output($value);
if (strlen($over_text) > ($max_text_length + 3)) {
$over_text = substr($over_text, 0, $max_text_length).'...';
}
$output = '<div id="hidden_event_instructions_'.$event['id_evento'].'"';
$output .= ' style="display: none; width: 100%; height: 100%; overflow: auto; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left">';
$output .= $value;
$output .= '</div>';
$output .= '<center>';
$output .= '<span id="value_event_'.$event['id_evento'].'" style="white-space: nowrap;">';
$output .= '<span id="value_event_text_'.$event['id_evento'].'"></span>';
$output .= '<a href="javascript:show_instructions('.$event['id_evento'].')">';
$output .= html_print_image('images/default_list.png', true, ['title' => $over_text]).'</a></span>';
$output .= '</center>';
return $output;
}

File diff suppressed because it is too large Load Diff

View File

@ -295,20 +295,40 @@ function grafico_modulo_sparse_data(
return false;
}
$array_data['sum'.$series_suffix]['agent_module_id'] = $agent_module_id;
$array_data['sum'.$series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
$array_data['sum'.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
$array_data['sum'.$series_suffix]['module_name'] = $data_module_graph['module_name'];
$array_data['sum'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
$array_data['sum'.$series_suffix]['unit'] = $data_module_graph['unit'];
$array_data = series_suffix_leyend(
'sum',
$series_suffix,
$agent_module_id,
$data_module_graph,
$array_data
);
if ($params['percentil']) {
$array_data['percentil'.$series_suffix]['agent_module_id'] = $agent_module_id;
$array_data['percentil'.$series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
$array_data['percentil'.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
$array_data['percentil'.$series_suffix]['module_name'] = $data_module_graph['module_name'];
$array_data['percentil'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
$array_data['percentil'.$series_suffix]['unit'] = $data_module_graph['unit'];
$array_data = series_suffix_leyend(
'percentil',
$series_suffix,
$agent_module_id,
$data_module_graph,
$array_data
);
}
if ($params['type_mode_graph']) {
$array_data = series_suffix_leyend(
'min',
$series_suffix,
$agent_module_id,
$data_module_graph,
$array_data
);
$array_data = series_suffix_leyend(
'max',
$series_suffix,
$agent_module_id,
$data_module_graph,
$array_data
);
}
// This is for a specific type of report that consists in passing
@ -1522,7 +1542,8 @@ function graphic_combined_module(
$array_data,
$params_combined['average'],
$params_combined['summatory'],
$params_combined['modules_series']
$params_combined['modules_series'],
$date_array
);
}
}
@ -2223,7 +2244,7 @@ function graphic_combined_module(
* @param boolean $average Average.
* @param boolean $summatory Summatory.
* @param boolean $modules_series Series module.
* @param boolean $baseline Baseline data.
* @param array $date_array Date data.
*
* @return array Data.
*/
@ -2232,106 +2253,82 @@ function combined_graph_summatory_average(
$average=false,
$summatory=false,
$modules_series=false,
$baseline=false
$date_array=[]
) {
if (isset($array_data) && is_array($array_data)) {
$reduce_array = [];
foreach ($array_data as $key => $value) {
if (strpos($key, 'sum') !== false) {
$data_array_reverse[$key] = array_reverse($value['data']);
if (!$modules_series) {
unset($array_data[$key]);
}
$last = $date_array['start_date'];
$reduce_array = array_reduce(
$value['data'],
function ($carry, $item) use ($date_array, $last, $reduce_array) {
$slice_start = $date_array['start_date'];
$iterator = $last;
// JS to PHP timestamp format.
$item[0] /= 1000;
while ($iterator <= $date_array['final_date']) {
if ($item[0] >= $slice_start && $item[0] < $iterator) {
$array = [];
$val = 0;
$n = 0;
if (is_array($reduce_array[$slice_start])) {
$val = $reduce_array[$slice_start]['value'];
$n = ($reduce_array[$slice_start]['n'] + 1);
}
$array['value'] = ($item[1] + $val);
$array['n'] = $n;
$array['t'] = ($slice_start * 1000);
$carry[$slice_start] = $array;
$last = $iterator;
break;
} else {
$slice_start = $iterator;
$iterator += 300;
}
}
$i++;
return $carry;
},
$reduce_array
);
}
if (!$modules_series) {
unset($array_data[$key]);
}
}
if (isset($data_array_reverse) && is_array($data_array_reverse)) {
$array_sum_reverse = [];
$array_avg_reverse = [];
$data_array_prev = false;
$data_array_pop = [];
$count = 0;
$reduce_array_summatory = [];
$reduce_array_average = [];
$i = 0;
foreach ($reduce_array as $item) {
$reduce_array_summatory[$i][0] = $item['t'];
$reduce_array_summatory[$i][1] = $item['value'];
$count_data_array_reverse = count($data_array_reverse['sum0']);
while ($count_data_array_reverse > 0) {
foreach ($data_array_reverse as $key_reverse => $value_reverse) {
if (is_array($value_reverse) && count($value_reverse) > 0) {
$data_array_pop[$key_reverse] = array_pop(
$data_array_reverse[$key_reverse]
);
}
}
$reduce_array_average[$i][0] = $item['t'];
$reduce_array_average[$i][1] = ($item['value'] / ($item['n'] + 1));
if (isset($data_array_pop) && is_array($data_array_pop)) {
$acum_data = 0;
$acum_array = [];
$sum_data = 0;
$count_pop = 0;
foreach ($data_array_pop as $key_pop => $value_pop) {
if ($value_pop[0] > $acum_data) {
if ($acum_data != 0) {
$sum_data = ($sum_data + $data_array_prev[$key_pop][1]);
$data_array_reverse[$key_pop][] = $value_pop;
$data_array_prev[$acum_key] = $acum_array;
} else {
if ($data_array_prev[$key_pop] == false) {
$data_array_prev[$key_pop] = $value_pop;
}
$i++;
}
$acum_key = $key_pop;
$acum_data = $value_pop[0];
$acum_array = $value_pop;
$sum_data = $value_pop[1];
}
} else if ($value_pop[0] < $acum_data) {
$sum_data = ($sum_data + $data_array_prev[$key_pop][1]);
$data_array_reverse[$acum_key][] = $acum_array;
$data_array_prev[$key_pop] = $value_pop;
$acum_key = $key_pop;
$acum_data = $value_pop[0];
$acum_array = $value_pop;
} else if ($value_pop[0] == $acum_data) {
$data_array_prev[$key_pop] = $value_pop;
$sum_data += $value_pop[1];
}
if ($summatory && isset($reduce_array_summatory)
&& is_array($reduce_array_summatory)
&& count($reduce_array_summatory) > 0
) {
$array_data['summatory']['data'] = $reduce_array_summatory;
}
$count_pop++;
}
if ($summatory) {
$array_sum_reverse[$count][0] = $acum_data;
$array_sum_reverse[$count][1] = $sum_data;
}
if ($average) {
$array_avg_reverse[$count][0] = $acum_data;
$array_avg_reverse[$count][1] = ($sum_data / $count_pop);
}
}
$count++;
$count_data_array_reverse--;
}
if ($summatory && isset($array_sum_reverse)
&& is_array($array_sum_reverse)
&& count($array_sum_reverse) > 0
) {
$array_data['summatory']['data'] = $array_sum_reverse;
$array_data['summatory']['color'] = 'purple';
}
if ($average && isset($array_avg_reverse)
&& is_array($array_avg_reverse)
&& count($array_avg_reverse) > 0
) {
if ($baseline) {
$array_data['baseline']['data'] = $array_avg_reverse;
$array_data['baseline']['color'] = 'green';
} else {
$array_data['average']['data'] = $array_avg_reverse;
$array_data['average']['color'] = 'orange';
}
}
if ($average && isset($reduce_array_average)
&& is_array($reduce_array_average)
&& count($reduce_array_average) > 0
) {
$array_data['average']['data'] = $reduce_array_average;
}
return $array_data;
@ -3192,6 +3189,21 @@ function graphic_incident_source($width=320, $height=200)
}
function series_suffix_leyend($series_name, $series_suffix, $id_agent, $data_module_graph, $array_data)
{
global $config;
$array_data[$series_name.$series_suffix]['agent_module_id'] = $id_agent;
$array_data[$series_name.$series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
$array_data[$series_name.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
$array_data[$series_name.$series_suffix]['module_name'] = $data_module_graph['module_name'];
$array_data[$series_name.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
$array_data[$series_name.$series_suffix]['unit'] = $data_module_graph['unit'];
return $array_data;
}
function graph_events_validated($width=300, $height=200, $extra_filters=[], $meta=false, $history=false)
{
global $config;
@ -3597,7 +3609,7 @@ function graph_custom_sql_graph(
$sql = io_safe_output($sql['sql']);
}
if (($config['metaconsole'] == 1) && defined('METACONSOLE')) {
if (($config['metaconsole'] == 1) && defined('METACONSOLE') && $report_content['server_name'] != '' && $report_content['server_name'] != '0') {
$metaconsole_connection = enterprise_hook('metaconsole_get_connection', [$report_content['server_name']]);
if ($metaconsole_connection === false) {
@ -3612,7 +3624,7 @@ function graph_custom_sql_graph(
$data_result = db_get_all_rows_sql($sql, $historical_db);
if (($config['metaconsole'] == 1) && defined('METACONSOLE')) {
if (($config['metaconsole'] == 1) && defined('METACONSOLE') && $report_content['server_name'] != '' && $report_content['server_name'] != '0') {
enterprise_hook('metaconsole_restore_db');
}

View File

@ -2654,21 +2654,18 @@ function modules_get_relations($params=[])
}
$modules_type = '';
$modules_type_filter = '';
if (isset($params['modules_type'])) {
$modules_type = $params['modules_type'];
$module_type = 'INNER JOIN ttipo_modulo ttm ON tam.id_tipo_modulo = ttm.id_tipo';
$modules_type_filter = sprintf(
"AND ttm.nombre = '%s'",
$params['modules_type']
);
}
$sql = 'SELECT DISTINCT tmr.id, tmr.module_a, tmr.module_b,
tmr.disable_update, tmr.type
FROM tmodule_relationship tmr,
tagente_modulo tam,
tagente ta,
ttipo_modulo ttm
WHERE ';
$agent_filter = '';
if ($id_agent > 0) {
$agent_filter = sprintf('AND ta.id_agente = %d', $id_agent);
$distinct = '';
if (empty($params)) {
$distinct = 'DISTINCT';
}
$module_a_filter = '';
@ -2678,6 +2675,11 @@ function modules_get_relations($params=[])
$module_b_filter = sprintf('AND tmr.module_b = %d', $id_module);
}
$agent_filter = '';
if ($id_agent > 0) {
$agent_filter = sprintf('AND ta.id_agente = %d', $id_agent);
}
$disabled_update_filter = '';
if ($disabled_update >= 0) {
$disabled_update_filter = sprintf(
@ -2686,22 +2688,25 @@ function modules_get_relations($params=[])
);
}
$modules_type_filter = '';
if ($modules_type != '') {
$modules_type_filter = sprintf(
"AND (tam.id_tipo_modulo = ttm.id_tipo AND ttm.nombre = '%s')",
$modules_type
);
}
$sql .= "( (tmr.module_a = tam.id_agente_modulo
$module_a_filter)
OR (tmr.module_b = tam.id_agente_modulo
$module_b_filter) )
AND tam.id_agente = ta.id_agente
$agent_filter
$disabled_update_filter
$modules_type_filter";
$sql = sprintf(
'SELECT %s tmr.id, tmr.module_a, tmr.module_b,
tmr.disable_update, tmr.type
FROM tmodule_relationship tmr
INNER JOIN tagente_modulo tam
ON (tmr.module_a = tam.id_agente_modulo %s)
OR (tmr.module_b = tam.id_agente_modulo %s)
INNER JOIN tagente ta
ON tam.id_agente = ta.id_agente
%s
WHERE 1=1 %s %s %s',
$distinct,
$module_a_filter,
$module_b_filter,
$module_type,
$agent_filter,
$disabled_update_filter,
$modules_type_filter
);
return db_get_all_rows_sql($sql);
}

View File

@ -2327,7 +2327,13 @@ function migrate_older_open_maps($id)
$new_map_filter = [];
$new_map_filter['dont_show_subgroups'] = $old_networkmap['dont_show_subgroups'];
$new_map_filter['node_radius'] = 40;
$new_map_filter['id_migrate_map'] = $id;
$new_map_filter['x_offs'] = 0;
$new_map_filter['y_offs'] = 0;
$new_map_filter['z_dash'] = '0.5';
$new_map_filter['node_sep'] = '0.1';
$new_map_filter['rank_sep'] = 1;
$new_map_filter['mindist'] = 1;
$new_map_filter['kval'] = '0.1';
$map_values['filter'] = json_encode($new_map_filter);
$map_values['description'] = 'Mapa open migrado';
@ -2340,11 +2346,7 @@ function migrate_older_open_maps($id)
$map_values['source_period'] = 60;
$map_values['source'] = 0;
$map_values['source_data'] = $old_networkmap['id_group'];
if ($old_networkmap['type'] == 'radial_dinamic') {
$map_values['generation_method'] = 6;
} else {
$map_values['generation_method'] = 4;
}
$map_values['generation_method'] = 3;
$map_values['generated'] = 0;

View File

@ -748,7 +748,9 @@ function planned_downtimes_created($values)
'return' => false,
'message' => __('Not created. Error inserting data').'. '.__('The end date must be higher than the current time'),
];
} else if ($values['type_execution'] == 'once' && $values['date_from'] >= $values['date_to']) {
} else if ($values['type_execution'] == 'once' && ($values['date_from'] > $values['date_to'])
|| (($values['date_from'] == $values['date_to']) && ($values['periodically_time_from'] >= $values['periodically_time_to']))
) {
return [
'return' => false,
'message' => __('Not created. Error inserting data').'. '.__('The end date must be higher than the start date'),
@ -794,6 +796,11 @@ function planned_downtimes_created($values)
'return' => false,
'message' => __('Not created. Error inserting data').'. '.__('There is no group with such id'),
];
} else if (!$values['date_from'] || !$values['date_to']) {
return [
'return' => false,
'message' => __('Not created. Error inserting data').'. '.__('Date is wrong formatted'),
];
} else {
if (trim(io_safe_output($values['name'])) != '') {
if (!$check) {

View File

@ -505,42 +505,43 @@ function reporting_make_reporting_data(
);
break;
case 'MTTR':
/*
case 'MTTR':
$report['contents'][] = reporting_value(
$report,
$content,
'MTTR',
$pdf
);
break;
break;
case 'MTBF':
case 'MTBF':
$report['contents'][] = reporting_value(
$report,
$content,
'MTBF',
$pdf
);
break;
break;
case 'TTO':
case 'TTO':
$report['contents'][] = reporting_value(
$report,
$content,
'TTO',
$pdf
);
break;
break;
case 'TTRT':
case 'TTRT':
$report['contents'][] = reporting_value(
$report,
$content,
'TTRT',
$pdf
);
break;
break;
*/
case 'agent_configuration':
$report['contents'][] = io_safe_output(
reporting_agent_configuration(
@ -3105,6 +3106,13 @@ function reporting_historical_data($report, $content)
$content['name'] = __('Historical data');
}
if (is_metaconsole()) {
$id_meta = metaconsole_get_id_server($content['server_name']);
$server = metaconsole_get_connection_by_id($id_meta);
$connection = metaconsole_connect($server);
}
$id_agent = agents_get_module_id(
$content['id_agent_module']
);
@ -3196,6 +3204,10 @@ function reporting_historical_data($report, $content)
$return['data'] = $data;
if (is_metaconsole() && $connection > 0) {
metaconsole_restore_db();
}
return reporting_check_structure_content($return);
}
@ -4181,6 +4193,7 @@ function reporting_sql_graph(
switch ($type) {
case 'dinamic':
case 'static':
case 'data':
$return['chart'] = graph_custom_sql_graph(
$content['id_rc'],
$width,
@ -4192,9 +4205,6 @@ function reporting_sql_graph(
$content['top_n_value']
);
break;
case 'data':
break;
}
return reporting_check_structure_content($return);
@ -4394,6 +4404,7 @@ function reporting_netflow(
switch ($type) {
case 'dinamic':
case 'static':
case 'data':
$return['chart'] = netflow_draw_item(
($report['datetime'] - $content['period']),
$report['datetime'],
@ -4691,21 +4702,22 @@ function reporting_value($report, $content, $type, $pdf=false)
$return['type'] = 'sumatory';
break;
case 'MTTR':
/*
case 'MTTR':
$return['type'] = 'MTTR';
break;
break;
case 'MTBF':
case 'MTBF':
$return['type'] = 'MTBF';
break;
break;
case 'TTO':
case 'TTO':
$return['type'] = 'TTO';
break;
break;
case 'TTRT':
case 'TTRT':
$return['type'] = 'TTRT';
break;
break;*/
}
if (empty($content['name'])) {
@ -4726,21 +4738,22 @@ function reporting_value($report, $content, $type, $pdf=false)
$content['name'] = __('Summatory');
break;
case 'MTTR':
/*
case 'MTTR':
$content['name'] = __('MTTR');
break;
break;
case 'MTBF':
case 'MTBF':
$content['name'] = __('MTBF');
break;
break;
case 'TTO':
case 'TTO':
$content['name'] = __('TTO');
break;
break;
case 'TTRT':
case 'TTRT':
$content['name'] = __('TTRT');
break;
break;*/
}
}
@ -4865,22 +4878,23 @@ function reporting_value($report, $content, $type, $pdf=false)
if ($content['visual_format'] != 2) {
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module'], true);
for ($i = $report['datetime']; $i > ($report['datetime'] - $content['period']); $i -= $content['lapse']) {
for ($i = ($report['datetime'] - $content['period']); $i < $report['datetime']; $i += $content['lapse']) {
$row = [];
$row[__('Lapse')] = date('Y-m-d H:i:s', ($i - $content['lapse'] + 1)).' to '.date('Y-m-d H:i:s', $i);
$row[__('Lapse')] = date('Y-m-d H:i:s', ($i + 1)).' to '.date('Y-m-d H:i:s', (($i + $content['lapse']) ));
if ($i > $time_begin['utimestamp']) {
switch ($type) {
case 'max':
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['lapse'], $i), $config['graph_precision']).' '.$unit;
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
break;
case 'min':
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['lapse'], $i), $config['graph_precision']).' '.$unit;
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
break;
case 'avg':
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['lapse'], $i), $config['graph_precision']).' '.$unit;
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
break;
}
} else {
@ -4913,25 +4927,26 @@ function reporting_value($report, $content, $type, $pdf=false)
}
break;
case 'MTTR':
/*
case 'MTTR':
$value = reporting_get_agentmodule_mttr(
$content['id_agent_module'],
$content['period'],
$report['datetime']
);
$formated_value = null;
break;
break;
case 'MTBF':
case 'MTBF':
$value = reporting_get_agentmodule_mtbf(
$content['id_agent_module'],
$content['period'],
$report['datetime']
);
$formated_value = null;
break;
break;
case 'TTO':
case 'TTO':
$value = reporting_get_agentmodule_tto(
$content['id_agent_module'],
$content['period'],
@ -4942,9 +4957,9 @@ function reporting_value($report, $content, $type, $pdf=false)
} else {
$formated_value = human_time_description_raw($value);
}
break;
break;
case 'TTRT':
case 'TTRT':
$value = reporting_get_agentmodule_ttr(
$content['id_agent_module'],
$content['period'],
@ -4955,7 +4970,7 @@ function reporting_value($report, $content, $type, $pdf=false)
} else {
$formated_value = human_time_description_raw($value);
}
break;
break;*/
}
$return['data'] = [
@ -7488,10 +7503,12 @@ function reporting_custom_graph(
if ($type_report == 'custom_graph') {
if (is_metaconsole()) {
$id_meta = metaconsole_get_id_server($content['server_name']);
$server = metaconsole_get_connection_by_id($id_meta);
if (metaconsole_connect($server) != NOERR) {
return false;
$servers = metaconsole_get_connection_names();
foreach ($servers as $server) {
$connection = metaconsole_get_connection($server);
if (metaconsole_connect($connection) != NOERR) {
continue;
}
}
}
}
@ -7543,8 +7560,26 @@ function reporting_custom_graph(
$content['name'] = __('Simple graph');
}
$id_agent = agents_get_module_id(
$content['id_agent_module']
);
$id_agent_module = $content['id_agent_module'];
$agent_description = agents_get_description($id_agent);
$agent_group = agents_get_agent_group($id_agent);
$agent_address = agents_get_address($id_agent);
$agent_alias = agents_get_alias($id_agent);
$module_name = modules_get_agentmodule_name(
$id_agent_module
);
$module_description = modules_get_agentmodule_descripcion(
$id_agent_module
);
$return['title'] = $content['name'];
$return['subtitle'] = io_safe_output($graph['name']);
$return['agent_name'] = $agent_alias;
$return['module_name'] = $module_name;
$return['description'] = $content['description'];
$return['date'] = reporting_get_date_text(
$report,
@ -7558,6 +7593,7 @@ function reporting_custom_graph(
switch ($type) {
case 'dinamic':
case 'static':
case 'data':
$params = [
'period' => $content['period'],
'width' => $width,

View File

@ -251,6 +251,7 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
reporting_html_sql($table, $item);
break;
case 'simple_baseline_graph':
case 'simple_graph':
reporting_html_graph($table, $item);
break;
@ -287,22 +288,23 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
reporting_html_sum_value($table, $item, $mini);
break;
case 'MTTR':
/*
case 'MTTR':
reporting_html_MTTR_value($table, $item, $mini, true, true);
break;
break;
case 'MTBF':
case 'MTBF':
reporting_html_MTBF_value($table, $item, $mini, true, true);
break;
break;
case 'TTO':
case 'TTO':
reporting_html_TTO_value($table, $item, $mini, false, true);
break;
break;
case 'TTRT':
case 'TTRT':
reporting_html_TTRT_value($table, $item, $mini, false, true);
break;
break;
*/
case 'agent_configuration':
reporting_html_agent_configuration($table, $item);
break;
@ -315,10 +317,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
reporting_html_prediction_date($table, $item, $mini);
break;
case 'simple_baseline_graph':
reporting_html_graph($table, $item);
break;
case 'netflow_area':
case 'netflow_data':
case 'netflow_summary':
@ -2207,12 +2205,15 @@ function reporting_html_database_serialized($table, $item, $pdf=0)
{
$table1 = new stdClass();
$table1->width = '100%';
$table1->head = [__('Date')];
$table1->head = [
__('Date'),
__('Data'),
];
if (!empty($item['keys'])) {
$table1->head = array_merge($table1->head, $item['keys']);
}
$table1->style[0] = 'text-align: left';
$table1->style[0] = 'text-align: center';
$table1->data = [];
foreach ($item['data'] as $data) {
@ -2728,29 +2729,30 @@ function reporting_html_agent_configuration(
}
function reporting_html_TTRT_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
{
/*
function reporting_html_TTRT_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
{
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
}
}
function reporting_html_TTO_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
{
function reporting_html_TTO_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
{
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
}
}
function reporting_html_MTBF_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
{
function reporting_html_MTBF_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
{
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
}
}
function reporting_html_MTTR_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
{
function reporting_html_MTTR_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
{
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
}
}
*/
function reporting_html_sum_value(&$table, $item, $mini)
{

View File

@ -679,23 +679,24 @@ function reports_get_report_types($template=false, $not_editor=false)
'name' => __('Module Histogram graph'),
];
$types['TTRT'] = [
/*
$types['TTRT'] = [
'optgroup' => __('ITIL'),
'name' => __('TTRT'),
];
$types['TTO'] = [
];
$types['TTO'] = [
'optgroup' => __('ITIL'),
'name' => __('TTO'),
];
$types['MTBF'] = [
];
$types['MTBF'] = [
'optgroup' => __('ITIL'),
'name' => __('MTBF'),
];
$types['MTTR'] = [
];
$types['MTTR'] = [
'optgroup' => __('ITIL'),
'name' => __('MTTR'),
];
];
*/
$types['SLA'] = [
'optgroup' => __('SLA'),
'name' => __('S.L.A.'),
@ -777,13 +778,15 @@ function reports_get_report_types($template=false, $not_editor=false)
'name' => __('Exception'),
];
if ($config['metaconsole'] != 1) {
$types['agent_module'] = [
'optgroup' => __('Grouped'),
'name' => __('Agents/Modules'),
];
if (!$template) {
$types['agent_module'] = [
'optgroup' => __('Grouped'),
'name' => __('Agents/Modules'),
];
}
}
// Only pandora managers have access to the whole database
// Only pandora managers have access to the whole database.
if (check_acl($config['id_user'], 0, 'PM')) {
$types['sql'] = [
'optgroup' => __('Grouped'),

View File

@ -39,7 +39,7 @@ if (isset($config['homedir'])) {
/**
* Transform bbcode to HTML.
* Transform bbcode to HTML and truncate log.
*
* @param string $text Text.
* @param array $allowed_tags Allowed_tags.
@ -48,16 +48,22 @@ if (isset($config['homedir'])) {
*/
function ui_bbcode_to_html($text, $allowed_tags=['[url]'])
{
if (array_search('[url]', $allowed_tags) !== false) {
// If link hasn't http, add it.
if (preg_match('/https?:\/\//', $text)) {
$html_bbcode = '<a target="_blank" rel="noopener noreferrer" href="$1">$2</a>';
} else {
$html_bbcode = '<a target="_blank" rel="noopener noreferrer" href="http://$1">$2</a>';
}
if (array_search('[url]', $allowed_tags) !== false || a) {
// Replace bbcode format [url=www.example.org] String [/url] with or without http and slashes
$return = preg_replace('/\[url(?|](((?:https?:\/\/)?[^[]+))|(?:=[\'"]?((?:https?:\/\/)?[^]]+?)[\'"]?)](.+?))\[\/url]/', $html_bbcode, $text);
preg_match('/\[url(?|](((?:https?:\/\/)?[^[]+))|(?:=[\'"]?((?:https?:\/\/)?[^]]+?)[\'"]?)](.+?))\[\/url]/', $text, $matches);
if ($matches) {
$url = $matches[1];
// Truncate text
$t_text = ui_print_truncate_text($matches[2]);
// If link hasn't http, add it.
if (preg_match('/https?:\/\//', $text)) {
$return = '<a target="_blank" rel="noopener noreferrer" href="'.$matches[1].'">'.$t_text.'</a>';
} else {
$return = '<a target="_blank" rel="noopener noreferrer" href="http://'.$matches[1].'">'.$t_text.'</a>';
}
} else {
$return = ui_print_truncate_text($text);
}
}
return $return;
@ -162,6 +168,10 @@ function ui_print_truncate_text($text, $numChars=GENERIC_SIZE_TEXT, $showTextInA
}
if ($showTextInAToopTip) {
if (is_string($showTextInAToopTip)) {
$text = ui_print_truncate_text($showTextInAToopTip, ($numChars * 2), false, true, false);
}
$truncateText = $truncateText.ui_print_help_tip(htmlspecialchars($text), true);
} else {
if ($style !== false) {
@ -3187,14 +3197,18 @@ function ui_print_datatable(array $parameters)
$.fn.dataTable.ext.errMode = "none";
$.fn.dataTable.ext.classes.sPageButton = "'.$pagination_class.'";
dt_'.$table_id.' = $("#'.$table_id.'").DataTable({
';
drawCallback: function(settings) {';
if (isset($parameters['drawCallback'])) {
$js .= 'drawCallback: function(settings) {
'.$parameters['drawCallback'].'
},';
$js .= $parameters['drawCallback'];
}
$js .= '
if (dt_'.$table_id.'.page.info().pages > 1) {
$("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").show()
} else {
$("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").hide()
}
},
processing: true,
serverSide: true,
paging: true,
@ -3299,6 +3313,7 @@ function ui_print_datatable(array $parameters)
dt_'.$table_id.'.draw().page(0)
});
});
</script>';
// Order.
@ -5646,3 +5661,62 @@ function ui_print_breadcrums($tab_name)
return $section;
}
/**
* Show last comment
*
* @param array $comments array with comments
*
* @return string HTML string with the last comment of the events.
*/
function ui_print_comments($comments)
{
global $config;
$comments = explode('<br>', $comments);
$comments = str_replace(["\n", '&#x0a;'], '<br>', $comments);
if (is_array($comments)) {
foreach ($comments as $comm) {
if (empty($comm)) {
continue;
}
$comments_array[] = json_decode(io_safe_output($comm), true);
}
}
foreach ($comments_array as $comm) {
// Show the comments more recent first.
if (is_array($comm)) {
$last_comment[] = array_reverse($comm);
}
}
// Only show the last comment. If commment its too long,the comment will short with ...
// If $config['prominent_time'] is timestamp the date show Month, day, hour and minutes.
// Else show comments hours ago
if ($last_comment[0][0]['action'] != 'Added comment') {
$last_comment[0][0]['comment'] = $last_comment[0][0]['action'];
}
$short_comment = substr($last_comment[0][0]['comment'], 0, '80px');
if ($config['prominent_time'] == 'timestamp') {
$comentario = '<i>'.date($config['date_format'], $last_comment[0][0]['utimestamp']).'&nbsp;('.$last_comment[0][0]['id_user'].'):&nbsp;'.$last_comment[0][0]['comment'].'';
if (strlen($comentario) > '200px') {
$comentario = '<i>'.date($config['date_format'], $last_comment[0][0]['utimestamp']).'&nbsp;('.$last_comment[0][0]['id_user'].'):&nbsp;'.$short_comment.'...';
}
} else {
$rest_time = (time() - $last_comment[0][0]['utimestamp']);
$time_last = (($rest_time / 60) / 60);
$comentario = '<i>'.number_format($time_last, 0).'&nbsp; Hours &nbsp;('.$last_comment[0][0]['id_user'].'):&nbsp;'.$last_comment[0][0]['comment'].'';
if (strlen($comentario) > '200px') {
$comentario = '<i>'.number_format($time_last, 0).'&nbsp; Hours &nbsp;('.$last_comment[0][0]['id_user'].'):&nbsp;'.$short_comment.'...';
}
}
return io_safe_output($comentario);
}

View File

@ -159,10 +159,9 @@
if (custom_graph) {
dataObject = retrieveDataOject(dataObjects,0);
//dataObjects.forEach(function (element) {
//elements.push(processDataObject(element));
//});
elements.push(processDataObject(dataObject));
dataObjects.forEach(function (element) {
elements.push(processDataObject(element));
});
graphData = elements;
}
else {

View File

@ -172,7 +172,6 @@ function pandoraFlotPieCustom(
show: true,
radius: 5 / 8,
formatter: function(label, series) {
console.log(series);
return (
'<div style="font-size:' +
font_size +
@ -783,9 +782,7 @@ function pandoraFlotSlicebar(
graph_id,
values,
datacolor,
labels,
legend,
acumulate_data,
intervaltick,
font,
font_size,
@ -794,12 +791,11 @@ function pandoraFlotSlicebar(
id_agent,
full_legend,
not_interactive,
show_date
show_date,
datelimit
) {
values = values.split(separator2);
labels = labels.split(separator);
legend = legend.split(separator);
acumulate_data = acumulate_data.split(separator);
datacolor = datacolor.split(separator);
if (full_legend != false) {
@ -822,9 +818,7 @@ function pandoraFlotSlicebar(
var serie = values[i].split(separator);
var aux = new Array();
$.each(serie, function(i, v) {
aux.push([v, i]);
});
aux.push([parseInt(serie[0]), 0]);
datas.push({
data: aux,
@ -902,18 +896,16 @@ function pandoraFlotSlicebar(
}
$("#extra_" + graph_id).text(from + "-" + to);
var extra_height = parseInt(
$("#extra_" + graph_id)
.css("height")
.split("px")[0]
);
var extra_width = parseInt(
$("#extra_" + graph_id)
.css("width")
.split("px")[0]
);
$("#extra_" + graph_id).css("left", pos.pageX - extra_width / 4 + "px");
//$('#extra_'+graph_id).css('top',plot.offset().top-extra_height-5+'px');
$("#extra_" + graph_id).css(
"left",
parseInt(pos.pageX - extra_width - 200) + "px"
);
$("#extra_" + graph_id).show();
}
});
@ -992,13 +984,33 @@ function pandoraFlotSlicebar(
// Format functions
function xFormatter(v, axis) {
v = new Date(1000 * v);
date_format =
(v.getHours() < 10 ? "0" : "") +
v.getHours() +
d = new Date(1000 * (v + datelimit));
var monthNames = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
];
var date_format =
(d.getDate() < 10 ? "0" : "") +
d.getDate() +
" " +
monthNames[d.getMonth()] +
"<br>" +
(d.getHours() < 10 ? "0" : "") +
d.getHours() +
":" +
(v.getMinutes() < 10 ? "0" : "") +
v.getMinutes();
(d.getMinutes() < 10 ? "0" : "") +
d.getMinutes();
return date_format;
}
}

View File

@ -786,6 +786,8 @@ function flot_slicesbar_graph(
// Get a unique identifier to graph
$graph_id = uniqid('graph_');
$height = ((int) $height + 15);
// Set some containers to legend, graph, timestamp tooltip, etc.
if ($stat_win) {
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width.'%; height: '.$height."px; display: inline-block;'></div>";
@ -804,8 +806,6 @@ function flot_slicesbar_graph(
$separator2 = ':,:,,,:,:';
// Transform data from our format to library format
$labels = [];
$a = [];
$vars = [];
$datacolor = [];
@ -819,12 +819,12 @@ function flot_slicesbar_graph(
$fontsize = $config['font_size'];
$fontpath = $config['fontpath'];
$extra_height = 15;
$extra_height = 40;
if (defined('METACONSOLE')) {
$extra_height = 20;
$extra_height = 50;
}
$return .= "<div id='extra_$graph_id' style='font-size: ".$fontsize.'pt; display:none; position:absolute; overflow: auto; height: '.$extra_height."px; background:#fff; padding: 2px 2px 2px 2px; border: solid #000 1px;'></div>";
$return .= '<div id="extra_'.$graph_id.'" class="slicebar-box-hover-styles" style="display:none; font-size:'.$fontsize.'"></div>';
$maxticks = (int) 20;
@ -842,11 +842,7 @@ function flot_slicesbar_graph(
$intervaltick = (int) $intervaltick;
$acumulate = 0;
$c = 0;
$acumulate_data = [];
foreach ($graph_data as $label => $values) {
$labels[] = $label;
$i--;
foreach ($values as $key => $value) {
@ -857,19 +853,10 @@ function flot_slicesbar_graph(
}
$data[$jsvar][] = $value;
$acumulate_data[$c] = $acumulate;
$acumulate += $value;
$c++;
if ($value > $max) {
$max = $value;
}
}
}
// Store serialized data to use it from javascript
$labels = implode($separator, $labels);
// Store serialized data to use it from javascript.
$datacolor = implode($separator, $datacolor);
if (is_array($legend)) {
$legend = io_safe_output(implode($separator, $legend));
@ -881,19 +868,11 @@ function flot_slicesbar_graph(
$full_legend_date = false;
}
$acumulate_data = io_safe_output(implode($separator, $acumulate_data));
// Store data series in javascript format
$jsvars = '';
$jsseries = [];
$date = get_system_time();
$datelimit = (($date - $period) * 1000);
$datelimit = (($date - $period));
$i = 0;
$values2 = [];
foreach ($data as $jsvar => $values) {
$values2[] = implode($separator, $values);
$i ++;
@ -901,10 +880,10 @@ function flot_slicesbar_graph(
$values = implode($separator2, $values2);
// Javascript code
// Javascript code.
$return .= "<script type='text/javascript'>";
$return .= "//<![CDATA[\n";
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$labels','$legend','$acumulate_data',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive, '$show')";
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$legend',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive, '$show', $datelimit)";
$return .= "\n//]]>";
$return .= '</script>';

View File

@ -63,6 +63,20 @@ function show_event_dialog(event, dialog_page, result) {
height: 600
})
.show();
$.post({
url: "ajax.php",
data: {
page: "include/ajax/events",
get_comments: 1,
event: event,
filter: values
},
dataType: "html",
success: function(data) {
$("#extended_event_comments_page").empty();
$("#extended_event_comments_page").html(data);
}
});
$("#refrcounter").countdown("pause");
$("div.vc-countdown").countdown("pause");

View File

@ -261,6 +261,7 @@ div.login_button_saml input:hover {
.login_back input {
background-image: url("../../images/back_login.png");
background-position: left 5% center;
background-repeat: no-repeat;
}
.login_back input:hover {

View File

@ -5888,3 +5888,18 @@ table.table_modal_alternate tr td:first-child {
.fullwidth {
width: 100%;
}
.slicebar-box-hover-styles {
position: absolute;
background-color: #fff;
width: 80px;
height: 20px;
text-align: center;
font-family: arial, sans-serif, verdana;
padding: 3px;
border: 1px solid black;
}
.flot-text {
width: 101%;
}

View File

@ -872,12 +872,6 @@ if (! isset($config['id_user'])) {
$loginhash_data = get_parameter('loginhash_data', '');
$loginhash_user = str_rot13(get_parameter('loginhash_user', ''));
$iduser = $_SESSION['id_usuario'];
/*
* Check why is not available.
* logoff_db ($iduser, $_SERVER["REMOTE_ADDR"]);
*/
unset($_SESSION['id_usuario']);
unset($iduser);
@ -913,7 +907,6 @@ if (! isset($config['id_user'])) {
$_POST = [];
$config['auth_error'] = __("User doesn\'t exist.");
$iduser = $_SESSION['id_usuario'];
logoff_db($iduser, $_SERVER['REMOTE_ADDR']);
unset($_SESSION['id_usuario']);
unset($iduser);
include_once 'general/login_page.php';
@ -933,7 +926,6 @@ if (! isset($config['id_user'])) {
$_POST = [];
$config['auth_error'] = __('User only can use the API.');
$iduser = $_SESSION['id_usuario'];
logoff_db($iduser, $_SERVER['REMOTE_ADDR']);
unset($_SESSION['id_usuario']);
unset($iduser);
include_once 'general/login_page.php';
@ -956,7 +948,6 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
if (isset($_GET['bye'])) {
include 'general/logoff.php';
$iduser = $_SESSION['id_usuario'];
db_logoff($iduser, $_SERVER['REMOTE_ADDR']);
$_SESSION = [];
session_destroy();

View File

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

View File

@ -97,17 +97,6 @@ echo '<td>';
html_print_submit_button(__('Refresh path'), 'refresh', false, 'class = "sub upd" style="margin-top:0px"');
echo '</table></form>';
// Get the total number of Elements for the pagination
$sqlCount = sprintf(
'SELECT COUNT(*)
FROM tgis_data_history
WHERE tagente_id_agente = %d AND end_timestamp > FROM_UNIXTIME(%d)
ORDER BY end_timestamp DESC',
$agentId,
(get_system_time() - $period)
);
$countData = (int) db_get_value_sql($sqlCount);
// Get the elements to present in this page
switch ($config['dbtype']) {
case 'mysql':
@ -147,33 +136,39 @@ switch ($config['dbtype']) {
$result = db_get_all_rows_sql($sql, true);
if ($result === false) {
$sql2 = sprintf(
'
SELECT current_longitude AS longitude, current_latitude AS latitude, current_altitude AS altitude,
start_timestamp, description, number_of_packages, manual_placement
FROM tgis_data_status
WHERE tagente_id_agente = %d
ORDER BY start_timestamp DESC
LIMIT %d OFFSET %d',
$agentId,
$config['block_size'],
(int) get_parameter('offset')
);
$sql2 = sprintf(
'
SELECT current_longitude AS longitude, current_latitude AS latitude, current_altitude AS altitude,
start_timestamp, description, number_of_packages, manual_placement
FROM tgis_data_status
WHERE tagente_id_agente = %d
ORDER BY start_timestamp DESC
LIMIT %d OFFSET %d',
$agentId,
$config['block_size'],
(int) get_parameter('offset')
);
$result2 = db_get_all_rows_sql($sql2, true);
if ($result2 === false) {
if ($result === false && $result2 === false) {
ui_print_empty_data(__('This agent doesn\'t have any GIS data.'));
} else {
if ($result === false) {
$result = $result2;
} else {
$result2[0]['end_timestamp'] = date('Y-m-d H:i:s');
$result = $result2;
array_unshift($result, $result2[0]);
}
}
if ($result !== false) {
echo '<h4>'.__('Positional data from the last').' '.human_time_description_raw($period).'</h4>';
// Get the total elements for UI pagination
$countData = count($result);
if ($countData > 0) {
ui_pagination($countData, false);
}

View File

@ -713,11 +713,7 @@ if (is_ajax()) {
$values['options'] = json_encode($options);
$return_update = db_process_sql_update('tnetworkmap_enterprise', $values, ['id' => $id_ent_map]);
if (!$return_update) {
$return_data['ent'] = false;
break;
}
db_process_sql_update('tnetworkmap_enterprise', $values, ['id' => $id_ent_map]);
}
}
}
@ -735,11 +731,7 @@ if (is_ajax()) {
} else {
$values['text_filter'] = 'migrated';
$return_update = db_process_sql_update('tnetwork_map', $values, ['id_networkmap' => $id_open_map]);
if (!$return_update) {
$return_data['open'] = false;
break;
}
db_process_sql_update('tnetwork_map', $values, ['id_networkmap' => $id_open_map]);
}
}
}

View File

@ -280,23 +280,27 @@ if (is_ajax()) {
$events,
function ($carry, $item) {
$tmp = (object) $item;
$tmp->hint = '';
$tmp->meta = false;
if (strlen($tmp->evento) >= 255) {
$tmp->hint = io_safe_output(chunk_split(substr($tmp->evento, 0, 600), 80, '<br>').'(...)');
$tmp->meta = is_metaconsole();
$tmp->evento = io_safe_output(substr($tmp->evento, 0, 253).'(...)');
if (strpos($tmp->evento, ' ') === false) {
$tmp->evento = substr($tmp->evento, 0, 80).'(...)';
$tmp->meta = is_metaconsole();
if (is_metaconsole()) {
if ($tmp->server_name !== null) {
$tmp->data_server = metaconsole_get_servers($tmp->server_id);
$tmp->server_url_hash = metaconsole_get_servers_url_hash($tmp->data_server);
}
} else {
$tmp->evento = io_safe_output($tmp->evento);
}
$tmp->evento = str_replace('"', '', io_safe_output($tmp->evento));
if (strlen($tmp->evento) >= 255) {
$tmp->evento = ui_print_truncate_text($tmp->evento, 255, $tmp->evento, true, false);
}
if ($tmp->module_name) {
$tmp->module_name = io_safe_output($tmp->module_name);
}
if ($tmp->comments) {
$tmp->comments = ui_print_comments($tmp->comments);
}
$tmp->agent_name = io_safe_output($tmp->agent_name);
$tmp->ack_utimestamp = ui_print_timestamp(
$tmp->ack_utimestamp,
@ -309,6 +313,8 @@ if (is_ajax()) {
$tmp->data = format_numeric($tmp->data, 1);
$tmp->instructions = events_get_instructions($item);
$tmp->b64 = base64_encode(json_encode($tmp));
$carry[] = $tmp;
@ -1600,6 +1606,28 @@ function process_datatables_callback(table, settings) {
function process_datatables_item(item) {
// Url to go to node from meta.
var server_url = '';
var hashdata = '';
if(item.meta === true){
if(typeof item.data_server !== 'undefined' && typeof item.server_url_hash !== 'undefined'){
server_url = item.data_server.server_url;
hashdata = item.server_url_hash;
}
}
// Show comments events.
item.user_comment = item.comments
if(item.comments.length > 80){
item.user_comment += '&nbsp;&nbsp;<a id="show_comments" href="javascript:" onclick="show_event_dialog(\'';
item.user_comment += item.b64+"','comments'," + $("#group_rep").val()+');">';
item.user_comment += '<?php echo html_print_image('images/eye.png', true, ['title' => __('Show more')]); ?></a>';
}
// Grouped events.
if(item.max_id_evento) {
item.id_evento = item.max_id_evento
@ -1659,10 +1687,6 @@ function process_datatables_item(item) {
evn += '('+item.event_rep+') ';
}
evn += item.evento+'</a>';
if(item.hint !== ''){
let ruta = item.meta == true ? '../../images/tip_help.png' : 'images/tip_help.png';
evn += '&nbsp;<img src="'+ruta+'" data-title="'+item.hint+'" data-use_title_for_force_title="1" class="forced_title" alt="'+item.hint+'">';
}
item.mini_severity = '<div class="event flex-row h100p nowrap">';
item.mini_severity += output;
@ -1838,9 +1862,19 @@ function process_datatables_item(item) {
/* Update column content now to avoid json poisoning. */
// Url to agent view.
var url_link = '<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>';
var url_link_hash = '';
if(item.meta === true){
url_link = server_url+'/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=';
url_link_hash = hashdata;
}
/* Agent name link */
if (item.id_agente > 0) {
item.agent_name = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>' +item.id_agente+'">' + item.agent_name + '</a>';
item.agent_name = '<a href="'+url_link+item.id_agente+url_link_hash+'">' + item.agent_name + '</a>';
} else {
item.agent_name = '';
}
@ -1850,11 +1884,11 @@ function process_datatables_item(item) {
<?php
if (in_array('agent_name', $fields)) {
?>
item.id_agente = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>'+item.id_agente+'">' + item.id_agente + '</a>';
item.id_agente = '<a href="'+url_link+item.id_agente+url_link_hash+'">' + item.id_agente + '</a>';
<?php
} else {
?>
item.id_agente = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>'+item.id_agente+'">' + item.agent_name + '</a>';
item.id_agente = '<a href="'+url_link+item.id_agente+url_link_hash+'">' + item.agent_name + '</a>';
<?php
}
?>
@ -2371,5 +2405,12 @@ function datetime_picker_callback() {
datetime_picker_callback();
function show_instructions(id){
title = "<?php echo __('Instructions'); ?>";
$('#hidden_event_instructions_' + id).dialog({
title: title,
width: 600
});
}
</script>

View File

@ -18,6 +18,11 @@ enterprise_include_once('include/functions_policies.php');
$searchpolicies = check_acl($config['id_user'], 0, 'AW');
if (!$searchpolicies) {
$totalPolicies = 0;
return;
}
$selectpolicieIDUp = '';
$selectpolicieIDDown = '';
$selectNameUp = '';
@ -169,7 +174,7 @@ switch ($sortField) {
break;
}
if ($searchpolicies == 0) {
if ($searchpolicies) {
/*
We take the user groups to get policies that meet the requirements of the search
and which the user have permission on this groups
@ -189,6 +194,7 @@ if ($searchpolicies == 0) {
$policies = db_process_sql($sql);
if ($policies !== false) {
$totalPolicies = count($policies);

View File

@ -18,7 +18,7 @@ require_once $config['homedir'].'/include/functions_reporting.php';
enterprise_include('operation/reporting/custom_reporting.php');
$searchAgents = $searchAlerts = $searchModules = check_acl($config['id_user'], 0, 'AR');
$searchUsers = $searchPolicies = check_acl($config['id_user'], 0, 'AW');
$searchUsers = $searchPolicies = check_acl($config['id_user'], 0, 'AR');
$searchMaps = $searchReports = $searchGraphs = check_acl($config['id_user'], 0, 'IR');
$searchMain = true;
$searchHelps = true;

View File

@ -18,6 +18,10 @@ require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_groups.php';
$searchUsers = check_acl($config['id_user'], 0, 'UM');
if (!$searchUsers) {
$totalUsers = 0;
return;
}
$selectUserIDUp = '';
$selectUserIDDown = '';

View File

@ -91,7 +91,7 @@ if (!$users || !$searchUsers) {
}
echo '<br />';
ui_pagination($totalUsers);
// ui_pagination($totalUsers);
html_print_table($table);
unset($table);
ui_pagination($totalUsers);

View File

@ -956,7 +956,8 @@ if ($traps !== false) {
}
} else {
$agent_trap_group = db_get_value('id_grupo', 'tagente', 'nombre', $trap['source']);
if ((check_acl($config['id_user'], $agent_trap_group, 'AW'))) {
if ((check_acl($config['id_user'], $agent_trap_group, 'IM'))) {
$data[8] .= '<a href="'.$urlPagination.'&delete='.$trap['id_trap'].'&offset='.$offset.'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete')]).'</a> ';
}
}

View File

@ -333,7 +333,7 @@ $id_usr = $config['id_user'];
if (!$meta) {
$home_screen = '<div class="label_select"><p class="edit_user_labels">'.__('Home screen').ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type sec=estado&sec2=operation/agentes/estado_agente to show agent detail view'), true).'</p>';
$home_screen = '<div class="label_select"><p class="edit_user_labels">'.__('Home screen').ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 to show agent detail view'), true).'</p>';
$values = [
'Default' => __('Default'),
'Visual console' => __('Visual console'),
@ -462,6 +462,8 @@ $autorefresh_list_out['operation/agentes/status_monitor'] = 'Monitor detail';
$autorefresh_list_out['enterprise/operation/services/services'] = 'Services';
$autorefresh_list_out['enterprise/dashboard/main_dashboard'] = 'Dashboard';
$autorefresh_list_out['operation/reporting/graph_viewer'] = 'Graph Viewer';
$autorefresh_list_out['operation/gis_maps/render_view'] = 'Gis Map';
$autorefresh_list_out['operation/snmpconsole/snmp_view'] = 'SNMP console';
$autorefresh_list_out['operation/agentes/pandora_networkmap'] = 'Network map';
$autorefresh_list_out['operation/visual_console/render_view'] = 'Visual console';
@ -1150,7 +1152,7 @@ function ehorus_connection_test(host, port) {
var user = $('input#text-ehorus_user_level_user').val();
var pass = $('input#password-ehorus_user_level_pass').val();
debugger;
var badRequestMessage = '<?php echo __('Empty user or password'); ?>';
var notFoundMessage = '<?php echo __('User not found'); ?>';
var invalidPassMessage = '<?php echo __('Invalid password'); ?>';

View File

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

View File

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

View File

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

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.739-190927
Version: 7.0NG.739-191018
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -97,9 +97,6 @@ sub pandora_startup () {
# Grab config tokens shared with the console and not in the .conf
pandora_get_sharedconfig (\%Config, $DBH);
# Generate the encryption key after reading the passphrase.
$Config{"encryption_key"} = enterprise_hook('pandora_get_encryption_key', [\%Config, $Config{"encryption_passphrase"}]);
# Kill any running server threads.
stop_server_threads();
@ -211,7 +208,9 @@ sub pandora_crash () {
}
$full_error .= $error_line;
}
# Could crash before parse configuration.
$Config{'rb_product_name'} = 'PandoraFMS' unless defined($Config{'rb_product_name'}) && $Config{'rb_product_name'} ne '';
logger (\%Config, $Config{'rb_product_name'} . ' Server \'' . $Config{'servername'} . '\' unhandled error.', 1);
# It's interesting show by console problems, not only in logs. This helps

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.739";
my $pandora_build = "190927";
my $pandora_build = "191018";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@ -1206,6 +1206,9 @@ sub pandora_load_config {
} # end of loop for parameter #
# Generate the encryption key after reading the passphrase.
$pa_config->{"encryption_key"} = enterprise_hook('pandora_get_encryption_key', [$pa_config, $pa_config->{"encryption_passphrase"}]);
# Set to RDBMS' standard port
if (!defined($pa_config->{'dbport'})) {
if ($pa_config->{'dbengine'} eq "mysql") {

View File

@ -1141,21 +1141,21 @@ sub pandora_execute_action ($$$$$$$$$;$) {
#logger($pa_config, "Clean name ".$clean_name, 10);
# User defined alert
if ($action->{'internal'} == 0) {
$macros{_field1_} = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field2_} = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field3_} = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field4_} = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field5_} = subst_alert_macros ($field5, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field6_} = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field7_} = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field8_} = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field9_} = subst_alert_macros ($field9, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field10_} = subst_alert_macros ($field10, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field11_} = subst_alert_macros ($field11, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field12_} = subst_alert_macros ($field12, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field13_} = subst_alert_macros ($field13, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field14_} = subst_alert_macros ($field14, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field15_} = subst_alert_macros ($field15, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field1_} = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$macros{_field2_} = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$macros{_field3_} = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$macros{_field4_} = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$macros{_field5_} = subst_alert_macros ($field5, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$macros{_field6_} = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$macros{_field7_} = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$macros{_field8_} = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$macros{_field9_} = subst_alert_macros ($field9, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$macros{_field10_} = subst_alert_macros ($field10, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$macros{_field11_} = subst_alert_macros ($field11, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$macros{_field12_} = subst_alert_macros ($field12, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$macros{_field13_} = subst_alert_macros ($field13, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$macros{_field14_} = subst_alert_macros ($field14, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$macros{_field15_} = subst_alert_macros ($field15, \%macros, $pa_config, $dbh, $agent, $module, $alert);
my @command_args = ();
# divide command into words based on quotes and whitespaces
@ -1186,7 +1186,7 @@ sub pandora_execute_action ($$$$$$$$$;$) {
# Internal Audit
} elsif ($clean_name eq "Internal Audit") {
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module);
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert);
pandora_audit ($pa_config, $field1, defined ($agent) ? safe_output($agent->{'alias'}) : 'N/A', 'Alert (' . safe_output($alert->{'description'}) . ')', $dbh);
# Email
@ -1363,12 +1363,12 @@ sub pandora_execute_action ($$$$$$$$$;$) {
# Pandora FMS Event
} elsif ($clean_name eq "Monitoring Event") {
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module);
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module);
$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module);
$field6 = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module);
$field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module);
$field8 = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module);
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$field6 = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$field8 = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module, $alert);
# Field 1 (event text)
my $event_text = $field1;
@ -1448,13 +1448,13 @@ sub pandora_execute_action ($$$$$$$$$;$) {
my $config_api_pass = pandora_get_tconfig_token ($dbh, 'integria_api_pass', '');
my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', '');
my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', '');
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module);
$field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module);
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module);
$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module);
$field5 = subst_alert_macros ($field5, \%macros, $pa_config, $dbh, $agent, $module);
$field6 = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module);
$field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module);
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$field5 = subst_alert_macros ($field5, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$field6 = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module, $alert);
$field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module, $alert);
# Field 1 (Integria IMS API path)
my $api_path = $config_api_path . "/integria/include/api.php";
@ -1513,8 +1513,7 @@ sub pandora_execute_action ($$$$$$$$$;$) {
} elsif ($clean_name eq "Generate Notification") {
# Translate macros
$field3 = subst_alert_macros($field3, \%macros, $pa_config, $dbh, $agent, $module);
$field4 = subst_alert_macros($field4, \%macros, $pa_config, $dbh, $agent, $module);
$field3 = subst_alert_macros($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert);
# If no targets ignore notification
if (defined($field1) && defined($field2) && ($field1 ne "" || $field2 ne "")) {
@ -4094,7 +4093,7 @@ sub on_demand_macro($$$$$$;$) {
my $unit_mod = get_db_value ($dbh, 'SELECT unit FROM tagente_modulo WHERE id_agente_modulo = ?', $id_mod);
my $field_value = "";
if ($type_mod eq 3){
if ($type_mod eq 3 || $type_mod eq 23|| $type_mod eq 17 || $type_mod eq 10 || $type_mod eq 33 ){
$field_value = get_db_value($dbh, 'SELECT datos FROM tagente_datos_string where id_agente_modulo = ? order by utimestamp desc limit 1', $id_mod);
}
else{

View File

@ -230,7 +230,7 @@ sub data_consumer ($$) {
}
# Ignore the timestamp in the XML and use the file timestamp instead
$xml_data->{'timestamp'} = strftime ("%Y-%m-%d %H:%M:%S", localtime((stat($file_name))[9])) if ($pa_config->{'use_xml_timestamp'} eq '1' || ! defined ($xml_data->{'timestamp'}));
$xml_data->{'timestamp'} = strftime ("%Y-%m-%d %H:%M:%S", localtime((stat($file_name))[9])) if ($pa_config->{'use_xml_timestamp'} eq '0' || ! defined ($xml_data->{'timestamp'}));
# Double check that the file exists
if (! -f $file_name) {

View File

@ -360,8 +360,9 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
if (-x $self->{'pa_config'}->{'xprobe2'}) {
my $return = `"$self->{pa_config}->{xprobe2}" $device 2>$DEVNULL`;
if ($? == 0) {
my ($output) = $a =~ /Running OS:(.*)/;
return pandora_get_os($self->{'dbh'}, $output);
if($return =~ /Running OS:(.*)/) {
return pandora_get_os($self->{'dbh'}, $1);
}
}
}
@ -370,8 +371,9 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
my $return = `"$self->{pa_config}->{nmap}" -F -O $device 2>$DEVNULL`;
return OS_OTHER if ($? != 0);
my ($output) = $return =~ /Aggressive OS guesses:\s*(.*)/;
return pandora_get_os($self->{'dbh'}, $output);
if ($return =~ /Aggressive OS guesses:\s*(.*)/) {
return pandora_get_os($self->{'dbh'}, $1);
}
}
return OS_OTHER;
@ -536,7 +538,7 @@ sub PandoraFMS::Recon::Base::create_agents($$) {
return undef;
}
if ($agent->{'address'} ne '') {
if (defined($agent->{'address'}) && $agent->{'address'} ne '') {
pandora_add_agent_address(
$pa_config, $agent_id, $agent->{'agent_name'},
$agent->{'address'}, $dbh
@ -582,44 +584,14 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
# Clean name.
$device = clean_blank($device);
my @agents = get_db_rows($self->{'dbh'},
'SELECT * FROM taddress, taddress_agent, tagente
WHERE tagente.id_agente = taddress_agent.id_agent
AND taddress_agent.id_a = taddress.id_a
AND ip = ?', $device
);
# Does the host already exist?
my $agent;
foreach my $candidate (@agents) {
$agent = {map {$_} %$candidate}; # copy contents, do not use shallow copy
# exclude $device itself, because it handle corner case when target includes NAT
my @registered = map {$_->{ip}} get_db_rows($self->{'dbh'},
'SELECT ip FROM taddress, taddress_agent, tagente
WHERE tagente.id_agente = taddress_agent.id_agent
AND taddress_agent.id_a = taddress.id_a
AND tagente.id_agente = ?
AND taddress.ip != ?', $agent->{id_agente}, $device
);
foreach my $ip_addr (@registered) {
my @matched = grep { $_ =~ /^$ip_addr$/ } $self->get_addresses($device);
if (scalar(@matched) == 0) {
$agent = undef;
last;
}
}
last if(defined($agent)); # exit loop if match all ip_addr
}
if (!defined($agent)) {
$agent = get_agent_from_name($self->{'dbh'}, $device);
}
# Resolve hostnames.
my $host_name = (($self->{'resolve_names'} == 1) ? gethostbyaddr(inet_aton($device), AF_INET) : $device);
# Fallback to device IP if host name could not be resolved.
$host_name = $device if (!defined($host_name) || $host_name eq '');
my $agent = locate_agent($self->{'pa_config'}, $self->{'dbh'}, $host_name);
my ($agent_id, $agent_learning);
if (!defined($agent)) {
# Resolve hostnames.
my $host_name = $self->{'resolve_names'} == 1 ? gethostbyaddr (inet_aton($device), AF_INET) : $device;
$host_name = $device unless defined ($host_name);
# Guess the OS.

View File

@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.739";
my $pandora_build = "190927";
my $pandora_build = "191018";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
@ -762,7 +762,7 @@ sub transfer_xml {
my $file_path;
if (! (empty ($name))) {
$file_name = $name . "." . sprintf("%d",time()) . ".data";
$file_name = $name . "." . sprintf("%d",getCurrentUTimeMilis(). (rand()*10000)) . ".data";
}
else {
# Inherit file name

View File

@ -570,7 +570,8 @@ sub is_numeric {
my $SIGN = qr{ [+-] }xms;
my $NUMBER = qr{ ($SIGN?) ($DIGITS) }xms;
if ( $val !~ /^${NUMBER}$/ ) {
return 0; #Non-numeric
#Non-numeric, or maybe... leave looks_like_number try
return looks_like_number($val);
}
else {
return 1; #Numeric
@ -641,19 +642,29 @@ sub logger ($$;$) {
# Set the security level
my $security_level = 'info';
if ($level < 2) {
$security = 'crit';
$security_level = 'crit';
} elsif ($level < 5) {
$security = 'warn';
$security_level = 'warn';
}
openlog('pandora_server', 'ndelay', 'daemon');
syslog($security_level, $message);
closelog();
} else {
# Obtain the script that invoke this log
my $parent_caller = "";
$parent_caller = ( caller(2) )[1];
if (defined $parent_caller) {
$parent_caller = (split '/', $parent_caller)[-1];
$parent_caller =~ s/\.[^.]+$//;
$parent_caller = " ** " . $parent_caller . " **: ";
} else {
$parent_caller = " ";
}
open (FILE, ">> $file") or die "[FATAL] Could not open logfile '$file'";
# Get an exclusive lock on the file (LOCK_EX)
flock (FILE, 2);
print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " " . (defined($pa_config->{'servername'}) ? $pa_config->{'servername'} : '') . " [V". $level ."] " . $message . "\n";
print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . $parent_caller . (defined($pa_config->{'servername'}) ? $pa_config->{'servername'} : '') . " [V". $level ."] " . $message . "\n";
close (FILE);
}
}

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.739 PS190927";
my $version = "7.0NG.739 PS191018";
# Pandora server configuration
my %conf;

View File

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

View File

@ -19,7 +19,7 @@ Usage:
$0 -server <smsc_server:port> -user <user_id> -password <user_password> -source <source_number> -destination <destination_numbers> -message <short_message> [OPTIONS]
- <destination_numbers> Comma separated list of destination numbers (+123456789,+234567891,...)
- <destination_numbers> Comma separated list of destination numbers (123456789,234567891,...)
OPTIONS:
@ -45,7 +45,7 @@ OPTIONS:
Example:
$0 -server 192.168.1.50:2775 -user myuser -password mypassword -source +123456789 -destination +234567891 -message "Content of SMS message"
$0 -server 192.168.1.50:2775 -user myuser -password mypassword -source 123456789 -destination 234567891 -message "Content of SMS message"
EO_H
@ -85,7 +85,7 @@ if (!$config->{'message'}){
my ($smsc_server, $smsc_port) = split /:/, $config->{'server'};
my @destination_numbers = $config->{'destination'};
my @destination_numbers = split /,/, $config->{'destination'};
if (!$smsc_port){
$smsc_port = 2775;