Go to main content

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

退出打印视图

更新时间: 2021 年 8 月
 
 

定制警报

定制警报是针对定制事件的警报操作。为 category 的值指定 custom

定制事件在工作流中定义。指定以下用于介绍工作流中所定义事件的属性,而不是从预定义事件中选择。

表 10  定制警报属性
属性
类型
说明
severity
string
可选。引发警报的事件的严重性。有效值为:Minor(次要)、Major(重大)或 Critical(严重)。
description
string
必需。引发警报的事件的说明。
response
string
可选。系统将执行以缓解此事件影响的操作的说明。
impact
string
可选。此事件对设备的影响的说明。
recommended_action
string
可选。管理员应执行以缓解此事件影响的操作的说明。

将授权配置为创建和发布定制警报

要创建定制的警报,用户必须在 alert 范围中具有 allow_configure 授权。要发布定制警报,用户必须在 alert 范围中具有 allow_post 授权。请参见Oracle ZFS Storage Appliance 管理指南,发行版 OS8.8.x 中的 使用定制警报所需的授权

创建定制警报

category 的值指定 custom,并至少为表 10, 定制警报属性中的 description 属性设置一个值。

请求示例:

POST /api/alert/v1/actions
Accept: application/json
Content-Type: application/json

{"category": "custom", "severity": "Minor", "description": "Custom alert description",
"response": "What the system will do", "impact": "What happened to the appliance", 
"recommended_action": "What the administrator should do"}

结果示例:

记下输出中警报的 uuid。发布警报时将需要此信息。

{
    "actions": {
        "href": "/api/alert/v1/actions/actions-004",
        "category": "custom",
        "severity": "Minor",
        "description": "Custom alert description",
        "response": "What the system will do",
        "impact": "What happened to the appliance",
        "recommended_action": "What the administrator should do",
        "uuid": "custom-alert-uuid"
    }
}

按照与修改任何其他警报相同的方式修改此定制警报(如修改警报操作中所述),添加或更改 severitydescriptionresponseimpactrecommended_action 属性的值。

按照与指定任何其他警报的响应相同的方式指定对此定制警报的响应(如为事件指定响应修改对事件的响应中所述)。

按照与任何其他警报相同的方式删除警报响应或定制警报(如删除对事件的响应删除警报操作中所述)。

发布定制警报

必须提供要发布的定制警报的 UUID。创建警报和列出警报时,都会显示 UUID。请参见创建定制警报列出单个警报操作

只能发布 category 值为 custom 的警报。

除了警报的 UUID 之外,还必须指定表 10, 定制警报属性中列出的未在警报中指定的任何属性。发布警报时,可以为警报中指定的属性提供新值。

请求示例:

POST /api/alert/v1/postalert
Accept: application/json
Content-Type: application/json

{"uuid": "custom-alert-uuid"}

结果示例:

{
    "uuid": "posted-alert-uuid"
}