Azure Cost Management

Azure Cost Management reports the cost and usage of an Azure subscription, broken down by service, resource group and billing period.

Available solutions

Zabbix version 7.4 7.2 7.0 6.4 6.0
Source: templates/cloud/azure_http

Azure Cost Management by HTTP

Overview

This template is designed to monitor Microsoft Cost Management by HTTP. It works without any external scripts and uses the script item.

Requirements

Zabbix version: 7.4 and higher.

Tested versions

This template has been tested on:

  • Microsoft Azure

Configuration

Zabbix should be configured according to the instructions in the Templates out of the box section.

Setup

  1. Create an Azure service principal via the Azure command-line interface (Azure CLI) for your subscription.

    az ad sp create-for-rbac --name zabbix --role reader --scope /subscriptions/<subscription_id>

See Azure documentation for more details.

  1. Link the template to a host.
  2. Configure the macros: {$AZURE.APP.ID}, {$AZURE.PASSWORD}, {$AZURE.TENANT.ID}, {$AZURE.SUBSCRIPTION.ID}.

Macros used

Name Description Default
{$AZURE.SUBSCRIPTION.ID}

Microsoft Azure subscription ID.

{$AZURE.TENANT.ID}

Microsoft Azure tenant ID.

{$AZURE.APP.ID}

The App ID of Microsoft Azure.

{$AZURE.PASSWORD}

Microsoft Azure password.

{$AZURE.BILLING.MONTH}

Months to get historical data from Azure Cost Management API, no more than 11 (plus current month). The time period for pulling the data cannot exceed 1 year.

11
{$AZURE.LLD.FILTER.SERVICE.MATCHES}

Filter of discoverable services by name.

.*
{$AZURE.LLD.FILTER.SERVICE.NOT_MATCHES}

Filter to exclude discovered services by name.

CHANGE_IF_NEEDED
{$AZURE.LLD.FILTER.RESOURCE.LOCATION.MATCHES}

Filter of discoverable locations by name.

.*
{$AZURE.LLD.FILTER.RESOURCE.LOCATION.NOT_MATCHES}

Filter to exclude discovered locations by name.

CHANGE_IF_NEEDED
{$AZURE.LLD.FILTER.RESOURCE.GROUP.MATCHES}

Filter of discoverable resource groups by name.

.*
{$AZURE.LLD.FILTER.RESOURCE.GROUP.NOT_MATCHES}

Filter to exclude discovered resource groups by name.

CHANGE_IF_NEEDED
{$AZURE.DATA.TIMEOUT}

API response timeout.

60s
{$AZURE.PROXY}

Sets the HTTP proxy value. If this macro is empty, then no proxy is used.

{$HTTP.TLS.VERIFY}

TLS certificate verification for script items: "none" - disabled, "peer" - verify the certificate chain and expiration, "full" - full verification. Any other value enables full verification. To override the setting for this template only, define the macro with the context "Azure Cost Management", e.g. {$HTTP.TLS.VERIFY:"Azure Cost Management"}.

full

Items

Name Description Type Key and additional info
Get monthly costs

The result of API requests is expressed in the JSON.

Script azure.get.monthly.costs
Get daily costs

The result of API requests is expressed in the JSON.

Script azure.get.daily.costs
Azure Cost: Get monthly costs errors

A list of errors from API requests.

Dependent item azure.get.monthly.costs.errors

Preprocessing

  • JSON Path: $.error

    ⛔️Custom on fail: Set value to

  • Discard unchanged with heartbeat: 1h

Azure Cost: Get daily costs errors

A list of errors from API requests.

Dependent item azure.get.daily.costs.errors

Preprocessing

  • JSON Path: $.error

    ⛔️Custom on fail: Set value to

  • Discard unchanged with heartbeat: 1h

Triggers

Name Description Expression Severity Dependencies and additional info
Azure Cost: There are errors in requests to API

Zabbix has received errors in response to API requests.

length(last(/Azure Cost Management by HTTP/azure.get.monthly.costs.errors))>0 Average
Azure Cost: There are errors in requests to API

Zabbix has received errors in response to API requests.

length(last(/Azure Cost Management by HTTP/azure.get.daily.costs.errors))>0 Average

LLD rule Azure daily costs by services discovery

Name Description Type Key and additional info
Azure daily costs by services discovery

Discovery of daily costs by services.

Dependent item azure.daily.services.costs.discovery

Preprocessing

  • JSON Path: $.data

    ⛔️Custom on fail: Discard value

Item prototypes for Azure daily costs by services discovery

Name Description Type Key and additional info
Service ["{#AZURE.SERVICE.NAME}"]: Meter ["{#AZURE.BILLING.METER}"]: Subcategory ["{#AZURE.BILLING.METER.SUBCATEGORY}"] daily cost

The daily cost by service {#AZURE.SERVICE.NAME}, meter {#AZURE.BILLING.METER}, subcategory {#AZURE.BILLING.METER.SUBCATEGORY}.

Dependent item azure.daily.cost["{#AZURE.SERVICE.NAME}", "{#AZURE.BILLING.METER}", "{#AZURE.BILLING.METER.SUBCATEGORY}","{#AZURE.RESOURCE.GROUP}"]

Preprocessing

  • JSON Path: The text is too long. Please see the template.

    ⛔️Custom on fail: Discard value

LLD rule Azure monthly costs by services discovery

Name Description Type Key and additional info
Azure monthly costs by services discovery

Discovery of monthly costs by services.

Dependent item azure.monthly.services.costs.discovery

Preprocessing

  • JSON Path: $.serviceCost.data

    ⛔️Custom on fail: Discard value

Item prototypes for Azure monthly costs by services discovery

Name Description Type Key and additional info
Service ["{#AZURE.SERVICE.NAME}"]: Month ["{#AZURE.BILLING.MONTH}"] cost

The monthly cost by service {#AZURE.SERVICE.NAME}.

Dependent item azure.monthly.service.cost["{#AZURE.SERVICE.NAME}", "{#AZURE.BILLING.MONTH}"]

Preprocessing

  • JSON Path: The text is too long. Please see the template.

    ⛔️Custom on fail: Discard value

  • JSON Path: The text is too long. Please see the template.

    ⛔️Custom on fail: Discard value

LLD rule Azure monthly costs by location discovery

Name Description Type Key and additional info
Azure monthly costs by location discovery

Discovery of monthly costs by location.

Dependent item azure.monthly.location.costs.discovery

Preprocessing

  • JSON Path: $.resourceLocationCost.data

    ⛔️Custom on fail: Discard value

Item prototypes for Azure monthly costs by location discovery

Name Description Type Key and additional info
Location: ["{#AZURE.RESOURCE.LOCATION}"]: Month ["{#AZURE.BILLING.MONTH}"] cost

The monthly cost by location {#AZURE.RESOURCE.LOCATION}.

Dependent item azure.monthly.location.cost["{#AZURE.RESOURCE.LOCATION}", "{#AZURE.BILLING.MONTH}"]

Preprocessing

  • JSON Path: The text is too long. Please see the template.

    ⛔️Custom on fail: Discard value

  • JSON Path: The text is too long. Please see the template.

    ⛔️Custom on fail: Discard value

LLD rule Azure monthly costs by resource group discovery

Name Description Type Key and additional info
Azure monthly costs by resource group discovery

Discovery of monthly costs by resource group.

Dependent item azure.monthly.resource.group.costs.discovery

Preprocessing

  • JSON Path: $.resourceGroupCost.data

    ⛔️Custom on fail: Discard value

Item prototypes for Azure monthly costs by resource group discovery

Name Description Type Key and additional info
Resource group: ["{#AZURE.RESOURCE.GROUP}"]: Month ["{#AZURE.BILLING.MONTH}"] cost

The monthly cost by resource group {#AZURE.RESOURCE.GROUP}.

Dependent item azure.monthly.resource.group.cost["{#AZURE.RESOURCE.GROUP}", "{#AZURE.BILLING.MONTH}"]

Preprocessing

  • JSON Path: The text is too long. Please see the template.

    ⛔️Custom on fail: Discard value

  • JSON Path: The text is too long. Please see the template.

    ⛔️Custom on fail: Discard value

LLD rule Azure monthly costs discovery

Name Description Type Key and additional info
Azure monthly costs discovery

Discovery of monthly costs.

Dependent item azure.monthly.costs.discovery

Preprocessing

  • JSON Path: $.monthCost.data

    ⛔️Custom on fail: Discard value

Item prototypes for Azure monthly costs discovery

Name Description Type Key and additional info
Month ["{#AZURE.BILLING.MONTH}"] cost

The monthly cost.

Dependent item azure.monthly.cost["{#AZURE.BILLING.MONTH}"]

Preprocessing

  • JSON Path: The text is too long. Please see the template.

    ⛔️Custom on fail: Discard value

Articles and documentation

+ Propose new article

Sie können die Integration nicht finden, die Sie benötigen?