minor fixes in integria integration
This commit is contained in:
parent
a5ea095734
commit
91f90d07d6
|
@ -49,7 +49,7 @@ if (is_ajax()) {
|
||||||
|
|
||||||
$has_connection = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_login', []);
|
$has_connection = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_login', []);
|
||||||
|
|
||||||
if ($has_connection === false) {
|
if ($has_connection === false && $config['integria_enabled']) {
|
||||||
ui_print_error_message(__('Integria IMS API is not reachable'));
|
ui_print_error_message(__('Integria IMS API is not reachable'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,12 +86,10 @@ if (get_parameter('update_config', 0) == 1) {
|
||||||
'talert_commands',
|
'talert_commands',
|
||||||
[
|
[
|
||||||
'name' => io_safe_input('Integria IMS Ticket'),
|
'name' => io_safe_input('Integria IMS Ticket'),
|
||||||
'command' => io_safe_input('perl /usr/share/pandora_server/util/integria_rticket.pl -p '.$config['integria_hostname'].'/integria/include/api.php -u '.$config['integria_api_pass'].','.$config['integria_user'].','.$config['integria_pass'].' -create_ticket -name "_field1_" -desc "_field2_" -group _field3_ -priority _field4_ -owner _field5_ -type _field6_'),
|
'command' => io_safe_input('Internal type'),
|
||||||
'internal' => 1,
|
'internal' => 1,
|
||||||
'description' => io_safe_input('Create an incident in Integria IMS'),
|
'description' => io_safe_input('Create an incident in Integria IMS'),
|
||||||
'fields_descriptions' => '["'.io_safe_input('Ticket title').'","'.io_safe_input('Ticket description').'","'.io_safe_input('Ticket group ID').'","'.io_safe_input('Ticket priority').'","'.io_safe_input('Ticket owner').'","'.io_safe_input('Ticket type').'"]',
|
'fields_descriptions' => '["'.io_safe_input('Ticket title').'","'.io_safe_input('Ticket group ID').'","'.io_safe_input('Ticket priority').'","'.io_safe_input('Ticket owner').'","'.io_safe_input('Ticket type').'","'.io_safe_input('Ticket status').'","'.io_safe_input('Ticket description').'"]',
|
||||||
'fields_values' => '["'.io_safe_input($config['incident_title']).'", "'.io_safe_input($config['incident_content']).'", "'.io_safe_input($config['default_group']).'", "'.io_safe_input($config['default_criticity']).'", "'.io_safe_input($config['default_owner']).'", "'.io_safe_input($config['incident_type']).'"]',
|
|
||||||
'fields_hidden' => '["","","","","","","","","",""]',
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -99,44 +97,42 @@ if (get_parameter('update_config', 0) == 1) {
|
||||||
$action_values = [
|
$action_values = [
|
||||||
'field1' => io_safe_input($config['incident_title']),
|
'field1' => io_safe_input($config['incident_title']),
|
||||||
'field1_recovery' => io_safe_input($config['incident_title']),
|
'field1_recovery' => io_safe_input($config['incident_title']),
|
||||||
'field2' => io_safe_input($config['incident_content']),
|
'field2' => io_safe_input($config['default_group']),
|
||||||
'field2_recovery' => io_safe_input($config['incident_content']),
|
'field2_recovery' => io_safe_input($config['default_group']),
|
||||||
'field3' => io_safe_input($config['default_group']),
|
'field3' => io_safe_input($config['default_criticity']),
|
||||||
'field3_recovery' => io_safe_input($config['default_group']),
|
'field3_recovery' => io_safe_input($config['default_criticity']),
|
||||||
'field4' => io_safe_input($config['default_criticity']),
|
'field4' => io_safe_input($config['default_owner']),
|
||||||
'field4_recovery' => io_safe_input($config['default_criticity']),
|
'field4_recovery' => io_safe_input($config['default_owner']),
|
||||||
'field5' => io_safe_input($config['default_owner']),
|
'field5' => io_safe_input($config['incident_type']),
|
||||||
'field5_recovery' => io_safe_input($config['default_owner']),
|
'field5_recovery' => io_safe_input($config['incident_type']),
|
||||||
|
'field6' => io_safe_input($config['incident_status']),
|
||||||
|
'field6_recovery' => io_safe_input($config['incident_status']),
|
||||||
|
'field7' => io_safe_input($config['incident_content']),
|
||||||
|
'field7_recovery' => io_safe_input($config['incident_content']),
|
||||||
'id_group' => 0,
|
'id_group' => 0,
|
||||||
'action_threshold' => 0,
|
'action_threshold' => 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
alerts_create_alert_action(io_safe_input('Create Integria IMS ticket'), $id_command_inserted, $action_values);
|
alerts_create_alert_action(io_safe_input('Create Integria IMS ticket'), $id_command_inserted, $action_values);
|
||||||
} else {
|
} else {
|
||||||
// Update 'Integria IMS Ticket' command setup when setup data is updated, user enables IntegriaIMS integration and it does exist in database.
|
|
||||||
db_process_sql_update(
|
|
||||||
'talert_commands',
|
|
||||||
[
|
|
||||||
'command' => io_safe_input('perl /usr/share/pandora_server/util/integria_rticket.pl -p '.$config['integria_hostname'].'/integria/include/api.php -u '.$config['integria_api_pass'].','.$config['integria_user'].','.$config['integria_pass'].' -create_ticket -name "_field1_" -desc "_field2_" -group _field3_ -priority _field4_ -owner _field5_ -type _field6_'),
|
|
||||||
'fields_values' => '["'.io_safe_input($config['incident_title']).'", "'.io_safe_input($config['incident_content']).'", "'.io_safe_input($config['default_group']).'", "'.io_safe_input($config['default_criticity']).'", "'.io_safe_input($config['default_owner']).'", "'.io_safe_input($config['incident_type']).'"]',
|
|
||||||
],
|
|
||||||
['name' => io_safe_input('Integria IMS Ticket')]
|
|
||||||
);
|
|
||||||
|
|
||||||
// Update 'Create Integria IMS Ticket' action when setup data is updated, user enables IntegriaIMS integration and command does exist in database.
|
// Update 'Create Integria IMS Ticket' action when setup data is updated, user enables IntegriaIMS integration and command does exist in database.
|
||||||
db_process_sql_update(
|
db_process_sql_update(
|
||||||
'talert_actions',
|
'talert_actions',
|
||||||
[
|
[
|
||||||
'field1' => io_safe_input($config['incident_title']),
|
'field1' => io_safe_input($config['incident_title']),
|
||||||
'field1_recovery' => io_safe_input($config['incident_title']),
|
'field1_recovery' => io_safe_input($config['incident_title']),
|
||||||
'field2' => io_safe_input($config['incident_content']),
|
'field2' => io_safe_input($config['default_group']),
|
||||||
'field2_recovery' => io_safe_input($config['incident_content']),
|
'field2_recovery' => io_safe_input($config['default_group']),
|
||||||
'field3' => io_safe_input($config['default_group']),
|
'field3' => io_safe_input($config['default_criticity']),
|
||||||
'field3_recovery' => io_safe_input($config['default_group']),
|
'field3_recovery' => io_safe_input($config['default_criticity']),
|
||||||
'field4' => io_safe_input($config['default_criticity']),
|
'field4' => io_safe_input($config['default_owner']),
|
||||||
'field4_recovery' => io_safe_input($config['default_criticity']),
|
'field4_recovery' => io_safe_input($config['default_owner']),
|
||||||
'field5' => io_safe_input($config['default_owner']),
|
'field5' => io_safe_input($config['incident_type']),
|
||||||
'field5_recovery' => io_safe_input($config['default_owner']),
|
'field5_recovery' => io_safe_input($config['incident_type']),
|
||||||
|
'field6' => io_safe_input($config['incident_status']),
|
||||||
|
'field6_recovery' => io_safe_input($config['incident_status']),
|
||||||
|
'field7' => io_safe_input($config['incident_content']),
|
||||||
|
'field7_recovery' => io_safe_input($config['incident_content']),
|
||||||
],
|
],
|
||||||
['name' => io_safe_input('Create Integria IMS ticket')]
|
['name' => io_safe_input('Create Integria IMS ticket')]
|
||||||
);
|
);
|
||||||
|
@ -324,17 +320,6 @@ $row['control'] = html_print_select(
|
||||||
);
|
);
|
||||||
$table_cr_settings->data['custom_response_def_criticity'] = $row;
|
$table_cr_settings->data['custom_response_def_criticity'] = $row;
|
||||||
|
|
||||||
// Custom response default creator.
|
|
||||||
$row = [];
|
|
||||||
$row['name'] = __('Creator');
|
|
||||||
$row['control'] = html_print_autocomplete_users_from_integria(
|
|
||||||
'default_creator',
|
|
||||||
$config['default_creator'],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$table_cr_settings->data['custom_response_def_creator'] = $row;
|
|
||||||
|
|
||||||
// Custom response default owner.
|
// Custom response default owner.
|
||||||
$row = [];
|
$row = [];
|
||||||
$row['name'] = __('Owner');
|
$row['name'] = __('Owner');
|
||||||
|
|
|
@ -3426,11 +3426,7 @@ function html_print_autocomplete_users_from_integria(
|
||||||
);
|
);
|
||||||
html_print_input_hidden($name.'_hidden', $id_agent_module);
|
html_print_input_hidden($name.'_hidden', $id_agent_module);
|
||||||
|
|
||||||
if ($disable === true) {
|
|
||||||
ui_print_help_tip(__('This value cannot be updated.'), false);
|
|
||||||
} else {
|
|
||||||
ui_print_help_tip(__('Type at least two characters to search the user.'), false);
|
ui_print_help_tip(__('Type at least two characters to search the user.'), false);
|
||||||
}
|
|
||||||
|
|
||||||
$javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false, false);
|
$javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false, false);
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -102,22 +102,6 @@ $incident_content = events_get_field_value_by_event_id($event_id, get_parameter(
|
||||||
$incident_title = str_replace(',', ':::', $incident_title);
|
$incident_title = str_replace(',', ':::', $incident_title);
|
||||||
$incident_content = str_replace(',', ':::', $incident_content);
|
$incident_content = str_replace(',', ':::', $incident_content);
|
||||||
|
|
||||||
// If incident id is specified, retrieve incident values from api to populate combos with such values.
|
|
||||||
if ($update) {
|
|
||||||
// Call Integria IMS API method to get details of an incident given its id.
|
|
||||||
$result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_details', [$incident_id_edit]);
|
|
||||||
|
|
||||||
// API call does not return indexes, therefore future modifications of API function in Integria IMS may lead to inconsistencies when accessing resulting array in this file.
|
|
||||||
$incident_details_separator = explode(',', $result_api_call);
|
|
||||||
|
|
||||||
$incident_details = array_map(
|
|
||||||
function ($item) {
|
|
||||||
return str_replace(':::', ',', $item);
|
|
||||||
},
|
|
||||||
$incident_details_separator
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perform action.
|
// Perform action.
|
||||||
if ($create_incident === true) {
|
if ($create_incident === true) {
|
||||||
// Call Integria IMS API method to create an incident.
|
// Call Integria IMS API method to create an incident.
|
||||||
|
@ -145,6 +129,22 @@ if ($create_incident === true) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If incident id is specified, retrieve incident values from api to populate combos with such values.
|
||||||
|
if ($update) {
|
||||||
|
// Call Integria IMS API method to get details of an incident given its id.
|
||||||
|
$result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_details', [$incident_id_edit]);
|
||||||
|
|
||||||
|
// API call does not return indexes, therefore future modifications of API function in Integria IMS may lead to inconsistencies when accessing resulting array in this file.
|
||||||
|
$incident_details_separator = explode(',', $result_api_call);
|
||||||
|
|
||||||
|
$incident_details = array_map(
|
||||||
|
function ($item) {
|
||||||
|
return str_replace(':::', ',', $item);
|
||||||
|
},
|
||||||
|
$incident_details_separator
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Main table.
|
// Main table.
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
|
@ -228,14 +228,18 @@ $table->data[1][1] .= '<div class="label_select_parent">'.html_print_select(
|
||||||
).'</div>';
|
).'</div>';
|
||||||
|
|
||||||
$table->data[2][1] = '<div class="label_select"><p class="input_label">'.__('Creator').': </p>';
|
$table->data[2][1] = '<div class="label_select"><p class="input_label">'.__('Creator').': </p>';
|
||||||
$table->data[2][1] .= '<div class="label_select_parent">'.html_print_autocomplete_users_from_integria(
|
$table->data[2][1] .= '<div class="label_select_parent">'.html_print_input_text(
|
||||||
'creator',
|
'creator',
|
||||||
$update ? $incident_details[10] : $config['default_creator'],
|
$config['integria_user'],
|
||||||
true,
|
'',
|
||||||
'30',
|
'30',
|
||||||
$update,
|
100,
|
||||||
true
|
false,
|
||||||
).'</div>';
|
true,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'w100p'
|
||||||
|
).ui_print_help_tip(__('This field corresponds to the Integria IMS user specified in Integria IMS setup'), true).'</div>';
|
||||||
|
|
||||||
$table->data[1][2] = '<div class="label_select"><p class="input_label">'.__('Criticity').': </p>';
|
$table->data[1][2] = '<div class="label_select"><p class="input_label">'.__('Criticity').': </p>';
|
||||||
$table->data[1][2] .= '<div class="label_select_parent">'.html_print_select(
|
$table->data[1][2] .= '<div class="label_select_parent">'.html_print_select(
|
||||||
|
|
|
@ -167,6 +167,8 @@ if (check_acl($config['id_user'], 0, 'IW')) {
|
||||||
__('File successfully added'),
|
__('File successfully added'),
|
||||||
__('File could not be added')
|
__('File could not be added')
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
ui_print_error_message(__('File has an invalid extension'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,8 +260,13 @@ if (check_acl($config['id_user'], 0, 'IW')) {
|
||||||
|
|
||||||
$table_files_section->data[2][0] .= '<div style="width: 100%; text-align:right;">'.html_print_submit_button(__('Upload'), 'accion', false, 'class="sub wand"', true).'</div>';
|
$table_files_section->data[2][0] .= '<div style="width: 100%; text-align:right;">'.html_print_submit_button(__('Upload'), 'accion', false, 'class="sub wand"', true).'</div>';
|
||||||
|
|
||||||
$upload_file_form = '<div><form method="post" id="file_control" enctype="multipart/form-data">'.'<h4>'.__('Add attachment').'</h4>'.html_print_table($table_files_section, true).html_print_input_hidden('upload_file', 1, true).'<h4>'.__('Attached files').'</h4>'.html_print_table($table_files, true).'</form></div>';
|
$upload_file_form = '<div>';
|
||||||
|
|
||||||
|
if (check_acl($config['id_user'], 0, 'IW')) {
|
||||||
|
$upload_file_form .= '<form method="post" id="file_control" enctype="multipart/form-data">'.'<h4>'.__('Add attachment').'</h4>'.html_print_table($table_files_section, true).html_print_input_hidden('upload_file', 1, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$upload_file_form .= '<h4>'.__('Attached files').'</h4>'.html_print_table($table_files, true).'</form></div>';
|
||||||
|
|
||||||
// Incident comments management.
|
// Incident comments management.
|
||||||
$upload_comment = get_parameter('upload_comment');
|
$upload_comment = get_parameter('upload_comment');
|
||||||
|
@ -290,21 +297,27 @@ if (check_acl($config['id_user'], 0, 'IW')) {
|
||||||
|
|
||||||
$table_comments->data = [];
|
$table_comments->data = [];
|
||||||
|
|
||||||
|
$comment_disabled = ($array_get_incidents[6] == 7);
|
||||||
|
|
||||||
|
if ($comment_disabled === true) {
|
||||||
|
$attribute = 'disabled=disabled';
|
||||||
|
}
|
||||||
|
|
||||||
$table_comments_section->data[0][0] = '<div class="label_select"><p class="input_label">'.__('Description').':</p>';
|
$table_comments_section->data[0][0] = '<div class="label_select"><p class="input_label">'.__('Description').':</p>';
|
||||||
$table_comments_section->data[0][0] .= html_print_textarea(
|
$table_comments_section->data[0][0] .= html_print_textarea(
|
||||||
'comment_description',
|
'comment_description',
|
||||||
3,
|
3,
|
||||||
20,
|
20,
|
||||||
'',
|
'',
|
||||||
'',
|
$attribute,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
$table_comments_section->data[1][1] .= '<div style="width: 100%; text-align:right;">'.html_print_submit_button(__('Add'), 'accion', false, 'class="sub wand"', true).'</div>';
|
$table_comments_section->data[1][1] .= '<div style="width: 100%; text-align:right;">'.html_print_submit_button(__('Add'), 'accion', $comment_disabled, 'class="sub wand"', true).'</div>';
|
||||||
|
|
||||||
// Upload comment.
|
// Upload comment. If ticket is closed, this action cannot be performed.
|
||||||
if ($upload_comment) {
|
if ($upload_comment && $array_get_incidents[6] != 7) {
|
||||||
$result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'create_workunit', [$incident_id, $comment_description, '0.00', 'no', 'no', '0']);
|
$result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'create_workunit', [$incident_id, $comment_description, '0.00', 0, 1, '0']);
|
||||||
|
|
||||||
// API method returns id of new comment if success.
|
// API method returns id of new comment if success.
|
||||||
$comment_added = ($result_api_call >= '0') ? true : false;
|
$comment_added = ($result_api_call >= '0') ? true : false;
|
||||||
|
@ -330,18 +343,24 @@ if (check_acl($config['id_user'], 0, 'IW')) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$upload_comment_form = '';
|
$comment_table = '';
|
||||||
|
|
||||||
if (!empty($comments)) {
|
if (!empty($comments)) {
|
||||||
foreach ($comments as $key => $value) {
|
foreach ($comments as $key => $value) {
|
||||||
$upload_comment_form .= '<div class="comment_title">'.$value[3].'<span> said </span>'.$value[1].'<span style="float: right;">'.$value[2].' Hours</span></div>';
|
$comment_table .= '<div class="comment_title">'.$value[3].'<span> said </span>'.$value[1].'<span style="float: right;">'.$value[2].' Hours</span></div>';
|
||||||
$upload_comment_form .= '<div class="comment_body">'.$value[4].'</div>';
|
$comment_table .= '<div class="comment_body">'.$value[4].'</div>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$upload_comment_form = __('No comments found');
|
$comment_table = __('No comments found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$upload_comment_form = '<div><form method="post" id="comment_form" enctype="multipart/form-data"><h4>'.__('Add comment').'</h4>'.html_print_table($table_comments_section, true).html_print_input_hidden('upload_comment', 1, true).'</form>'.'<h4>'.__('Comments').'</h4>'.$upload_comment_form.'</div>';
|
$upload_comment_form = '<div>';
|
||||||
|
|
||||||
|
if (check_acl($config['id_user'], 0, 'IW')) {
|
||||||
|
$upload_comment_form .= '<form method="post" id="comment_form" enctype="multipart/form-data"><h4>'.__('Add comment').'</h4>'.html_print_table($table_comments_section, true).html_print_input_hidden('upload_comment', 1, true).'</form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$upload_comment_form .= '<h4>'.__('Comments').'</h4>'.$comment_table.'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -420,7 +439,6 @@ $description_box = '<div class="integria_details_description">'.html_print_texta
|
||||||
).'</div>';
|
).'</div>';
|
||||||
ui_toggle($description_box, __('Description'), '', '', false);
|
ui_toggle($description_box, __('Description'), '', '', false);
|
||||||
|
|
||||||
if (check_acl($config['id_user'], 0, 'IW')) {
|
|
||||||
echo '<div class="ui_toggle">';
|
echo '<div class="ui_toggle">';
|
||||||
ui_toggle(
|
ui_toggle(
|
||||||
$upload_file_form,
|
$upload_file_form,
|
||||||
|
@ -446,7 +464,6 @@ if (check_acl($config['id_user'], 0, 'IW')) {
|
||||||
'no-border flex'
|
'no-border flex'
|
||||||
);
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
@ -1137,7 +1137,9 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
||||||
load_module_macros ($module->{'module_macros'}, \%macros);
|
load_module_macros ($module->{'module_macros'}, \%macros);
|
||||||
}
|
}
|
||||||
|
|
||||||
# User defined alerts
|
|
||||||
|
#logger($pa_config, "Clean name ".$clean_name, 10);
|
||||||
|
# User defined alert
|
||||||
if ($action->{'internal'} == 0) {
|
if ($action->{'internal'} == 0) {
|
||||||
$macros{_field1_} = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module);
|
$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{_field2_} = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module);
|
||||||
|
@ -1442,55 +1444,70 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
||||||
|
|
||||||
# Integria IMS Ticket
|
# Integria IMS Ticket
|
||||||
} elsif ($clean_name eq "Integria IMS Ticket") {
|
} elsif ($clean_name eq "Integria IMS Ticket") {
|
||||||
|
my $config_api_path = pandora_get_tconfig_token ($dbh, 'integria_hostname', '');
|
||||||
|
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);
|
$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);
|
$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);
|
$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);
|
$field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module);
|
||||||
$field8 = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module);
|
|
||||||
$field9 = subst_alert_macros ($field9, \%macros, $pa_config, $dbh, $agent, $module);
|
|
||||||
$field10 = subst_alert_macros ($field10, \%macros, $pa_config, $dbh, $agent, $module);
|
|
||||||
|
|
||||||
# Field 1 (Integria IMS API path)
|
# Field 1 (Integria IMS API path)
|
||||||
my $api_path = $field1;
|
my $api_path = $config_api_path . "/integria/include/api.php";
|
||||||
|
|
||||||
# Field 2 (Integria IMS API pass)
|
# Field 2 (Integria IMS API pass)
|
||||||
my $api_pass = $field2;
|
my $api_pass = $config_api_pass;
|
||||||
|
|
||||||
# Field 3 (Integria IMS user)
|
# Field 3 (Integria IMS user)
|
||||||
my $integria_user = $field3;
|
my $integria_user = $config_integria_user;
|
||||||
|
|
||||||
# Field 4 (Integria IMS user password)
|
# Field 4 (Integria IMS user password)
|
||||||
my $integria_user_pass = $field4;
|
my $integria_user_pass = $config_integria_user_pass;
|
||||||
|
|
||||||
# Field 5 (Ticket name)
|
# Field 1 (Ticket name)
|
||||||
my $ticket_name = $field5;
|
my $ticket_name = safe_output($field1);
|
||||||
if ($ticket_name eq "") {
|
if ($ticket_name eq "") {
|
||||||
$ticket_name = $pa_config->{'rb_product_name'} . " alert action created by API";
|
$ticket_name = $pa_config->{'rb_product_name'} . " alert action created by API";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Field 6 (Ticket group ID)
|
# Field 2 (Ticket group ID)
|
||||||
my $ticket_group_id = $field6;
|
my $ticket_group_id = $field2;
|
||||||
if ($ticket_group_id eq '') {
|
if ($ticket_group_id eq '') {
|
||||||
$ticket_group_id = 0;
|
$ticket_group_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Field 7 (Ticket priority);
|
# Field 3 (Ticket priority);
|
||||||
my $ticket_priority = $field7;
|
my $ticket_priority = $field3;
|
||||||
if ($ticket_priority eq '') {
|
if ($ticket_priority eq '0') {
|
||||||
$ticket_priority = 0;
|
$ticket_priority = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Field 8 (Ticket email)
|
# Field 4 (Ticket owner)
|
||||||
my $ticket_email = $field8;
|
my $ticket_owner = $field4;
|
||||||
|
if ($ticket_owner eq '') {
|
||||||
|
$ticket_owner = 'admin';
|
||||||
|
}
|
||||||
|
|
||||||
# Field 9 (Ticket owner)
|
# Field 5 (Ticket type)
|
||||||
my $ticket_owner = $field9;
|
my $ticket_type = $field5;
|
||||||
|
if ($ticket_type eq '') {
|
||||||
|
$ticket_type = 0;
|
||||||
|
}
|
||||||
|
|
||||||
# Field 10 (Ticket description);
|
# Field 6 (Ticket status)
|
||||||
my $ticket_description = $field10;
|
my $ticket_status = $field6;
|
||||||
|
if ($ticket_status eq '0') {
|
||||||
|
$ticket_status = 1;
|
||||||
|
}
|
||||||
|
|
||||||
pandora_create_integria_ticket($pa_config, $api_path, $api_pass, $integria_user, $integria_user_pass, $ticket_name, $ticket_group_id, $ticket_priority, $ticket_email, $ticket_owner, $ticket_description);
|
# Field 7 (Ticket description);
|
||||||
|
my $ticket_description = $field7;
|
||||||
|
|
||||||
|
pandora_create_integria_ticket($pa_config, $api_path, $api_pass, $integria_user, $integria_user_pass, $ticket_name, $ticket_group_id, $ticket_priority, $ticket_owner, $ticket_type, $ticket_status, $ticket_description);
|
||||||
|
|
||||||
# Generate notification
|
# Generate notification
|
||||||
} elsif ($clean_name eq "Generate Notification") {
|
} elsif ($clean_name eq "Generate Notification") {
|
||||||
|
@ -5849,55 +5866,21 @@ sub pandora_edit_custom_graph ($$$$$$$$$$$) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub pandora_create_integria_ticket ($$$$$$$$$$$) {
|
sub pandora_create_integria_ticket ($$$$$$$$$$$) {
|
||||||
my ($pa_config,$api_path,$api_pass,$integria_user,$user_pass,$ticket_name,$group_id,$ticket_priority,$ticket_email,$ticket_owner,$ticket_description) = @_;
|
my ($pa_config,$api_path,$api_pass,$integria_user,$user_pass,$ticket_name,$ticket_group_id,$ticket_priority,$ticket_owner,$ticket_type,$ticket_status,$ticket_description) = @_;
|
||||||
|
|
||||||
my $data_ticket;
|
my $data_ticket;
|
||||||
my $call_api;
|
my $call_api;
|
||||||
|
|
||||||
if ($api_path eq "") {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if ($user_pass eq "") {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if ($integria_user eq "") {
|
|
||||||
$integria_user = "admin";
|
|
||||||
}
|
|
||||||
if ($ticket_name eq "") {
|
|
||||||
$ticket_name = "Ticket created by " . $pa_config->{'rb_product_name'};
|
|
||||||
}
|
|
||||||
if ($group_id eq "") {
|
|
||||||
$group_id = 1;
|
|
||||||
}
|
|
||||||
if ($ticket_priority eq "") {
|
|
||||||
$ticket_priority = 1;
|
|
||||||
}
|
|
||||||
if ($ticket_owner eq "") {
|
|
||||||
$ticket_owner = "admin";
|
|
||||||
}
|
|
||||||
|
|
||||||
#~ $data_ticket = $ticket_name .
|
|
||||||
#~ "|;|" . $group_id .
|
|
||||||
#~ "|;|" . $ticket_priority .
|
|
||||||
#~ "|;|" . $ticket_description .
|
|
||||||
#~ "|;|" . #Id inventory
|
|
||||||
#~ "|;|" . #Id incident type
|
|
||||||
#~ "|;|" . $ticket_email .
|
|
||||||
#~ "|;|" . $ticket_owner .
|
|
||||||
#~ "|;|" . #Father ticket id
|
|
||||||
#~ "|;|" . #Status
|
|
||||||
#~ "|;|" . #Extra info
|
|
||||||
#~ "|;|"; #Resolution
|
|
||||||
$data_ticket = $ticket_name .
|
$data_ticket = $ticket_name .
|
||||||
"|;|" . $group_id .
|
"|;|" . $ticket_group_id .
|
||||||
"|;|" . $ticket_priority .
|
"|;|" . $ticket_priority .
|
||||||
"|;|" . $ticket_description .
|
"|;|" . $ticket_description .
|
||||||
"|;|" .
|
"|;|" .
|
||||||
|
"|;|" . $ticket_type .
|
||||||
"|;|" .
|
"|;|" .
|
||||||
"|;|" . $ticket_email .
|
|
||||||
"|;|" . $ticket_owner .
|
"|;|" . $ticket_owner .
|
||||||
"|;|" .
|
"|;|" .
|
||||||
"|;|" . '1' .
|
"|;|" . $ticket_status .
|
||||||
"|;|" .
|
"|;|" .
|
||||||
"|;|";
|
"|;|";
|
||||||
|
|
||||||
|
@ -5908,9 +5891,9 @@ sub pandora_create_integria_ticket ($$$$$$$$$$$) {
|
||||||
'op=create_incident&' .
|
'op=create_incident&' .
|
||||||
'params=' . $data_ticket .'&' .
|
'params=' . $data_ticket .'&' .
|
||||||
'token=|;|';
|
'token=|;|';
|
||||||
logger($pa_config, "Integria ticket call:" . $call_api . "", 3);
|
|
||||||
my $content = get($call_api);
|
my $content = get($call_api);
|
||||||
logger($pa_config, "Integria ticket res:" . $content . "", 3);
|
|
||||||
if (is_numeric($content) && $content ne "-1") {
|
if (is_numeric($content) && $content ne "-1") {
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue