Skip to main content

alerts

Creates, updates, deletes, gets or lists an alerts resource.

Overview

Namealerts
TypeResource
Idazure.alerts_management.alerts

Fields

The following fields are returned by SELECT queries:

OK. Returns the alert with the specified ID.

NameDatatypeDescription
idstringAzure resource Id
namestringAzure resource name
propertiesobjectAlert property bag
typestringAzure resource type

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_by_idselectscope, alertIdGet information related to a specific alert
get_allselectscopetargetResource, targetResourceType, targetResourceGroup, monitorService, monitorCondition, severity, alertState, alertRule, smartGroupId, includeContext, includeEgressConfig, pageCount, sortBy, sortOrder, select, timeRange, customTimeRangeList 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_dataexecidentifierList alerts meta data information based on value of identifier parameter.
change_stateexecscope, alertId, newStateChange 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.

NameDatatypeDescription
alertIdstringUnique ID of an alert instance.
identifierstringIdentification of the information to be retrieved by API call.
newStatestringNew state of the alert.
scopestringscope here is resourceId for which alert is created.
alertRulestringFilter by specific alert rule. Default value is to select all.
alertStatestringFilter by state of the alert instance. Default value is to select all.
customTimeRangestringFilter 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.
includeContextbooleanInclude context which has contextual data specific to the monitor service. Default value is false'
includeEgressConfigbooleanInclude egress config which would be used for displaying the content in portal. Default value is 'false'.
monitorConditionstringFilter by monitor condition which is either 'Fired' or 'Resolved'. Default value is to select all.
monitorServicestringFilter by monitor service which generates the alert instance. Default value is select all.
pageCountinteger (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.
selectstringThis 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.
severitystringFilter by severity. Default value is select all.
smartGroupIdstringFilter the alerts list by the Smart Group Id. Default value is none.
sortBystringSort the query results by input field, Default value is 'lastModifiedDateTime'.
sortOrderstringSort the query results order in either ascending or descending. Default value is 'desc' for time fields and 'asc' for others.
targetResourcestringFilter by target resource( which is full ARM ID) Default value is select all.
targetResourceGroupstringFilter by target resource group name. Default value is select all.
targetResourceTypestringFilter by target resource type. Default value is select all.
timeRangestringFilter by time range by below listed values. Default value is 1 day.

SELECT examples

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
;

Lifecycle Methods

List alerts meta data information based on value of identifier parameter.

EXEC azure.alerts_management.alerts.meta_data 
@identifier='{{ identifier }}' --required
;