ANOMALY_ INSIGHTS!CREATE_ MONITOR¶
Creates an anomaly monitor, which detects cost anomalies for a custom scope that you define with object tags and service types.
Syntax¶
Arguments¶
'alias'Name for the new monitor. The name must be unique within the account and isn’t case-sensitive.
Data type: VARCHAR
configConfiguration that defines the monitor’s scope. For the keys this object accepts and how to build a tag reference, see Monitor configuration.
Data type: VARIANT
Output¶
Returns a VARIANT that contains the monitor’s persisted configuration. The resource_tags and service_types keys are always present,
even when empty. Tags are returned in the resolved form, which names each tag instead of using a reference string. For an example,
see Monitor configuration.
Access control requirements¶
Users with any of the following roles can call this method:
- ACCOUNTADMIN system role
- GLOBALORGADMIN system role
- SNOWFLAKE.APP_USAGE_ADMIN application role
To include a tag in the monitor’s configuration, you also need the APPLYBUDGET privilege on that tag. For more information, see
Access control for cost anomalies.
Usage notes¶
- The method fails if a monitor with the same name already exists in the account. To change an existing monitor, use ANOMALY_INSIGHTS!UPDATE_MONITOR_CONFIG.
- The configuration must include at least one tag in
resource_tags.tagsor at least one entry inservice_types. The method fails if it contains neither. - The method fails if the account already contains 20 monitors.
- The method is atomic. If validation fails, no monitor is created.
- Creating a monitor doesn’t compute results immediately. The next daily run computes the monitor’s history. To compute results right away, use ANOMALY_INSIGHTS!RECALCULATE_ANOMALIES.
Example¶
Create a monitor named Eng-Platform that tracks credits consumed by resources tagged with the cost center engineering, along with all
automatic clustering consumption in the account: