阈值警报是一种定制警报,可从中为特定的 Analytics(分析)统计信息定义阈值,当统计信息值超出该阈值时,将执行警报操作。另请参见Oracle ZFS Storage Appliance 分析指南,发行版 OS8.8.x。
下表介绍了要设置的属性,以指定 Analytics(分析)统计信息、为该统计信息定义阈值,以及定义何时针对该阈值警报执行警报操作。
|
以下请求列出所有已配置的阈值警报。
请求示例:
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