fbpx
POSThttps://api.spotinst.io/spectrum/metrics/alert?accountId={ACCOUNT_ID}

Creates an Alert

URL Parameters

Parameter Type Description
ACCOUNT_ID String

Account ID from Spotinst console

Example: act-12345
Request

Headers
{
    "Content-Type": "application/json",
    "Authorization": "Bearer ${TOKEN}"
}
Body
Copied!
Downloaded!
{
  "alert": {
    "enabled": true,
    "name": "Spotinst - High CPU load",
    "description": "One or more of the instances have high CPU utilization",
    "documentation": "",
    "namespace": "spotinst/compute",
    "metricName": "cpu_load",
    "dimensions": [
      {
        "name": "instance_id",
        "value": "i-0972be94f00afef3c"
      }
    ],
    "statistic": "sum",
    "period": "1m",
    "consecutivePeriods": 1,
    "conditions": {
      "critical": {
        "threshold": 80,
        "operator": "gt"
      }
    },
    "actionsEnabled": true,
    "actions": {
      "unknownActionIds": [],
      "okActionIds": [],
      "warningActionIds": [],
      "errorActionIds": [],
      "criticalActionIds": [
        "ac-664d6979ccbb"
      ]
    }
  }
}

Body Attributes


  • alert.enabled * String
    threshold or operator
  • alert.name * String
    a name of your choice
  • alert.description * String
    a description of your choice
  • alert.documentation * String
  • alert.namespace * String
    metric namespace
  • alert.metricName * String
    metric name
  • alert.dimensions * Array
    array of dimensions
  • alert.dimensions.name * String
    name
  • alert.dimensions.value * String
    filter value
  • alert.statistic * String
    Accepted values:
    ‘sum’
    ‘maximum’
    ‘minimum’
    ‘avg’
  • alert.consecutivePeriods * Integer
    consecutive checks before triggering the alert
  • alert.conditions Object
    Contains the conditions attributes
  • alert.conditions.critical Object
    Contains threshold and operator attributes
  • alert.conditions.critical.threshold Integer
    Alert threshold
  • alert.conditions.critical.operator String
    Allowed values:
    ‘gt’
    ‘lt’
    ‘eq’
    ‘ge’
    ‘le’
    ‘ne’
  • alert.conditions.error String
    Contains threshold and operator attributes
  • alert.conditions.warning String
    Contains threshold and operator attributes
  • alert.conditions.ok String
    Contains threshold and operator attributes
  • alert.conditions.unknown String
    Contains threshold and operator attributes
  • alert.actionsEnabled Boolean
  • alert.actions * Object
    Contains the actions attributes
  • alert.actions.unknownActionIds * Array
    array containing 0 or more actions for this severity level
  • alert.actions.okActionIds * Array
    array containing 0 or more actions for this severity level
  • alert.actions.warningActionId * Array
    array containing 0 or more actions for this severity level
  • alert.actions.errorActionId * Array
    array containing 0 or more actions for this severity level
  • alert.actions.criticalActionId Array
    array containing 0 or more actions for this severity level
Response - 200

Headers
{
  "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
  "request": {
    "id": "c0e12178-6b0d-42f0-8a6e-701d8a55de5c",
    "url": "/spectrum/metrics/alert?accountId={AccountId}",
    "method": "POST",
    "timestamp": "2017-08-20T16:37:34.225Z"
  },
  "response": {
    "status": {
      "code": 200,
      "message": "OK"
    },
    "kind": "spotinst:lb:alert",
    "items": [
      {
        "id": "al-d185c7706b22",
        "status": "UNKNOWN",
        "enabled": true,
        "name": "Spotinst - High CPU load",
        "namespace": "spotinst/compute",
        "metricName": "cpu_load",
        "period": "1m",
        "consecutivePeriods": 1,
        "statistic": "sum",
        "conditions": {
          "error": null,
          "warning": null,
          "critical": {
            "threshold": 80,
            "operator": "gt"
          }
        },
        "dimensions": [
          {
            "name": "instance_id",
            "value": "i-0972be94f00afef3c"
          }
        ],
        "description": "One or more of the instances have high CPU utilization",
        "documentation": "",
        "actionsEnabled": true,
        "actions": {
          "okActionIds": [],
          "warningActionIds": [],
          "errorActionIds": [],
          "criticalActionIds": [
            "ac-664d6979ccbb"
          ],
          "unknownActionIds": []
        },
        "updatedAt": "2017-08-20T16:37:34.213Z",
        "createdAt": "2017-08-20T16:37:34.213Z"
      }
    ],
    "count": 1
  }
}