监控预算
本主题介绍如何监控预算支出和确定跟踪特定资源 Credit 使用量的预算。
创建自定义角色以监控预算
您可以创建供非管理员用户用来监控预算的自定义角色,从而委派预算监控。
创建自定义角色以监控账户预算
You can create a custom role to enable non-account administrator users to monitor the account budget. For a full list of privileges and roles that must be granted to a role to monitor the account budget, see Budgets roles and privileges.
示例
Note
只有账户管理员才能执行本示例中的语句。
For example, create role account_budget_monitor and grant the role the ability to view credit usage for the
account budget:
创建自定义角色以监控自定义预算
You can create a custom role to enable non-account administrator users to monitor custom budgets. For a full list of privileges and roles that must be granted to a role to monitor a custom budget, see Budgets roles and privileges.
示例
Note
只有预算所有者(具有 OWNERSHIP 权限的角色)才能执行本示例中的语句。
Use the budget owner role to grant the custom role budget_monitor the ability to monitor the budget my_budget in schema
budgets_db.budgets_schema:
监控预算
You can monitor budgets using Snowsight or SQL.
Use Snowsight to monitor budgets¶
You can view current and historical budget spending using the Budgets page in Snowsight.
Note
Only a user with the ACCOUNTADMIN role or a role granted the required privileges and role can monitor budgets using Snowsight.
- For more information about using a custom account role to monitor the account budget, see 创建自定义角色以监控账户预算.
- For more information about using a custom account role to monitor custom budgets, see 创建自定义角色以监控自定义预算.
- Sign in to Snowsight.
- In the navigation menu, select Admin » Cost management.
- Select Budgets.
In the Current Month view for a budget, you can review the credit usage per day up to the current day. You can see whether you might exceed your budget for the month. The bar graph continues to the end of the month with your projected credit usage based on your actual credit usage for the month. The Spending limit line indicates the spending limit at which a budget notification is triggered.
Select (months to display) to filter the view by Current Month or longer time periods.
You can compare the Spend (current credit usage) to Interval (time left in the current month) to see if your spending is outpacing your monthly budget.
You can filter the view by selecting Budgets or
Resources:
-
You can select a custom budget in the Budgets view for details on a specific budget.
Note
The Service Type list for a custom budget includes an Unused Resources type. This service type is displayed when an object in a budget has no credit usage data to display. This can happen if the object has no credit usage for compute costs, or if you recently added an object to a budget and the serverless background task has not yet executed.
-
In the Resources view, you can filter and sort by Service Type, object Name, and Credit Usage.
使用 SQL 命令来监控预算¶
To monitor the account budget, you must have the required privileges. For more information, see 创建自定义角色以监控账户预算.
Use the account_budget_monitor role to view the spending history for the account budget:
您可以按服务类型监控支出历史记录。要查看八个月周期账户预算的搜索优化无服务器功能的支出历史记录,请执行以下语句:
To monitor a custom budget, you must have the required privileges. For more information, see 创建自定义角色以监控自定义预算.
Use the budget_monitor role to view spending history for a custom budget. For example, to view the spending history for custom
budget na_finance_budget in schema budgets_db.budgets_schema, execute the following statements:
您可以按服务类型监控支出历史记录。例如,要查看一年周期预算中包含的物化视图的支出历史记录,请执行以下语句:
For more information, see Budget methods.
确定资源跟踪预算
If you want to determine which budgets track a resource, you can call the SYSTEM$SHOW_BUDGETS_FOR_RESOURCE function.
例如:
该函数返回已在其中添加资源的预算。它包含因以下任意原因而涉及该资源的预算:
- 资源已直接添加到预算中。
- 资源的标签/值组合已添加到预算中。
- 资源属于已添加到预算的对象(例如,数据库)。