Azure Cost
Overview Copied
The Azure Cost collector collects cost and usage data from the Azure Cost Management API. It queries Azure’s Cost Management service to retrieve actual cost and usage metrics, then publishes them as datapoints. This plugin collects the following data:
- Actual cost - Cost and CostUSD metrics showing the actual spending in both local currency and USD
- Usage quantity - Usage metrics showing the quantity of resources consumed
Deployment recommendations Copied
Use the Azure Cost deployment option in the following cases:
- When you need to monitor Azure spending and cost trends for your subscription.
- When you want to track usage quantities for Azure resources over time.
- When you need to group costs by different dimensions (for example,
ResourceGroup,ServiceName,Location) or by custom tags. - When you want to filter cost data by specific dimensions or tags to focus on particular resources or services.
The collector supports daily granularity and allows you to define a custom monthly start day for cost tracking that aligns with your billing period.
Prerequisites Copied
Geneos environment Copied
The Azure plugin and Azure Cost collector has the same Geneos environment requirements. See Geneos environment in Azure.
Deploy Azure Cost Copied
If you have not set up the Azure plugin, you can refer to the Configure Geneos to deploy Azure Monitor. The set up process is similar.
To set up the Azure Cost collector:
- You must edit the
collection-agent.ymlfile on your local machine, where the binaries are stored, and add the configuration settings below:
collectors:
- name: azurecost
type: plugin
className: AzureCostCollector
# Interval (in hours) between publications (optional, defaults to one day)
collectionInterval: 24
# The Azure client id that can be used for this application (required)
clientId: ${env:CLIENT_ID}
# The Azure secret associated with the client id (required)
clientSecret: ${env:CLIENT_SECRET}
# The Azure tenant id to be monitored (required)
tenantId: ${env:TENANT_ID}
# Scope configuration for cost data collection (required)
scope:
# The Azure subscription id to be monitored (required)
id: ${env:SUBSCRIPTION_ID}
# Day of the month when the billing period starts (optional, defaults to 1)
# This determines the start date for cost queries
monthlyStartDay: 1
# Filter configuration to include specific resources (optional)
# Values under the same filter name are evaluated with OR logic, while values across different filter names are combined using AND logic.
includeFilter:
# Filter by Azure dimensions (optional)
dimensions:
- name: ResourceGroup
values:
- production-rg
- staging-rg
- name: ServiceName
values:
- Virtual Machines
- Storage
# Filter by Azure tags (optional)
tags:
- name: Environment
values:
- Production
- Staging
# Grouping configuration for cost data (optional)
# This also defines the entity dimensions used when publishing datapoints.
grouping:
# List of Azure dimensions to group by (optional)
dimensions:
- ResourceGroup
- ServiceName
- ResourceId
# One Azure tag key to group by (optional)
tagKey: Owner
- Set your mappings in the Gateway. Follow the procedures in Create Dynamic Entities in Collection Agent setup. Then, select Azure Monitor V3 in the Built in > Name section.
- Link your mapping type to the recently created Azure mapping.
- Enable your dynamic managed entities. For reference, see Add a Mapping type in Dynamic Entities.
Note
To check if there are any errors in the mappings, you can set up the Dynamic Entities Health, or look at the Collection Agent log file.
Once you set up the plugin and the mappings successfully, the Azure Cost collector metrics will be displayed in a dataview in Geneos.
It can also be displayed in the Entity Viewer and in the Dashboards app in ITRS Analytics. This is an example of the Azure Cost metrics viewed in the Entity Viewer:
These are Azure Cost metrics displayed in the Dashboards app:
Adjust entity and stale data timeout Copied
Events may be published at different rates. This can cause stale data or missing entities if the publishing rate is slow. If this happens, you can adjust the Entity timeout and Stale data timeout fields in the Dynamic Entities > Collection Agent parameters section in the GSE.