Metrics - Custom - Create

Post the metric values for a resource.

POST https://monitoring.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProvider}/{resourceTypeName}/{resourceName}/metrics

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

The ARM resource group name

resourceName
path True

string

The ARM resource name

resourceProvider
path True

string

The ARM resource provider name

resourceTypeName
path True

string

The ARM resource type name

subscriptionId
path True

string

The azure subscription id

Request Header

Name Required Type Description
Content-Type True

string

Supports application/json and application/x-ndjson

Content-Length True

integer

int32

Content length of the payload

Authorization True

string

Authorization token issue for issued for audience "https:\monitoring.azure.com"

Request Body

Name Required Type Description
data True

AzureMetricsData

time True

string

Gets or sets Time property (in ISO 8601 format)

Responses

Name Type Description
200 OK

AzureMetricsResult

The azure metrics publish succeeded

Other Status Codes

AzureMetricsResult

An unexpected error from the server. See response object for the reason

Examples

Post azure metrics for cows sold with related metadata as dimensions

Sample request

POST https://monitoring.azure.com/subscriptions/b7ac8a0c-fbae-4e29-a0f7-09999b8857a1/resourcegroups/CowsSeller/providers/Microsoft.Storage/storageAccounts/cowssellerstore/metrics




{
  "time": "2018-08-24T 11:02:00-7:00",
  "data": {
    "baseData": {
      "metric": "CowsSold",
      "namespace": "Cows",
      "dimNames": [
        "Breed",
        "Color",
        "Age"
      ],
      "series": [
        {
          "dimValues": [
            "Angus",
            "Blue",
            "5"
          ],
          "min": 5,
          "max": 20,
          "sum": 30,
          "count": 3
        }
      ]
    }
  }
}

Sample response

{
  "statusCode": 200
}

Definitions

Name Description
ApiError
ApiFailureResponse
AzureMetricsBaseData
AzureMetricsData
AzureMetricsDocument
AzureMetricsResult
AzureTimeSeriesData

ApiError

Name Type Description
code

string

Gets or sets the azure metrics error code

message

string

Gets or sets the azure metrics error message

ApiFailureResponse

Name Type Description
error

ApiError

AzureMetricsBaseData

Name Type Description
dimNames

string[]

Gets or sets the list of dimension names (optional)

metric

string

Gets or sets the Metric name

namespace

string

Gets or sets the Metric namespace

series

AzureTimeSeriesData[]

Gets or sets the list of time series data for the metric (one per unique dimension combination)

AzureMetricsData

Name Type Description
baseData

AzureMetricsBaseData

AzureMetricsDocument

Name Type Description
data

AzureMetricsData

time

string

Gets or sets Time property (in ISO 8601 format)

AzureMetricsResult

Name Type Description
apiFailureResponse

ApiFailureResponse

statusCode

integer

Http status code response

AzureTimeSeriesData

Name Type Description
count

integer

Gets or sets Count value

dimValues

string[]

Gets or sets dimension values

max

number

Gets or sets Max value

min

number

Gets or sets Min value

sum

number

Gets or sets Sum value