Go to main content

Oracle® ZFS Storage Appliance RESTful API 指南,发行版 OS8.8.x

退出打印视图

更新时间: 2021 年 8 月
 
 

阈值警报

阈值警报是一种定制警报,可从中为特定的 Analytics(分析)统计信息定义阈值,当统计信息值超出该阈值时,将执行警报操作。另请参见Oracle ZFS Storage Appliance 分析指南,发行版 OS8.8.x

下表介绍了要设置的属性,以指定 Analytics(分析)统计信息、为该统计信息定义阈值,以及定义何时针对该阈值警报执行警报操作。

表 11  阈值警报属性
属性
类型
说明
statname
AnalyticsStatistics
必需。要监视的 Analytics(分析)统计信息。
limit
PositiveInteger
必需。触发警报的阈值。每秒的字节、操作、访问或请求的百分比或数量。
type
ChooseOne
如何将阈值 (limit) 与当前统计信息值进行比较。
  • normal-当前的统计信息值超过阈值。这是默认值。

  • inverted-当前的统计信息值低于阈值。

minpost
Duration
执行警报操作之前,统计信息值必须保持在阈值条件中的时间长度(以秒为单位)。默认值为五分钟。
days
ChooseOne
发送这些警报的日期:all 天、weekdaysweekends。默认值为 all
window_start
window_end
TimeOfDay
执行此警报操作的时间段。以 30 分钟为增量指定从 00:00 到 23:30 UTC 的时间。要在满足条件的任何时间执行此警报操作,请指定 none 作为开始时间或结束时间。window_start 的默认值为 nonewindow_end 的默认值为 00:00
frequency
Duration
当统计信息值保持在阈值条件中时,重新执行警报操作之间的时间长度(以秒为单位)。默认值为五分钟。
minclear
Duration
执行后续警报操作之前,统计信息值必须保持在阈值条件外的时间长度(以秒为单位)。默认值为五分钟。

列出阈值警报

以下请求列出所有已配置的阈值警报。

请求示例:

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

结果示例:

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"       
        }
    ]
}

使用以下请求仅列出指定阈值警报的所有属性。

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

创建阈值警报

此示例为每秒数据链路字节数超过 100000 KB 的事件创建阈值警报。所有其他属性都有默认值。

要创建定制阈值警报,用户必须在 alert 范围中具有 allow_configure 授权。

请求示例:

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}

结果示例:

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
    }
}

修改阈值警报

使用此命令可以修改指定阈值警报的属性。

请求示例:

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

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

结果示例:

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 /api/alert/v1/thresholds/threshold-uuid HTTP/1.1
Authorization: Basic Tm8gcGVla2luZyE=
Host: zfs-storage.example.com:215

结果示例:

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