Anomalies API

Cloud cost anomaly detection offers end-to-end monitoring of spikes in your Google Cloud or Amazon Web Services billing, seamlessly, across all your projects and services. More information about cost anomalies in the CMP is available here

The Anomalies API helps you programmatically obtain cloud cost or usage anomalies for all supported platforms such as Google Cloud or Amazon Web Services with an easy-to-use RESTful API.

πŸ‘

API Reference

The Anomalies API reference is available at https://developer.doit-intl.com/reference#anomalies

πŸ“˜

Required Permissions

Cloud Analytics (part of Standard User built-in role)

Anomalies API has the following methods:

anomalies.list

The anomalies.list method provides a list of all anomalies available for your cloud platforms.

You can filter the list by using one or more of the following parameters:

Parameter

Description

minCreationTime

string
Min value for a time of an anomaly, in milliseconds since the POSIX epoch. If set, only anomalies happened after or at this timestamp are returned."

maxCreationTime

string
Max value for a time of an anomaly time, in milliseconds since the POSIX epoch. If set, only anomalies happened before or at this timestamp are returned."

filter

string
An expression for filtering the results of the request. The syntax is key:[<value>]. For example, the platforms:google-cloud will filter the list to only Google Cloud anomalies.

Supported filter keys:

  • platform - can be either 'google-cloud' or 'amazon-web-services'

Learn more about how to properly use filter *.list requests

Sample anomalies.list Request using both minCreationTime and filter parameters:

curl --location --request GET 'https://api.doit-intl.com/anomalies/v1/?filter=serviceName:BigQuery&minCreationTime=1599436800000' \
--header 'Authorization: Bearer your-api-key'

πŸ“˜

your-api-key

Always replace "your-api-key" with your actual API key as explained at Getting Started

Sample anomalies.list Response:

{
    "rowCount": 2,
    "anomalies": [
        {
            "anomalyId": "7c045b29-57ee-437b-9dc0-e7e4eb005a64",
            "billingAccount": "01A29B-B56F30-AA7597",
            "platform": "google-cloud",
            "scope": "iottempstreaming",
            "serviceName": "BigQuery",
            "severityLevel": "warning",
            "timeFrame": "hourly",
            "startTime": 1612818000000
        },
        {
            "anomalyId": "36ba6c14-bd3c-40e3-bfa2-31189ea740b4",
            "billingAccount": "01A29B-B56F30-AA7597",
            "platform": "google-cloud",
            "scope": "iottempstreaming",
            "serviceName": "BigQuery",
            "severityLevel": "critical",
            "timeFrame": "daily",
            "startTime": 1612656000000
        }
    ]
}

anomalies.get

Get the full details of the individual anomaly using the anomaly id.

Sample anomalies.get Request

curl --location --request GET 'https://api.doit-intl.com/anomalies/v1/7c045b29-57ee-437b-9dc0-e7e4eb005a64' \
--header 'Authorization: Bearer your-api-key'

πŸ“˜

your-api-key

Always replace "your-api-key" with your actual API key as explained at Getting Started

Sample anomalies.get Response:

{
    "anomalyChartUrl": "https://storage.googleapis.com/me-doit-intl-com-gcp-anomalies/7c045b29-57ee-437b-9dc0-e7e4eb005a64.png",
    "billingAccount": "01C29B-B56F30-AA7597",
    "cloudProvider": "google-cloud",
    "scope": "iottempstreaming",
    "serviceName": "BigQuery",
    "severityLevel": "warning",
    "timeFrame": "hourly",
    "startTime": 1612818000000
}

Response Body
If successful, the response body contains an instance of Anomaly

{
  "billingAccount":string,
  "platform":string,
  "scope":string,
  "serviceName":string,
  "severityLevel":string,
  "startTime":integer,
  "timeFrame":string
}

Response Body Fields

Field

Description

billingAccount

string
Unique anomaly identifier

platform

string
The cloud platform for the anomaly. Can be either google-cloud or amazon-web-services

scope

string
this the Google Cloud project or AWS account for the given anomaly

serviceName

string
The name of the service causing the anomaly. Examples are EC2, BigQuery, SQS, etc.

severityLevel

string
All anomalies are classified as "info", "warning" or "critical"

timeFrame

string
Anomalies can be DAILY (when a certain day is abnormally large comparing to other days) or HOURLY (a certain hour is abnormally large compared to other hours of the same day).

startTime

number
The time when this anomaly was detected, in milliseconds since the epoch.`


Did this page help you?