Skip to main content

watchers

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

Overview

Namewatchers
TypeResource
Idazure.database_watcher.watchers

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
namestringThe name of the resource.
datastoreobjectThe data store for collected monitoring data.
defaultAlertRuleIdentityResourceIdstringThe resource ID of a user-assigned managed identity that will be assigned to a new alert rule.
identityobjectThe managed service identities assigned to this resource.
locationstringThe geo-location where the resource lives. Required.
provisioningStatestringThe provisioning state of the resource watcher. Known values are: "Succeeded", "Failed", and "Canceled". (Succeeded, Failed, Canceled)
statusstringThe monitoring collection status of the watcher. Known values are: "Starting", "Running", "Stopping", "Stopped", and "Deleting". (Starting, Running, Stopping, Stopped, Deleting)
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
tagsobjectResource tags.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, watcher_name, subscription_idGet a Watcher.
list_by_resource_groupselectresource_group_name, subscription_idList Watcher resources by resource group.
list_by_subscriptionselectsubscription_idList Watcher resources by subscription ID.
create_or_updateinsertresource_group_name, watcher_name, subscription_id, locationCreate a Watcher.
updateupdateresource_group_name, watcher_name, subscription_idUpdate a Watcher.
create_or_updatereplaceresource_group_name, watcher_name, subscription_id, locationCreate a Watcher.
deletedeleteresource_group_name, watcher_name, subscription_idDelete a Watcher.
startexecresource_group_name, watcher_name, subscription_idThe action to start monitoring all targets configured for a database watcher.
stopexecresource_group_name, watcher_name, subscription_idThe action to stop monitoring all targets configured for a database watcher.

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
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
subscription_idstring
watcher_namestringThe database watcher name. Required.

SELECT examples

Get a Watcher.

SELECT
id,
name,
datastore,
defaultAlertRuleIdentityResourceId,
identity,
location,
provisioningState,
status,
systemData,
tags,
type
FROM azure.database_watcher.watchers
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND watcher_name = '{{ watcher_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

Create a Watcher.

INSERT INTO azure.database_watcher.watchers (
tags,
location,
properties,
identity,
resource_group_name,
watcher_name,
subscription_id
)
SELECT
'{{ tags }}',
'{{ location }}' /* required */,
'{{ properties }}',
'{{ identity }}',
'{{ resource_group_name }}',
'{{ watcher_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
identity,
location,
properties,
systemData,
tags,
type
;

UPDATE examples

Update a Watcher.

UPDATE azure.database_watcher.watchers
SET
identity = '{{ identity }}',
tags = '{{ tags }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND watcher_name = '{{ watcher_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
identity,
location,
properties,
systemData,
tags,
type;

REPLACE examples

Create a Watcher.

REPLACE azure.database_watcher.watchers
SET
tags = '{{ tags }}',
location = '{{ location }}',
properties = '{{ properties }}',
identity = '{{ identity }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND watcher_name = '{{ watcher_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND location = '{{ location }}' --required
RETURNING
id,
name,
identity,
location,
properties,
systemData,
tags,
type;

DELETE examples

Delete a Watcher.

DELETE FROM azure.database_watcher.watchers
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND watcher_name = '{{ watcher_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;

Lifecycle Methods

The action to start monitoring all targets configured for a database watcher.

EXEC azure.database_watcher.watchers.start 
@resource_group_name='{{ resource_group_name }}' --required,
@watcher_name='{{ watcher_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;