Skip to main content

metric_alerts

Creates, updates, deletes, gets or lists a metric_alerts resource.

Overview

Namemetric_alerts
TypeResource
Idazure.monitor.metric_alerts

Fields

NameDatatypeDescription
idtextAzure resource Id
nametextAzure resource name
descriptiontextfield from the properties object
actionstextfield from the properties object
auto_mitigatetextfield from the properties object
criteriatextfield from the properties object
enabledtextfield from the properties object
evaluation_frequencytextfield from the properties object
is_migratedtextfield from the properties object
last_updated_timetextfield from the properties object
locationtextResource location
resourceGroupNametextfield from the properties object
ruleNametextfield from the properties object
scopestextfield from the properties object
severitytextfield from the properties object
subscriptionIdtextfield from the properties object
system_datatextfield from the properties object
tagstextGets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters.
target_resource_regiontextfield from the properties object
target_resource_typetextfield from the properties object
typetextAzure resource type
window_sizetextfield from the properties object

Methods

NameAccessible byRequired ParamsDescription
getSELECTresourceGroupName, ruleName, subscriptionIdRetrieve an alert rule definition.
list_by_resource_groupSELECTresourceGroupName, subscriptionIdRetrieve alert rule definitions in a resource group.
list_by_subscriptionSELECTsubscriptionIdRetrieve alert rule definitions in a subscription.
create_or_updateINSERTresourceGroupName, ruleName, subscriptionId, data__propertiesCreate or update an metric alert definition.
deleteDELETEresourceGroupName, ruleName, subscriptionIdDelete an alert rule definition.
updateUPDATEresourceGroupName, ruleName, subscriptionIdUpdate an metric alert definition.

SELECT examples

Retrieve alert rule definitions in a subscription.

SELECT
id,
name,
description,
actions,
auto_mitigate,
criteria,
enabled,
evaluation_frequency,
is_migrated,
last_updated_time,
location,
resourceGroupName,
ruleName,
scopes,
severity,
subscriptionId,
system_data,
tags,
target_resource_region,
target_resource_type,
type,
window_size
FROM azure.monitor.vw_metric_alerts
WHERE subscriptionId = '{{ subscriptionId }}';

INSERT example

Use the following StackQL query and manifest file to create a new metric_alerts resource.

/*+ create */
INSERT INTO azure.monitor.metric_alerts (
resourceGroupName,
ruleName,
subscriptionId,
data__properties,
location,
tags,
properties
)
SELECT
'{{ resourceGroupName }}',
'{{ ruleName }}',
'{{ subscriptionId }}',
'{{ data__properties }}',
'{{ location }}',
'{{ tags }}',
'{{ properties }}'
;

UPDATE example

Updates a metric_alerts resource.

/*+ update */
UPDATE azure.monitor.metric_alerts
SET
tags = '{{ tags }}',
properties = '{{ properties }}'
WHERE
resourceGroupName = '{{ resourceGroupName }}'
AND ruleName = '{{ ruleName }}'
AND subscriptionId = '{{ subscriptionId }}';

DELETE example

Deletes the specified metric_alerts resource.

/*+ delete */
DELETE FROM azure.monitor.metric_alerts
WHERE resourceGroupName = '{{ resourceGroupName }}'
AND ruleName = '{{ ruleName }}'
AND subscriptionId = '{{ subscriptionId }}';