alert_rules
Creates, updates, deletes, gets or lists a alert_rules
resource.
Overview
Name | alert_rules |
Type | Resource |
Id | azure.monitor.alert_rules |
Fields
- vw_alert_rules
- alert_rules
Name | Datatype | Description |
---|---|---|
id | text | Azure resource Id |
name | text | Azure resource name |
description | text | field from the properties object |
action | text | field from the properties object |
actions | text | field from the properties object |
condition | text | field from the properties object |
is_enabled | text | field from the properties object |
last_updated_time | text | field from the properties object |
location | text | Resource location |
provisioning_state | text | field from the properties object |
resourceGroupName | text | field from the properties object |
ruleName | text | field from the properties object |
subscriptionId | text | field from the properties object |
system_data | text | field from the properties object |
tags | text | Gets 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. |
type | text | Azure resource type |
Name | Datatype | Description |
---|---|---|
id | string | Azure resource Id |
name | string | Azure resource name |
location | string | Resource location |
properties | object | An alert rule. |
systemData | object | Metadata pertaining to creation and last modification of the resource. |
tags | object | Gets 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. |
type | string | Azure resource type |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | resourceGroupName, ruleName, subscriptionId | Gets a classic metric alert rule |
list_by_resource_group | SELECT | resourceGroupName, subscriptionId | List the classic metric alert rules within a resource group. |
list_by_subscription | SELECT | subscriptionId | List the classic metric alert rules within a subscription. |
create_or_update | INSERT | resourceGroupName, ruleName, subscriptionId, data__properties | Creates or updates a classic metric alert rule. |
delete | DELETE | resourceGroupName, ruleName, subscriptionId | Deletes a classic metric alert rule |
update | UPDATE | resourceGroupName, ruleName, subscriptionId | Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. |
SELECT
examples
List the classic metric alert rules within a subscription.
- vw_alert_rules
- alert_rules
SELECT
id,
name,
description,
action,
actions,
condition,
is_enabled,
last_updated_time,
location,
provisioning_state,
resourceGroupName,
ruleName,
subscriptionId,
system_data,
tags,
type
FROM azure.monitor.vw_alert_rules
WHERE subscriptionId = '{{ subscriptionId }}';
SELECT
id,
name,
location,
properties,
systemData,
tags,
type
FROM azure.monitor.alert_rules
WHERE subscriptionId = '{{ subscriptionId }}';
INSERT
example
Use the following StackQL query and manifest file to create a new alert_rules
resource.
- All Properties
- Manifest
/*+ create */
INSERT INTO azure.monitor.alert_rules (
resourceGroupName,
ruleName,
subscriptionId,
data__properties,
location,
tags,
properties
)
SELECT
'{{ resourceGroupName }}',
'{{ ruleName }}',
'{{ subscriptionId }}',
'{{ data__properties }}',
'{{ location }}',
'{{ tags }}',
'{{ properties }}'
;
- name: your_resource_model_name
props:
- name: id
value: string
- name: name
value: string
- name: type
value: string
- name: location
value: string
- name: tags
value: object
- name: systemData
value:
- name: createdBy
value: string
- name: createdByType
value: string
- name: createdAt
value: string
- name: lastModifiedBy
value: string
- name: lastModifiedByType
value: string
- name: lastModifiedAt
value: string
- name: properties
value:
- name: name
value: string
- name: description
value: string
- name: provisioningState
value: string
- name: isEnabled
value: boolean
- name: condition
value:
- name: odata.type
value: string
- name: dataSource
value:
- name: odata.type
value: string
- name: resourceUri
value: string
- name: legacyResourceId
value: string
- name: resourceLocation
value: string
- name: metricNamespace
value: string
- name: action
value:
- name: odata.type
value: string
- name: actions
value:
- - name: odata.type
value: string
- name: lastUpdatedTime
value: string
UPDATE
example
Updates a alert_rules
resource.
/*+ update */
UPDATE azure.monitor.alert_rules
SET
tags = '{{ tags }}',
properties = '{{ properties }}'
WHERE
resourceGroupName = '{{ resourceGroupName }}'
AND ruleName = '{{ ruleName }}'
AND subscriptionId = '{{ subscriptionId }}';
DELETE
example
Deletes the specified alert_rules
resource.
/*+ delete */
DELETE FROM azure.monitor.alert_rules
WHERE resourceGroupName = '{{ resourceGroupName }}'
AND ruleName = '{{ ruleName }}'
AND subscriptionId = '{{ subscriptionId }}';