Merge remote-tracking branch 'origin/develop' into ent-7074-Command-Center
This commit is contained in:
commit
100ae705f8
|
@ -5,6 +5,22 @@ ALTER TABLE `tagent_custom_fields` MODIFY COLUMN `combo_values` TEXT NOT NULL DE
|
|||
ALTER TABLE `treport_content` MODIFY `external_source` MEDIUMTEXT;
|
||||
ALTER TABLE `treport_content_template` MODIFY `external_source` MEDIUMTEXT;
|
||||
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `agent` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `id_usuario` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `id_grupo` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `evento` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `event_type` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `module` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `alert` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `criticity` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `user_comment` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `id_tag` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `name` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `group_recursion` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_content` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_source` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_agent` TEXT;
|
||||
|
||||
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Event name\",\"Event type\",\"Source\",\"Agent name or _agent_\",\"Event severity\",\"ID extra\",\"Tags separated by commas\",\"Comments\",\"\",\"\"]' WHERE `name` = "Monitoring Event";
|
||||
|
||||
UPDATE `tskin` SET `name` = 'Default theme' , `relative_path` = 'pandora.css' WHERE `id` = 1;
|
||||
|
|
|
@ -628,6 +628,22 @@ ALTER TABLE `tevent_rule` MODIFY COLUMN `event_type` enum('','unknown','alert_fi
|
|||
ALTER TABLE `tevent_rule` MODIFY COLUMN `criticity` int(4) unsigned DEFAULT NULL;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `id_grupo` mediumint(4) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `agent` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `id_usuario` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `id_grupo` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `evento` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `event_type` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `module` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `alert` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `criticity` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `user_comment` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `id_tag` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `name` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `group_recursion` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_content` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_source` TEXT;
|
||||
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_agent` TEXT;
|
||||
|
||||
UPDATE `tevent_rule` SET `operator_agent` = "REGEX" WHERE `agent` != '';
|
||||
UPDATE `tevent_rule` SET `operator_id_usuario` = "REGEX" WHERE `id_usuario` != '';
|
||||
UPDATE `tevent_rule` SET `operator_id_grupo` = "REGEX" WHERE `id_grupo` > 0;
|
||||
|
|
|
@ -85,7 +85,7 @@ visual_map_editor_print_item_palette($visualConsole['id'], $background);
|
|||
if (!defined('METACONSOLE')) {
|
||||
echo '<div id="frame_view" class="frame_view_meta">';
|
||||
} else {
|
||||
echo '<div id="frame_view" class="frame_view_node">';
|
||||
echo '<div id="frame_view" class="frame_view_node mrgn_top_meta_35px">';
|
||||
}
|
||||
|
||||
echo '<div id="background" class="" style="top:0px;
|
||||
|
|
|
@ -834,7 +834,7 @@ echo '</form>';
|
|||
|
||||
// AJAX call to check API connection.
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
type: "POST",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: data
|
||||
|
|
|
@ -1645,7 +1645,11 @@ function config_update_config()
|
|||
$integria_hostname = (string) get_parameter('integria_hostname', $config['integria_hostname']);
|
||||
|
||||
if (parse_url($integria_hostname, PHP_URL_SCHEME) === null) {
|
||||
$integria_hostname = 'http://'.$integria_hostname;
|
||||
if (empty($_SERVER['HTTPS']) === false) {
|
||||
$integria_hostname = 'https://'.$integria_hostname;
|
||||
} else {
|
||||
$integria_hostname = 'http://'.$integria_hostname;
|
||||
}
|
||||
}
|
||||
|
||||
if (!config_update_value('integria_hostname', $integria_hostname)) {
|
||||
|
|
|
@ -718,7 +718,8 @@ function html_print_select(
|
|||
$select_all=false,
|
||||
$simple_multiple_options=false,
|
||||
$required=false,
|
||||
$truncate_size=false
|
||||
$truncate_size=false,
|
||||
$select2_enable=true
|
||||
) {
|
||||
$output = "\n";
|
||||
|
||||
|
@ -890,7 +891,7 @@ function html_print_select(
|
|||
$select2 = 'select2_dark.min';
|
||||
}
|
||||
|
||||
if ($multiple === false) {
|
||||
if ($multiple === false && $select2_enable === true) {
|
||||
if (is_ajax()) {
|
||||
$output .= '<script src="';
|
||||
$output .= ui_get_full_url(
|
||||
|
@ -5400,4 +5401,4 @@ function html_print_select_search(
|
|||
} else {
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -336,7 +336,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background)
|
|||
'icon',
|
||||
'group_item',
|
||||
];
|
||||
$form_items['preview_row']['html'] = '<td align="left" colspan="2" class="right">'.'<div id="preview" class="right"></div></td>';
|
||||
$form_items['preview_row']['html'] = '<td align="left" colspan="2">'.'<div id="preview" class="right"></div></td>';
|
||||
|
||||
$form_items['background_color'] = [];
|
||||
$form_items['background_color']['items'] = [
|
||||
|
@ -358,6 +358,18 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background)
|
|||
'white',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
).'</td>';
|
||||
|
||||
|
@ -510,7 +522,29 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background)
|
|||
$form_items['event_max_time_row'] = [];
|
||||
$form_items['event_max_time_row']['items'] = ['auto_sla_graph'];
|
||||
$form_items['event_max_time_row']['html'] = '<td align="left">'.__('Max. Time').'</td>
|
||||
<td align="left">'.html_print_select($event_times, 'event_max_time_row', '', '', 0, 86400, true, false, false).'</td>';
|
||||
<td align="left">'.html_print_select(
|
||||
$event_times,
|
||||
'event_max_time_row',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
86400,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
).'</td>';
|
||||
|
||||
$form_items['type_graph'] = [];
|
||||
$form_items['type_graph']['items'] = [
|
||||
|
@ -530,6 +564,18 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background)
|
|||
'area',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
).'</td>';
|
||||
|
||||
|
@ -800,7 +846,29 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background)
|
|||
$form_items['bars_graph_type'] = [];
|
||||
$form_items['bars_graph_type']['items'] = ['bars_graph'];
|
||||
$form_items['bars_graph_type']['html'] = '<td align="left">'.__('Type').'</td>
|
||||
<td align="left">'.html_print_select($bars_graph_types, 'bars_graph_type', 'vertical', '', '', '', true).'</td>';
|
||||
<td align="left">'.html_print_select(
|
||||
$bars_graph_types,
|
||||
'bars_graph_type',
|
||||
'vertical',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
).'</td>';
|
||||
|
||||
// Insert and modify before the buttons to create or update.
|
||||
if (enterprise_installed()) {
|
||||
|
@ -809,11 +877,11 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background)
|
|||
|
||||
$form_items['button_update_row'] = [];
|
||||
$form_items['button_update_row']['items'] = ['datos'];
|
||||
$form_items['button_update_row']['html'] = '<td align="left" colspan="2" class="right">'.html_print_button(__('Cancel'), 'cancel_button', false, 'cancel_button_palette_callback();', 'class="sub cancel"', true).'<span ="margin-right:10px;"> </span>'.html_print_button(__('Update'), 'update_button', false, 'update_button_palette_callback();', 'class="sub upd"', true).'</td>';
|
||||
$form_items['button_update_row']['html'] = '<td align="left" colspan="2" style="text-align: right;">'.html_print_button(__('Cancel'), 'cancel_button', false, 'cancel_button_palette_callback();', 'class="sub cancel"', true).'<span ="margin-right:10px;"> </span>'.html_print_button(__('Update'), 'update_button', false, 'update_button_palette_callback();', 'class="sub upd"', true).'</td>';
|
||||
|
||||
$form_items['button_create_row'] = [];
|
||||
$form_items['button_create_row']['items'] = ['datos'];
|
||||
$form_items['button_create_row']['html'] = '<td align="left" colspan="2" class="right">'.html_print_button(__('Cancel'), 'cancel_button', false, 'cancel_button_palette_callback();', 'class="sub cancel"', true).'<span ="margin-right:10px;"> </span>'.html_print_button(__('Create'), 'create_button', false, 'create_button_palette_callback();', 'class="sub wand"', true).'</td>';
|
||||
$form_items['button_create_row']['html'] = '<td align="left" colspan="2" style="text-align: right;">'.html_print_button(__('Cancel'), 'cancel_button', false, 'cancel_button_palette_callback();', 'class="sub cancel"', true).'<span ="margin-right:10px;"> </span>'.html_print_button(__('Create'), 'create_button', false, 'create_button_palette_callback();', 'class="sub wand"', true).'</td>';
|
||||
|
||||
foreach ($form_items as $item => $item_options) {
|
||||
echo '<tr id="'.$item.'" class="'.implode(' ', (array) $item_options['items']).'">';
|
||||
|
@ -829,7 +897,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background)
|
|||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="advance_options" class="invisible">
|
||||
<tbody id="advance_options" style="display: none">
|
||||
<?php
|
||||
$form_items_advance = [];
|
||||
|
||||
|
|
|
@ -1,12 +1,44 @@
|
|||
.rules div {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
li#li-buttons-alert-list > div {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
ul.sample li {
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
ul.sample li:last-child {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
#rule-builder .rule-builder-actions li {
|
||||
display: inline;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
li#li-filters_show_action_alerts > label,
|
||||
li#li-buttons-alert-list > label,
|
||||
li#li-filters-alert-list > label {
|
||||
width: initial;
|
||||
}
|
||||
|
||||
form#advanced_filters_alert ul li label,
|
||||
form#general_filters_alert ul li label {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
#rules.flex-row label {
|
||||
flex: 1 1 70px;
|
||||
}
|
||||
|
||||
li#li-from-to-threshold > label:not(:first-child),
|
||||
li#li-time-from-to > label:not(:first-child) {
|
||||
width: initial;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
#rule-builder .rule-builder-actions li label {
|
||||
width: 0;
|
||||
}
|
||||
|
@ -21,10 +53,6 @@ ul.sample {
|
|||
flex: 1 1 300px;
|
||||
}
|
||||
|
||||
#rules.flex-row label {
|
||||
flex: 1 1 70px;
|
||||
}
|
||||
|
||||
#rules.flex-row div {
|
||||
flex: 10 1 200px;
|
||||
}
|
||||
|
@ -39,17 +67,6 @@ span.rule-title {
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
li#li-filters_show_action_alerts > label,
|
||||
li#li-buttons-alert-list > label,
|
||||
li#li-filters-alert-list > label {
|
||||
width: initial;
|
||||
}
|
||||
|
||||
form#advanced_filters_alert ul li label,
|
||||
form#general_filters_alert ul li label {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
form#conditions_filters_alert ul li label:first-child {
|
||||
width: 300px;
|
||||
}
|
||||
|
@ -62,17 +79,14 @@ li#li-description textarea {
|
|||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
li#li-from-to-threshold > label:not(:first-child),
|
||||
li#li-time-from-to > label:not(:first-child) {
|
||||
width: initial;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
li#li-from-to-threshold > input,
|
||||
li#li-time-from-to > input {
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.mode_table_firing table.info_table thead tr th img {
|
||||
padding: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
form#advanced_filters_alert textarea {
|
||||
flex: 1 1 auto;
|
||||
height: 5em;
|
||||
|
@ -106,19 +120,16 @@ ul.sample {
|
|||
max-width: 50%;
|
||||
flex-grow: 1;
|
||||
justify-content: space-between;
|
||||
min-width: 300px;
|
||||
}
|
||||
ul.sample li {
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
ul.sample li:last-child {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
div.target {
|
||||
flex-grow: 1;
|
||||
flex-basis: auto;
|
||||
margin-left: 3em;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
}
|
||||
div.target.flex {
|
||||
display: block;
|
||||
|
@ -140,28 +151,28 @@ div.target.flex {
|
|||
position: relative;
|
||||
top: 25%;
|
||||
display: block;
|
||||
left: 37%;
|
||||
margin: 0 auto;
|
||||
font-size: 3em;
|
||||
color: #aaa;
|
||||
overflow: hidden;
|
||||
width: 6em;
|
||||
background: #fff;
|
||||
text-align: center;
|
||||
z-index: 2;
|
||||
}
|
||||
div#rules.show::after {
|
||||
div#rules::after {
|
||||
content: "Drop Here";
|
||||
position: relative;
|
||||
top: 25%;
|
||||
display: block;
|
||||
left: 37%;
|
||||
margin: 2em auto;
|
||||
font-size: 3em;
|
||||
color: #aaa;
|
||||
overflow: hidden;
|
||||
width: 6em;
|
||||
background: #fff;
|
||||
text-align: center;
|
||||
z-index: 2;
|
||||
}
|
||||
div#rules.cleanup::after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
div#rules.show {
|
||||
box-shadow: 0 0 15px -5px #424242;
|
||||
border: 1px solid #ddd;
|
||||
|
@ -185,7 +196,10 @@ div#rules.show {
|
|||
opacity: 0.2;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.field.disabledElements {
|
||||
opacity: 0.2;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.log {
|
||||
background-color: #638460;
|
||||
}
|
||||
|
@ -209,10 +223,6 @@ div#rules.show {
|
|||
background-color: #424242;
|
||||
}
|
||||
|
||||
.rules div {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.inEdit {
|
||||
background-color: #888;
|
||||
}
|
||||
|
@ -253,11 +263,6 @@ div#rules.show {
|
|||
font-weight: bolder;
|
||||
}
|
||||
|
||||
.mode_table_firing table.info_table thead tr th img {
|
||||
padding: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#rules select.click-list-elements {
|
||||
border-radius: 0px;
|
||||
background-color: #424242;
|
||||
|
|
|
@ -8348,7 +8348,7 @@ span,
|
|||
float: right;
|
||||
margin-right: 100px;
|
||||
}
|
||||
.steps_vsmap {
|
||||
div.steps_vsmap {
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
|
|
|
@ -2913,18 +2913,18 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` (
|
|||
`order` int(10) unsigned default '0',
|
||||
`window` int(10) NOT NULL default '0',
|
||||
`count` int(4) NOT NULL default '1',
|
||||
`agent` text default '',
|
||||
`id_usuario` varchar(100) NOT NULL default '',
|
||||
`id_grupo` mediumint(4) default NULL,
|
||||
`evento` text NOT NULL default '',
|
||||
`event_type` enum('','unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal') default '',
|
||||
`module` text default '',
|
||||
`alert` text default '',
|
||||
`criticity` int(4) unsigned default NULL,
|
||||
`user_comment` text NOT NULL,
|
||||
`id_tag` integer(10) unsigned NOT NULL default '0',
|
||||
`name` text default '',
|
||||
`group_recursion` INT(1) unsigned default 0,
|
||||
`agent` text,
|
||||
`id_usuario` text,
|
||||
`id_grupo` text,
|
||||
`evento` text,
|
||||
`event_type` text,
|
||||
`module` text,
|
||||
`alert` text,
|
||||
`criticity` text,
|
||||
`user_comment` text,
|
||||
`id_tag` text,
|
||||
`name` text,
|
||||
`group_recursion` text,
|
||||
`log_content` text,
|
||||
`log_source` text,
|
||||
`log_agent` text,
|
||||
|
|
|
@ -470,6 +470,9 @@ log_window 3600
|
|||
# Pre-load windows on start with available information. (PANDORA FMS ENTERPRISE ONLY).
|
||||
#preload_windows 0
|
||||
|
||||
# Correlated Alerts, group cache ttl (in seconds). Set to 0 to disable. (PANDORA FMS ENTERPRISE ONLY).
|
||||
#event_server_cache_ttl 10
|
||||
|
||||
# If set to 1, an alert will not be fired if the last event it generated is in 'in-process' status.
|
||||
|
||||
event_inhibit_alerts 0
|
||||
|
|
|
@ -302,6 +302,7 @@ sub pandora_load_config {
|
|||
$pa_config->{"eventserver"} = 1; # 4.0
|
||||
$pa_config->{"event_window"} = 3600; # 4.0
|
||||
$pa_config->{"log_window"} = 3600; # 7.741
|
||||
$pa_config->{"event_server_cache_ttl"} = 10; # 7.754
|
||||
$pa_config->{"preload_windows"} = 0; # 7.741
|
||||
$pa_config->{"icmpserver"} = 0; # 4.0
|
||||
$pa_config->{"icmp_threads"} = 3; # 4.0
|
||||
|
@ -1001,6 +1002,9 @@ sub pandora_load_config {
|
|||
elsif ($parametro =~ m/^preload_windows\s+([0-9]*)/i) {
|
||||
$pa_config->{'preload_windows'}= clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^event_server_cache_ttl\s+([0-9]*)/i) {
|
||||
$pa_config->{"event_server_cache_ttl"} = clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^snmp_threads\s+([0-9]*)/i) {
|
||||
$pa_config->{'snmp_threads'}= clean_blank($1);
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ our @EXPORT = qw(
|
|||
get_priority_name
|
||||
get_server_id
|
||||
get_tag_id
|
||||
get_tag_name
|
||||
get_group_name
|
||||
get_template_id
|
||||
get_template_module_id
|
||||
|
@ -276,6 +277,20 @@ sub get_tag_id ($$) {
|
|||
return defined ($rc) ? $rc : -1;
|
||||
}
|
||||
|
||||
########################################################################
|
||||
## Return the name of a tag given its id.
|
||||
########################################################################
|
||||
sub get_tag_name ($$) {
|
||||
my ($dbh, $id) = @_;
|
||||
|
||||
my $rc = get_db_value(
|
||||
$dbh, "SELECT name FROM ttag
|
||||
WHERE id_tag = ?",
|
||||
safe_input($id)
|
||||
);
|
||||
return $rc;
|
||||
}
|
||||
|
||||
########################################################################
|
||||
## Return the first enabled server name found.
|
||||
########################################################################
|
||||
|
|
|
@ -792,59 +792,64 @@ sub transfer_xml {
|
|||
my $file_name;
|
||||
my $file_path;
|
||||
|
||||
if (! (empty ($name))) {
|
||||
$file_name = $name . "." . sprintf("%d",getCurrentUTimeMilis(). (rand()*10000)) . ".data";
|
||||
}
|
||||
else {
|
||||
# Inherit file name
|
||||
($file_name) = $xml =~ /\s+agent_name='(.*?)'\s+.*$/m;
|
||||
if (empty($file_name)){
|
||||
($file_name) = $xml =~ /\s+agent_name="(.*?)"\s+.*$/m;
|
||||
if (! -f $xml) {
|
||||
if (! (empty ($name))) {
|
||||
$file_name = $name . "." . sprintf("%d",getCurrentUTimeMilis(). (rand()*10000)) . ".data";
|
||||
}
|
||||
if (empty($file_name)){
|
||||
$file_name = trim(`hostname`);
|
||||
else {
|
||||
# Inherit file name
|
||||
($file_name) = $xml =~ /\s+agent_name='(.*?)'\s+.*$/m;
|
||||
if (empty($file_name)){
|
||||
($file_name) = $xml =~ /\s+agent_name="(.*?)"\s+.*$/m;
|
||||
}
|
||||
if (empty($file_name)){
|
||||
$file_name = trim(`hostname`);
|
||||
}
|
||||
|
||||
$file_name .= "." . sprintf("%d",time()) . ".data";
|
||||
}
|
||||
|
||||
$file_name .= "." . sprintf("%d",time()) . ".data";
|
||||
}
|
||||
logger($conf, "transfer_xml", "Failed to generate file name.") if empty($file_name);
|
||||
|
||||
logger($conf, "transfer_xml", "Failed to generate file name.") if empty($file_name);
|
||||
$conf->{temp} = $conf->{tmp} if (empty($conf->{temp}) && defined($conf->{tmp}));
|
||||
$conf->{temp} = $conf->{temporal} if (empty($conf->{temp}) && defined($conf->{temporal}));
|
||||
$conf->{temp} = $conf->{__system}->{tmp} if (empty($conf->{temp}) && defined($conf->{__system})) && (ref($conf->{__system}) eq "HASH");
|
||||
$conf->{temp} = $ENV{'TMP'} if empty($conf->{temp}) && $^O =~ /win/i;
|
||||
$conf->{temp} = '/tmp' if empty($conf->{temp}) && $^O =~ /lin/i;
|
||||
|
||||
$conf->{temp} = $conf->{tmp} if (empty($conf->{temp}) && defined($conf->{tmp}));
|
||||
$conf->{temp} = $conf->{temporal} if (empty($conf->{temp}) && defined($conf->{temporal}));
|
||||
$conf->{temp} = $conf->{__system}->{tmp} if (empty($conf->{temp}) && defined($conf->{__system})) && (ref($conf->{__system}) eq "HASH");
|
||||
$conf->{temp} = $ENV{'TMP'} if empty($conf->{temp}) && $^O =~ /win/i;
|
||||
$conf->{temp} = '/tmp' if empty($conf->{temp}) && $^O =~ /lin/i;
|
||||
|
||||
$file_path = $conf->{temp} . "/" . $file_name;
|
||||
|
||||
#Creating XML file in temp directory
|
||||
|
||||
if ( -e $file_path ) {
|
||||
sleep (1);
|
||||
$file_name = $name . "." . sprintf("%d",time()) . ".data";
|
||||
$file_path = $conf->{temp} . "/" . $file_name;
|
||||
|
||||
#Creating XML file in temp directory
|
||||
|
||||
if ( -e $file_path ) {
|
||||
sleep (1);
|
||||
$file_name = $name . "." . sprintf("%d",time()) . ".data";
|
||||
$file_path = $conf->{temp} . "/" . $file_name;
|
||||
}
|
||||
|
||||
my $r = open (my $FD, ">>", $file_path);
|
||||
|
||||
if (empty($r)) {
|
||||
print_stderror($conf, "Cannot write to [" . $file_path . "]", $conf->{'debug'});
|
||||
return undef;
|
||||
}
|
||||
|
||||
my $bin_opts = ':raw:encoding(UTF8)';
|
||||
|
||||
if ($^O eq "Windows") {
|
||||
$bin_opts .= ':crlf';
|
||||
}
|
||||
|
||||
binmode($FD, $bin_opts);
|
||||
|
||||
print $FD $xml;
|
||||
|
||||
close ($FD);
|
||||
|
||||
} else {
|
||||
$file_path = $xml;
|
||||
}
|
||||
|
||||
my $r = open (my $FD, ">>", $file_path);
|
||||
|
||||
if (empty($r)) {
|
||||
print_stderror($conf, "Cannot write to [" . $file_path . "]", $conf->{'debug'});
|
||||
return undef;
|
||||
}
|
||||
|
||||
my $bin_opts = ':raw:encoding(UTF8)';
|
||||
|
||||
if ($^O eq "Windows") {
|
||||
$bin_opts .= ':crlf';
|
||||
}
|
||||
|
||||
binmode($FD, $bin_opts);
|
||||
|
||||
print $FD $xml;
|
||||
|
||||
close ($FD);
|
||||
|
||||
# Reassign default values if not present
|
||||
$conf->{tentacle_client} = "tentacle_client" if empty($conf->{tentacle_client});
|
||||
$conf->{tentacle_port} = "41121" if empty($conf->{tentacle_port});
|
||||
|
|
Loading…
Reference in New Issue