alerts
Creates, updates, deletes, gets or lists an alerts
resource.
Overview
Name | alerts |
Type | Resource |
Id | azure.alerts_management.alerts |
Fields
The following fields are returned by SELECT
queries:
- get_by_id
- get_all
OK. Returns the alert with the specified ID.
Name | Datatype | Description |
---|---|---|
id | string | Azure resource Id |
name | string | Azure resource name |
properties | object | Alert property bag |
type | string | Azure resource type |
OK. Successfully listed alert objects.
Name | Datatype | Description |
---|---|---|
id | string | Azure resource Id |
name | string | Azure resource name |
properties | object | Alert property bag |
type | string | Azure resource type |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get_by_id | select | scope , alertId | Get information related to a specific alert | |
get_all | select | scope | targetResource , targetResourceType , targetResourceGroup , monitorService , monitorCondition , severity , alertState , alertRule , smartGroupId , includeContext , includeEgressConfig , pageCount , sortBy , sortOrder , select , timeRange , customTimeRange | List all existing alerts, where the results can be filtered on the basis of multiple parameters (e.g. time range). The results can then be sorted on the basis specific fields, with the default being lastModifiedDateTime. |
meta_data | exec | identifier | List alerts meta data information based on value of identifier parameter. | |
change_state | exec | scope , alertId , newState | Change the state of an alert. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
alertId | string | Unique ID of an alert instance. |
identifier | string | Identification of the information to be retrieved by API call. |
newState | string | New state of the alert. |
scope | string | scope here is resourceId for which alert is created. |
alertRule | string | Filter by specific alert rule. Default value is to select all. |
alertState | string | Filter by state of the alert instance. Default value is to select all. |
customTimeRange | string | Filter by custom time range in the format <start-time>/<end-time> where time is in (ISO-8601 format)'. Permissible values is within 30 days from query time. Either timeRange or customTimeRange could be used but not both. Default is none. |
includeContext | boolean | Include context which has contextual data specific to the monitor service. Default value is false' |
includeEgressConfig | boolean | Include egress config which would be used for displaying the content in portal. Default value is 'false'. |
monitorCondition | string | Filter by monitor condition which is either 'Fired' or 'Resolved'. Default value is to select all. |
monitorService | string | Filter by monitor service which generates the alert instance. Default value is select all. |
pageCount | integer (int64) | Determines number of alerts returned per page in response. Permissible value is between 1 to 250. When the "includeContent" filter is selected, maximum value allowed is 25. Default value is 25. |
select | string | This filter allows to selection of the fields(comma separated) which would be part of the essential section. This would allow to project only the required fields rather than getting entire content. Default is to fetch all the fields in the essentials section. |
severity | string | Filter by severity. Default value is select all. |
smartGroupId | string | Filter the alerts list by the Smart Group Id. Default value is none. |
sortBy | string | Sort the query results by input field, Default value is 'lastModifiedDateTime'. |
sortOrder | string | Sort the query results order in either ascending or descending. Default value is 'desc' for time fields and 'asc' for others. |
targetResource | string | Filter by target resource( which is full ARM ID) Default value is select all. |
targetResourceGroup | string | Filter by target resource group name. Default value is select all. |
targetResourceType | string | Filter by target resource type. Default value is select all. |
timeRange | string | Filter by time range by below listed values. Default value is 1 day. |
SELECT
examples
- get_by_id
- get_all
Get information related to a specific alert
SELECT
id,
name,
properties,
type
FROM azure.alerts_management.alerts
WHERE scope = '{{ scope }}' -- required
AND alertId = '{{ alertId }}' -- required
;
List all existing alerts, where the results can be filtered on the basis of multiple parameters (e.g. time range). The results can then be sorted on the basis specific fields, with the default being lastModifiedDateTime.
SELECT
id,
name,
properties,
type
FROM azure.alerts_management.alerts
WHERE scope = '{{ scope }}' -- required
AND targetResource = '{{ targetResource }}'
AND targetResourceType = '{{ targetResourceType }}'
AND targetResourceGroup = '{{ targetResourceGroup }}'
AND monitorService = '{{ monitorService }}'
AND monitorCondition = '{{ monitorCondition }}'
AND severity = '{{ severity }}'
AND alertState = '{{ alertState }}'
AND alertRule = '{{ alertRule }}'
AND smartGroupId = '{{ smartGroupId }}'
AND includeContext = '{{ includeContext }}'
AND includeEgressConfig = '{{ includeEgressConfig }}'
AND pageCount = '{{ pageCount }}'
AND sortBy = '{{ sortBy }}'
AND sortOrder = '{{ sortOrder }}'
AND select = '{{ select }}'
AND timeRange = '{{ timeRange }}'
AND customTimeRange = '{{ customTimeRange }}'
;
Lifecycle Methods
- meta_data
- change_state
List alerts meta data information based on value of identifier parameter.
EXEC azure.alerts_management.alerts.meta_data
@identifier='{{ identifier }}' --required
;
Change the state of an alert.
EXEC azure.alerts_management.alerts.change_state
@scope='{{ scope }}' --required,
@alertId='{{ alertId }}' --required,
@newState='{{ newState }}' --required
@@json=
'{
"comments": "{{ comments }}"
}'
;