URL |
https://smartops-dev03.eastus.cloudapp.azure.com/paas/itops/alertmapping/api/importAlertEnrichment |
||||||||||||
Method |
POST |
||||||||||||
Headers |
USER, Organization-key, Authorization, organization-name
|
||||||||||||
Body |
Type – form-data
|
In case of additional enrichment data, the same url can be used for file updates per rules below:
The file_name, project_id and enrichment_type + enrichment_code should match that of existing enrichment
Uploading full excel file does not delete missing records in the current file. This url is only considered for updates/additional insert and not delete
The lookup and enrichment fields can be changed and will be considered as an update
Column addition/deletion in the attached xls file will not be considered as an update
For an existing data, an additional enrichment_type (Field Lookup or Refined if not used already) can be introduced and will be considered updates. Example scenario below
For an existing file named sample.xls with file_name=sample, project_id=10, enrichment_type=”Field Lookup” and enrichment_code=”sample-lookup”, uploading same file with the following parameters, will be considered as update: file_name=sample, project_id=10, enrichment_type=”Refined” and enrichment_code=”sample-refined”
Max Limits :
For enrichment_type = Refined, additional processing fields are allowed to a maximum of 5
No of files per project is set to a default max = 5 and number of entries within a file is set to a max limit of 500. Both of these settings can be configured via Alert Enrichment Metadata API
Excel file preparation:
Only .xls type allowed
Excel file should not have duplicate columns – columns with a <existing column in excel>.<number> is not allowed . Ex. If excel has nodeName column, another column with nodeName.1 is not allowed
Only Text, Boolean, Number fields are allowed in excel
Column Name rules should be as specified in the rules for enrichment_type above
If severity field is specified in the excel, it should follow the rules specified in reference tables
Custom fields should be specified in flattened format within the excel file and alert enrichment templates
Ex: The alert store field “customFields”: {“property1”: “abc”}, should be specified as customFields.property1 in excel file and templateRules
URL |
|
||||||
Method |
POST |
||||||
Headers |
USER, Organization-key, Authorization, organization-name
|
||||||
Body |
Type – form-data
If only project_id is specified, the API will retrieve all the alert enrichment mappings available for the project. The following will be the format { "statusCode": "200", "statusMessage": [ { "file_name": "", "sequence_after": "", "enrichment_types": [ { "type": "<enrichment_type>", "code": "<enrichment_code>", "lookup_fields": ["", ""], "enrichment_fields": ["", ""] } ] } ] }
If file_name is specified, the API will return all the mapping information for the specified file_name under project_id. Sample response below
{ "statusCode": "200", "statusMessage": [ [ { "key": { "<Lookup field name1>": "<Lookup field value1>", "<Lookup field name2>": "<Lookup field value2>" }, "value": { "enrichment_data": { "<enrichment field name1>": "<enrichment field value1>", "<enrichment field name2>": "<enrichment field value2>" }, "processing_data": { "<excel field not marked as lookup or enrichment field name>": "<value>" } } } ] ] } |
URL |
https://<dns-name>/paas/itops/alertmapping/api/configureAlertEnrichmentMetadata |
||||||||
Method |
POST |
||||||||
Headers |
USER, Organization-key, Authorization, organization-name
|
||||||||
Body |
Type – form-data
The max_config_allowed cannot be updated to a value less than the number of enrichments available for the project. Similarly, the max_mappings_per_file cannot be less than the maximum rows on each of the existing files |
URL |
https://<dns-name>/paas/itops/alertmapping/api/fetchAlertEnrichmentMetadata |
||||
Method |
POST |
||||
Headers |
USER, Organization-key, Authorization, organization-name
|
||||
Body |
Type – form-data
Below is the response format { "statusCode": "200", "statusMessage": { "project_id": "1098", "max_config_allowed": 10, "max_mappings_per_file": 500 } } |
URL |
https://<dns-name>/paas/itops/alertmapping/api/deleteAlertEnrichment |
||||||||||
Method |
POST |
||||||||||
Headers |
USER, Organization-key, Authorization, organization-name
|
||||||||||
Body |
Type – form-data
Delete API can be used in two ways – with or without enrichment_code and lookup_json
When the enrichment_code and lookup_json is specified only that file entry is removed. If this is the only entry on the file, then this operation will result in deletion of all enrichment types and the current file Expected lookup_json format { "<field name1 as in excel>": "<value1 as in excel", "<field name2 as in excel>": "<value2 as in excel", }
|
The existing ticket template APIs can be used for Alert Enrichment processing with the scenario set as "scenario": "alertEnrichment"
Add Template |
https://<dns-name>/paas/itops/alertmapping/api/ticketTemplate |
Update Template |
https://<dns-name>/paas/itops/alertmapping/api/updateTicketTemplate |
Delete Template |
https://<dns-name>/paas/itops/alertmapping/api/deleteTemplate |
Templates will be processed for Refined alert enrichment only when it contains the field $lookup{<enrichment_code>, <comma separated lookup fields for the enrichment_code)
Sample template rule:
"templateRules" : { "rules" : [ { "field": "source", "value": "icinga", "operator": "=" }, { "operator": "in", "value": "$lookup{holidayCal, $alertMetric, $businessTimezone, $nodeName, $country, $site}", "field": "$date{alertTime,'DD-MMM'}" } ], "logicalOperator": "and" } |
$lookup function
In this sample, the enrichment_code = holidayCal and the rest of the parameters $alertMetric, $businessTimezone, $nodeName, $country and $site are the lookup fields identified for the enrichment_code when the alert enrichment xls file was uploaded.
Note: All lookup fields should be specified as parameter to $lookup tag
$date function
The $date operator can be used to convert existing date object to a date string based on the pattern specified in the second parameter to this operator. The following date formats are supported
DAY_OF_WEEK--- converts date object in first parameter to the day of the week
MONTH_OF_YEAR, --- converts date object in first parameter to the month
DD, --- to extract date of the month in integer format
DDD, --- to extract abbreviated week day (three letters - Sun, Mon..)
MM --- to extract month of the year in integer format
MMM --- to extract abbreviated month of the year (three letter month
like Jan, Feb)
YY --- to extract 2 digit year
YYYY --- to extract 4 digit year
The $date and $lookup can work on other template scenarios as well and can also be used in other rule scenarios as below:
"templateRules" : { "rules" : [ { "field": "Saturday", "value": "$date{alertTime, 'DAY_OF_WEEK'}", "operator": "=" }, { "operator": "in", "value": "$lookup{holidayCal, $alertMetric, $businessTimezone, $nodeName, $country, $site}", "field": "$date{alertTime,'DD-MMM'}" } ], "logicalOperator": "and" }, |
For using a new $lookup for an enrichment code that does not exist already, the tables CodeMaster and CodeLookup need to be populated.
Complete Template API sample
{ "precedence": 1, "active": true, "templateRules" : { "rules" : [ { "field": "Saturday", "value": "$date{alertTime, 'DAY_OF_WEEK'}", "operator": "=" }, { "operator": "in", "value": "$lookup{holidayCal, $alertMetric, $businessTimezone, $nodeName, $country, $site}", "field": "$date{alertTime,'DD-MMM'}" } ], "logicalOperator": "and" }, "templateMapping" : [ { "values" : [ { "fieldValue" : "Cust Field1", "fieldRules" : {} } ], "fieldName" : "customFields.Property1" }, { "values" : [ { "fieldValue" : "minor", "fieldRules" : {} } ], "fieldName" : "severity" } ], "scenario": "alertEnrichment", "templateName": "holidayCal", "projectId": 1090 } |