Merge branch 'develop' into '1505-acl-de-grupos-para-los-elementos-de-la-consola-visual-dev'

# Conflicts:
#   pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
This commit is contained in:
vgilc 2017-11-15 12:04:11 +01:00
commit a72f7b006e
18 changed files with 134 additions and 58 deletions

View File

@ -1,5 +1,15 @@
START TRANSACTION;
SET @st_oum708 = (SELECT IF(
(SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled') > 0,
"ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL",
"SELECT 1"
));
PREPARE pr_oum708 FROM @st_oum708;
EXECUTE pr_oum708;
DEALLOCATE PREPARE pr_oum708;
ALTER TABLE tagente ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
COMMIT;

View File

@ -1157,10 +1157,10 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 7);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 9);
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '714');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '716');
-- ---------------------------------------------------------------------
-- Table `tplanned_downtime_agents`
@ -1342,6 +1342,10 @@ SET @vv1 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema =
IF @vv1>0 THEN
ALTER TABLE tbackup ADD COLUMN `filepath` varchar(512) NOT NULL DEFAULT "";
END IF;
SET @vv2 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled');
IF @vv2>0 THEN
ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL;
END IF;
END;
//
delimiter ;

View File

@ -1594,7 +1594,7 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '',
case '2c':
case '1':
default:
$command_str = $snmpwalk_bin . ' -m ALL -Oa -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg($snmp_community) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir;
$command_str = $snmpwalk_bin . ' -m ALL -Oa -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg(io_safe_output($snmp_community)) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir;
break;
}

View File

@ -1060,8 +1060,8 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu
}
// Short name
$name = $agent["nombre"];
if ($cut_names) {
$name = io_safe_output($agent["nombre"]);
if ((strlen ($name) > 16) && ($cut_names)) {
$name = ui_print_truncate_text($name, 16, false, true, false);
}
@ -1111,7 +1111,7 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu
}
$node = "\n" . $agent['id_node'].' [ parent="' . $agent['id_parent'] . '", color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' . $img_node . '</TD></TR>
<TR><TD>'.$name.'</TD></TR></TABLE>>,
<TR><TD>'.io_safe_input($name).'</TD></TR></TABLE>>,
shape="doublecircle", URL="'.$url.'",
tooltip="' . $url_tooltip . '"];' . "\n";
}
@ -1174,7 +1174,7 @@ function networkmap_create_module_group_node ($module_group, $simple = 0, $font_
'", fontsize='.$font_size.', style="filled", ' .
'fixedsize=true, width=0.30, height=0.30, ' .
'label=<<TABLE data-id_agent="' . $module_group['id_agent'] . '" data-status="' . $module_group['status'] . '" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' .
$module_group['name'] . '</TD></TR></TABLE>>,
io_safe_output($module_group['name']) . '</TD></TR></TABLE>>,
shape="square", URL="' . $url . '",
tooltip="' . $url_tooltip . '"];';
}
@ -1268,7 +1268,7 @@ function networkmap_create_module_node ($module, $simple = 0, $font_size = 10, $
'fixedsize=true, width=0.30, height=0.30, ' .
'label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' .
$img_node . '</TD></TR>
<TR><TD>' . $module['nombre'] . '</TD></TR></TABLE>>,
<TR><TD>' . io_safe_output($module['nombre']) . '</TD></TR></TABLE>>,
shape="circle", URL="' . $url . '",
tooltip="' . $url_tooltip . '"];';
}

View File

@ -212,6 +212,7 @@ function networkmap_process_networkmap($id = 0) {
$style['width'] = $node['width'];
$style['height'] = $node['height'];
$style['label'] = $node['text'];
$style['id_networkmap'] = $node['networkmap'];
$nodes_and_relations['nodes'][$index]['style'] = json_encode($style);
$index++;
@ -399,6 +400,13 @@ function networkmap_db_node_to_js_node($node, &$count, &$count_item_holding_area
if (isset($node['id_map'])) {
$item['map_id'] = $node['id_map'];
}
if (!isset($node['style']['id_networkmap']) || $node['style']['id_networkmap'] == '' || $node['style']['id_networkmap'] == 0) {
$item['networkmap_id'] = 0;
}
else {
$item['networkmap_id'] = $node['style']['id_networkmap'];
}
$count++;

View File

@ -196,7 +196,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve
}
}
else {
$command = $snmpwalk_bin . " -m ALL -M +" . escapeshellarg($config['homedir'] . "/attachment/mibs") . " -Cc -c " . escapeshellarg($community) . " -v " . escapeshellarg($version) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir;
$command = $snmpwalk_bin . " -m ALL -M +" . escapeshellarg($config['homedir'] . "/attachment/mibs") . " -Cc -c " . escapeshellarg(io_safe_output($community)) . " -v " . escapeshellarg($version) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir;
}
exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $command . "\"", $output, $rc);
}
@ -216,7 +216,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve
}
}
else {
exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
}
}
}
@ -236,7 +236,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve
}
}
else {
exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
}
}
@ -348,7 +348,7 @@ function snmp_browser_get_oid ($target_ip, $community, $target_oid, $version = '
exec ($snmpget_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' -x ' . escapeshellarg($snmp3_privacy_method) . ' -X ' . escapeshellarg($snmp3_privacy_pass) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
}
else {
exec ($snmpget_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -On -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
exec ($snmpget_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -On -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
}
if ($rc != 0) {

View File

@ -3288,7 +3288,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
'proportion_width' => $proportion_width);
}
$layout_data['label'] = visual_map_macro($layout_data['label']);
$layout_data['label'] = visual_map_macro($layout_data['label'],$layout_data["id_agente_modulo"]);
switch ($layout_data['type']) {
case LINE_ITEM:
@ -3706,9 +3706,14 @@ function visual_map_type_in_js($type) {
}
}
function visual_map_macro($label){
function visual_map_macro($label,$module){
$label = str_replace('_date_',strftime("%x"),$label);
$label = str_replace('_time_',strftime("%T"),$label);
$label = str_replace('_agent_',agents_get_alias(modules_get_agentmodule_agent($module)),$label);
$label = str_replace('_module_',modules_get_agentmodule_name($module),$label);
$label = str_replace('_agentdescription_',agents_get_description(modules_get_agentmodule_agent($module)),$label);
$label = str_replace('_address_',agents_get_address(modules_get_agentmodule_agent($module)),$label);
$label = str_replace('_moduledescription_',modules_get_agentmodule_descripcion($module),$label);
return $label;
}

View File

@ -38,6 +38,9 @@ if ($new_networkmap) {
$source = 'group';
$ip_mask = '';
$dont_show_subgroups = false;
$offset_x = "";
$offset_y = "";
$scale_z = 0.5;
}
$disabled_generation_method_select = false;
@ -75,6 +78,10 @@ if ($edit_networkmap) {
$description = $values['description'];
$filter = json_decode($values['filter'], true);
$offset_x = $filter['x_offs'];
$offset_y = $filter['y_offs'];
$scale_z = $filter['z_dash'];
$node_radius = $filter['node_radius'];
@ -190,6 +197,17 @@ else {
$table->data[3][0] = __('Description');
$table->data[3][1] = html_print_textarea ('description', 7, 25, $description, '', true);
$table->data[4][0] = __('Position X');
$table->data[4][1] = html_print_input_text ('pos_x', $offset_x, '', 2, 10,true);
$table->data[5][0] = __('Position Y');
$table->data[5][1] = html_print_input_text ('pos_y', $offset_y, '', 2, 10,true);
$table->data[6][0] = __('Zoom scale');
if ($scale_z == "") {
$scale_z = 0.5;
}
$table->data[6][1] = html_print_input_text ('scale_z', $scale_z, '', 2, 10,true) . ui_print_help_tip (__('Introduce zoom level. 1 = Highest resolution. Figures may include decimals'), true);
$table->data['source'][0] = __('Source');
$table->data['source'][1] =
@ -222,8 +240,8 @@ else {
'radial_dinamic' => 'radial dinamic'
);
$table->data[4][0] = __('Method generation networkmap');
$table->data[4][1] = html_print_select($methods, 'method', $method,
$table->data[7][0] = __('Method generation networkmap');
$table->data[7][1] = html_print_select($methods, 'method', $method,
'', '', 'twopi', true, false, true, '',
$disabled_generation_method_select);

View File

@ -84,6 +84,10 @@ if ($new_networkmap || $save_networkmap) {
$dont_show_subgroups = (int)get_parameter('dont_show_subgroups', 0);
$node_radius = (int)get_parameter('node_radius', 40);
$description = get_parameter('description', '');
$offset_x = get_parameter('pos_x');
$offset_y = get_parameter('pos_y');
$scale_z = get_parameter('scale_z', 0.5);
$values = array();
$values['name'] = $name;
@ -141,6 +145,9 @@ if ($new_networkmap || $save_networkmap) {
$filter = array();
$filter['dont_show_subgroups'] = $dont_show_subgroups;
$filter['node_radius'] = $node_radius;
$filter['x_offs'] = $offset_x;
$filter['y_offs'] = $offset_y;
$filter['z_dash'] = $scale_z;
$values['filter'] = json_encode($filter);
$result = false;
@ -153,8 +160,10 @@ if ($new_networkmap || $save_networkmap) {
__('Succesfully created'), __('Could not be created'), '',
true);
// Force the tab = 'list'
$tab = "list";
$id = $result;
// Force the tab = 'view'
$tab = "view";
}
}
// The networkmap exists
@ -209,26 +218,15 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
'recon_task_id', 0);
$source = (string)get_parameter('source', 'group');
$offset_x = get_parameter('pos_x');
$offset_y = get_parameter('pos_y');
$scale_z = get_parameter('scale_z', 0.5);
$values = array();
$values['name'] = $name;
$values['id_group'] = $id_group;
/*
if ($source == 'group') {
$values['source'] = 0;
$values['source_data'] = $id_group;
}
else if ($source == 'recon_task') {
$values['source'] = 1;
$values['source_data'] = $recon_task_id;
}
else if ($source == 'ip_mask') {
$values['source'] = 2;
$values['source_data'] = $ip_mask;
}
*/
switch ($method) {
case 'twopi':
$values['generation_method'] = 2;
@ -262,6 +260,9 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
$filter = json_decode($row['filter'], true);
$filter['dont_show_subgroups'] = $dont_show_subgroups;
$filter['node_radius'] = $node_radius;
$filter['x_offs'] = $offset_x;
$filter['y_offs'] = $offset_y;
$filter['z_dash'] = $scale_z;
$values['filter'] = json_encode($filter);

View File

@ -677,10 +677,14 @@ if (is_ajax ()) {
}
}
//--------------END AJAX------------------------------------------------
$id = (int) get_parameter('id_networkmap', 0);
if ($id == 0) {
$id = (int) get_parameter('id_networkmap', 0);
}
$dash_mode = 0;
$map_dash_details = array();
$networkmap = db_get_row('tmap', 'id', $id);
if (enterprise_installed()) {
include_once("enterprise/dashboard/widgets/network_map.php");
if ($id_networkmap) {
@ -693,10 +697,14 @@ if (enterprise_installed()) {
$map_dash_details['y_offs'] = $y_offs;
$map_dash_details['z_dash'] = $z_dash;
}
else {
$networkmap_filter = json_decode($networkmap['filter'], true);
$map_dash_details['x_offs'] = $networkmap_filter['x_offs'];
$map_dash_details['y_offs'] = $networkmap_filter['y_offs'];
$map_dash_details['z_dash'] = $networkmap_filter['z_dash'];
}
}
$networkmap = db_get_row('tmap', 'id', $id);
if ($networkmap === false) {
ui_print_page_header(__('Networkmap'),
"images/bricks.png", false, "network_map_enterprise", false);

View File

@ -59,6 +59,8 @@ if (check_acl ($config['id_user'], 0, "AR")) {
$sub2["operation/agentes/status_monitor"]["text"] = __('Monitor detail');
$sub2["operation/agentes/status_monitor"]["refr"] = 0;
enterprise_hook ('tag_view_submenu');
$sub2["operation/agentes/alerts_status"]["text"] = __('Alert detail');
$sub2["operation/agentes/alerts_status"]["refr"] = 0;

View File

@ -208,6 +208,11 @@ $ignored_params['refr'] = '';
$(".overlay").removeClass("overlay").addClass("overlaydisabled");
// Start the map fetch
//~ fetchMap();
});
$(window).load (function () {
$('.item:not(.icon) img:not(.b64img)').each( function() {
if ($(this).css('float')=='left' || $(this).css('float')=='right') {
if( $(this).parent()[0].tagName == 'DIV'){

View File

@ -183,7 +183,10 @@ $ignored_params['refr'] = '';
});
$(".overlay").removeClass("overlay").addClass("overlaydisabled");
});
$(window).load (function () {
$('.item:not(.icon) img').each(function(){

View File

@ -279,7 +279,10 @@ $ignored_params['refr'] = '';
});
$(".overlay").removeClass("overlay").addClass("overlaydisabled");
});
$(window).load (function () {
$('.item:not(.icon) img:not(.b64img)').each( function() {
if ($(this).css('float')=='left' || $(this).css('float')=='right') {
if( $(this).parent()[0].tagName == 'DIV'){
@ -332,6 +335,6 @@ $ignored_params['refr'] = '';
height = parseInt($(this).css("height")) - 30;
$(this).css('height', height);
});
});
</script>

View File

@ -109,10 +109,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''),
('custom_report_front_footer', ''),
('MR', 8),
('MR', 9),
('identification_reminder', 1),
('identification_reminder_timestamp', 0),
('current_package_enterprise', '715'),
('current_package_enterprise', '716'),
('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.0009765625":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}');
UNLOCK TABLES;

View File

@ -525,7 +525,7 @@ Process an alert given the status returned by pandora_evaluate_alert.
##########################################################################
sub pandora_process_alert ($$$$$$$$;$) {
my ($pa_config, $data, $agent, $module, $alert, $rc, $dbh, $timestamp, $extra_macros) = @_;
if (defined ($agent)) {
logger ($pa_config, "Processing alert '" . safe_output($alert->{'name'}) . "' for agent '" . safe_output($agent->{'nombre'}) . "': " . (defined ($AlertStatus[$rc]) ? $AlertStatus[$rc] : 'Unknown status') . ".", 10);
}
@ -565,12 +565,12 @@ sub pandora_process_alert ($$$$$$$$;$) {
# Generate an event
if ($table eq 'tevent_alert') {
pandora_event ($pa_config, "Alert ceased (" .
$alert->{'name'} . ")", 0, 0, $alert->{'priority'}, $id,
safe_output($alert->{'name'}) . ")", 0, 0, $alert->{'priority'}, $id,
(defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0),
"alert_ceased", 0, $dbh, 'Pandora', '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions);
} else {
pandora_event ($pa_config, "Alert ceased (" .
$alert->{'name'} . ")", $agent->{'id_grupo'},
safe_output($alert->{'name'}) . ")", $agent->{'id_grupo'},
$agent->{'id_agente'}, $alert->{'priority'}, $id,
(defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0),
"alert_ceased", 0, $dbh, 'Pandora', '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions);
@ -1622,9 +1622,8 @@ sub pandora_planned_downtime_disabled_once_stop($$) {
db_do($dbh, 'UPDATE tplanned_downtime
SET executed = 0
WHERE id = ?', $downtime->{'id'});
pandora_event ($pa_config,
'(Created by ' . $downtime->{'id_user'} . ') Server ' . $pa_config->{'servername'} . ' stopped planned downtime: ' . $downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
'(Created by ' . $downtime->{'id_user'} . ') Server ' . $pa_config->{'servername'} . ' stopped planned downtime: ' . safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
pandora_planned_downtime_unset_disabled_elements($pa_config,
$dbh, $downtime);
@ -1669,8 +1668,9 @@ sub pandora_planned_downtime_disabled_once_start($$) {
SET executed = 1
WHERE id = ?', $downtime->{'id'});
print"pandora_planned_downtime_disabled_once_start\n";
pandora_event ($pa_config,
"(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
"(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
pandora_planned_downtime_set_disabled_elements($pa_config,
$dbh, $downtime);
@ -1860,7 +1860,7 @@ sub pandora_planned_downtime_quiet_once_stop($$) {
SET executed = 0
WHERE id = ?', $downtime->{'id'});
pandora_event ($pa_config,
"(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
"(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." stopped planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
pandora_planned_downtime_unset_quiet_elements($pa_config,
$dbh, $downtime->{'id'});
@ -1901,8 +1901,9 @@ sub pandora_planned_downtime_quiet_once_start($$) {
db_do($dbh, 'UPDATE tplanned_downtime
SET executed = 1
WHERE id = ?', $downtime->{'id'});
print"pandora_planned_downtime_quiet_once_start\n";
pandora_event ($pa_config,
"(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
"(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
pandora_planned_downtime_set_quiet_elements($pa_config,
$dbh, $downtime->{'id'});
@ -1955,8 +1956,9 @@ sub pandora_planned_downtime_monthly_start($$) {
db_do($dbh, 'UPDATE tplanned_downtime
SET executed = 1
WHERE id = ?', $downtime->{'id'});
print"pandora_planned_downtime_monthly_start\n";
pandora_event ($pa_config,
"Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
"Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
if ($downtime->{'type_downtime'} eq "quiet") {
@ -2031,8 +2033,9 @@ sub pandora_planned_downtime_monthly_stop($$) {
db_do($dbh, 'UPDATE tplanned_downtime
SET executed = 0
WHERE id = ?', $downtime->{'id'});
print"pandora_planned_downtime_monthly_stop\n";
pandora_event ($pa_config,
"Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
"Server ".$pa_config->{'servername'}." stopped planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
if ($downtime->{'type_downtime'} eq "quiet") {
pandora_planned_downtime_unset_quiet_elements($pa_config,
@ -2140,8 +2143,9 @@ sub pandora_planned_downtime_weekly_start($$) {
db_do($dbh, 'UPDATE tplanned_downtime
SET executed = 1
WHERE id = ?', $downtime->{'id'});
print"pandora_planned_downtime_weekly_start\n";
pandora_event ($pa_config,
"Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
"Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
if ($downtime->{'type_downtime'} eq "quiet") {
pandora_planned_downtime_set_quiet_elements($pa_config,
@ -2254,8 +2258,10 @@ sub pandora_planned_downtime_weekly_stop($$) {
db_do($dbh, 'UPDATE tplanned_downtime
SET executed = 0
WHERE id = ?', $downtime->{'id'});
print"pandora_planned_downtime_weekly_stop\n";
pandora_event ($pa_config,
"Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
"Server ".$pa_config->{'servername'}." stopped planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
if ($downtime->{'type_downtime'} eq "quiet") {
pandora_planned_downtime_unset_quiet_elements($pa_config,
@ -2985,7 +2991,7 @@ sub pandora_create_agent ($$$$$$$$$$;$$$$$$$$$) {
}
logger ($pa_config, "Server '$server_name' CREATED agent '$agent_name' address '$address'.", 10);
pandora_event ($pa_config, "Agent [$alias] created by $server_name", $group_id, $agent_id, 2, 0, 0, 'new_agent', 0, $dbh);
pandora_event ($pa_config, "Agent [" . safe_output($alias) . "] created by $server_name", $group_id, $agent_id, 2, 0, 0, 'new_agent', 0, $dbh);
return $agent_id;
}

View File

@ -333,19 +333,22 @@ sub process_xml_data ($$$$$) {
if (defined ($data->{'group_id'}) && $data->{'group_id'} ne '') {
$group_id = $data->{'group_id'};
if (! defined (get_group_name ($dbh, $group_id))) {
pandora_event ($pa_config, "Unable to create agent '$agent_name': group ID '" . $group_id . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
print "UNABLE GROUP ID\n";
pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': group ID '" . $group_id . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
logger($pa_config, "Group ID " . $group_id . " does not exist.", 3);
return;
}
} elsif (defined ($data->{'group'}) && $data->{'group'} ne '') {
$group_id = get_group_id ($dbh, $data->{'group'});
if (! defined (get_group_name ($dbh, $group_id))) {
pandora_event ($pa_config, "Unable to create agent '$agent_name': group '" . $data->{'group'} . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
print "UNABLE GROUP\n";
pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': group '" . safe_output($data->{'group'}) . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
logger($pa_config, "Group " . $data->{'group'} . " does not exist.", 3);
return;
}
} else {
pandora_event ($pa_config, "Unable to create agent '$agent_name': autocreate_group $group_id does not exist. Edit the pandora_server.conf file and change it.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
print "UNABLE AUTOCREATE\n";
pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': autocreate_group $group_id does not exist. Edit the pandora_server.conf file and change it.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
logger($pa_config, "Group id $group_id does not exist (check autocreate_group config token).", 3);
return;
}

View File

@ -421,7 +421,7 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
$agent_id = pandora_create_agent($self->{'pa_config'}, $self->{'pa_config'}->{'servername'}, $host_name, $device, $self->{'group_id'}, 0, $id_os, '', 300, $self->{'dbh'});
return undef unless defined ($agent_id) and ($agent_id > 0);
pandora_event($self->{'pa_config'}, "[RECON] New " . $self->get_device_type($device) . " found (" . join(',', $self->get_addresses($device)) . ").", $self->{'group_id'}, $agent_id, 2, 0, 0, 'recon_host_detected', 0, $self->{'dbh'});
pandora_event($self->{'pa_config'}, "[RECON] New " . safe_output($self->get_device_type($device)) . " found (" . join(',', safe_output($self->get_addresses($device))) . ").", $self->{'group_id'}, $agent_id, 2, 0, 0, 'recon_host_detected', 0, $self->{'dbh'});
$agent_learning = 1;
# Create network profile modules for the agent