Threshold Alerts

A threshold alert is a custom alert in which a threshold is defined for a particular Analytics statistic, and the alert action is executed when the statistic value is outside that threshold. See also .

The following table describes the properties to set to specify the Analytics statistic, define the threshold for that statistic, and define when alert actions will be executed for that threshold alert.

Table 4-5 Threshold Alert Properties

Property Type Description

statname

AnalyticsStatistics

Required. The Analytics statistic to monitor.

limit

PositiveInteger

Required. The threshold value that triggers the alert. The percent or the number of bytes, operations, accesses, or requests per second.

type

ChooseOne

How to compare the threshold value (limit) to the current statistic value.

  • normal – The current statistic value exceeds the threshold value. This is the default.

  • inverted – The current statistic value falls below the threshold value.

minpost

Duration

Length of time in seconds that the statistic value must remain in the threshold condition before the alert action is executed. Default value is five minutes.

days

ChooseOne

Which days to send these alerts: all days, weekdays, or weekends. Default value is all.

window_start

window_end

TimeOfDay

The window of time during which to execute this alert action. Specify times from 00:00 through 23:30 UTC on 30-minute increments. To execute this alert action any time the conditions are met, specify none as either the start time or the end time. Default values are none for window_start and 00:00 for window_end.

frequency

Duration

Length of time in seconds between re-executing the alert action while the statistic value remains in the threshold condition. Default value is five minutes.

minclear

Duration

Length of time in seconds that the statistic value must remain outside the threshold condition before a followup alert action is executed. Default value is five minutes.

List Threshold Alerts

The following request lists all of the configured threshold alerts.

Example Request:

GET /api/alert/v1/thresholds HTTP/1.1
Authorization: Basic Tm8gcGVla2luZyE=
Host: zfs-storage.example.com:215
Accept: application/json

Example Result:

HTTP/1.1 200 OK
Date: Tue, 15 Oct 2019 10:38:40 GMT
X-Zfssa-Appliance-Api: 1.0
Content-Type: application/json
Content-Length: 689

{
    "thresholds": [
        {
            "uuid": "threshold-uuid1",
            "statname": "cpu.utilization",
            "type": "normal",
            "limit": 80,
            "minpost": 300,
            "days": "weekdays",
            "window_start": "08:00",
            "window_end": "19:30",
            "frequency": 300,
            "minclear": 300,
            "threshold": "threshold-000",
            "href": "/api/alert/v1/thresholds/threshold-uuid1"
        },
        {
            "uuid": "threshold-uuid2",    
            "statname": "cap.meta_percentused[pool]",
            "type": "normal",
            "limit": 85,
            "minpost": 300,
            "days": "all",
            "window_start": "none",
            "window_end": "00:00",
            "frequency": 0,
            "minclear": 0,
            "threshold": "threshold-001",
            "href": "/api/alert/v1/thresholds/threshold-uuid2"       
        }
    ]
}

Use the following request to list all properties for only the specified threshold alert.

GET /api/alert/v1/thresholds/threshold-uuid HTTP/1.1

Create a Threshold Alert

This example creates a threshold alert for the event that datalink bytes per second exceeds 100000 KB. All other properties have default values.

To create a custom threshold alert, the user must have the allow_configure authorization in the alert scope.

Example Request:

POST /api/alert/v1/thresholds HTTP/1.1
Host: zfs-storage.example.com
X-Auth-User: root
X-Auth-Key: password
Content-Type: application/json
Content-Length: 50

{"statname": "datalink.kilobytes", "limit": 100000}

Example Result:

HTTP/1.1 201 Created
X-Zfssa-Appliance-Api: 1.0
Content-Type: application/json
Content-Length: 321
Location: /api/alert/v1/thresholds/threshold-uuid

{
    "threshold": {
        "href": "/api/alert/v1/thresholds/threshold-uuid",
        "uuid": "threshold-uuid",
        "statname": "datalink.kilobytes",
        "type": "normal",
        "limit": 100000,
        "minpost": 300,
        "days": "all",
        "window_start": "none",
        "window_end": "00:00",
        "frequency": 300,
        "minclear": 300
    }
}

Modify a Threshold Alert

Use this command to modify the properties of the specified threshold alert.

Example Request:

PUT /api/alert/v1/thresholds/threshold-uuid HTTP/1.1
Authorization: Basic Tm8gcGVla2luZyE=
Host: zfs-storage.example.com:215

{"days": "weekdays", "minpost": 120}

Example Result:

HTTP/1.1 202 Accepted
X-Zfssa-Appliance-Api: 1.0
Content-Type: application/json
Content-Length: 326

{
    "threshold": {
        "href": "/api/alert/v1/thresholds/threshold-uuid",
        "uuid": "threshold-uuid",
        "statname": "datalink.kilobytes",
        "type": "normal",
        "limit": 100000,
        "minpost": 120,
        "days": "weekdays",
        "window_start": "none",
        "window_end": "00:00",
        "frequency": 300,
        "minclear": 300
    }
}

Delete a Threshold Alert

Delete the specified threshold alert.

Example Request:

DELETE /api/alert/v1/thresholds/threshold-uuid HTTP/1.1
Authorization: Basic Tm8gcGVla2luZyE=
Host: zfs-storage.example.com:215

Example Result:

HTTP/1.1 204 No Content
X-Zfssa-Appliance-Api: 1.0