경보 조치는 이벤트 경보에 대한 응답입니다. 경보 조치를 만들려면 하나 이상의 이벤트를 지정하고, 해당 이벤트(예: 전자메일 전송 또는 워크플로우 실행)에 대한 경보가 전송될 때 수행할 조치를 하나 이상 지정합니다. 특정 이벤트 경보에 대해 둘 이상의 경보 조치를 지정할 수 있습니다.
category 등록 정보는 경보 조치가 수행될 이벤트의 범주를 지정합니다. 각 범주에는 하나 이상의 이벤트가 포함됩니다. 경보 조치를 만들거나 나열하는 경우 각 범주 내 이벤트가 나열됩니다. 기본적으로 범주 내 모든 이벤트에 대해 경보 조치가 수행됩니다. 이벤트 하위 세트에 대해서만 경보 조치를 수행해야 할 경우 이벤트로 인해 경보 조치가 수행되지 않아야 함을 나타내도록 등록 정보 값을 false로 변경합니다.
다음 표에서는 지정 가능한 이벤트 범주에 대해 설명합니다.
|
handler 등록 정보는 지정된 이벤트가 발생할 때 수행할 조치의 유형을 지정합니다. 다음 표에서와 같이 handler에 대한 값이 지정되면 대부분 이에 따라 추가 등록 정보를 설정해야 합니다.
|
모든 경보 조치를 나열하는 경우 각 경보 조치에 대해 이벤트 범주 및 해당 범주 내 각 이벤트가 나열됩니다. 경보 조치에 대해 정의된 응답을 표시하려면 단일 경보 조치 나열을 참조하십시오.
경보 조치를 가져오는 요청의 예:
GET /api/alert/v1/actions HTTP/1.1 Authorization: Basic Tm8gcGVla2luZyE= Host: zfs-storage.example.com:215 Accept: application/json
결과 예:
HTTP/1.1 200 OK X-Zfssa-Appliance-Api: 1.0 Content-Type: application/json Content-Length: 1395 { "actions": [ { "category": "smf", "uuid": "actions-uuid1", "failed_services": true, "degraded_services": true, "repaired_services": false, "actions": "actions-000", "href": "/api/alert/v2/actions/actions-000" }, { "category": "analytics", "uuid": "actions-uuid2", "analytics_datasets_auto-suspend_notify": false, "analytics_datasets_auto-suspend_warning": false, "analytics_memory_total_exceeded": true, "analytics_memory_total_normal": false, "analytics_usage_exceeded": true, "analytics_usage_normal": false, "actions": "actions-001", "href": "/api/alert/v2/actions/actions-001" } ] }
나열할 특정 경보 조치를 지정하는 경우 해당 경보 조치에 대해 이벤트 범주와 해당 범주 내 각 이벤트, 각 응답 또는 조치가 나열됩니다.
다음 경보 조치의 응답 세 가지는 모두 true 이벤트 중 하나가 발생할 때 수행됩니다.
요청 예:
GET /api/alert/v1/actions/actions-000 HTTP/1.1
결과 예:
HTTP/1.1 200 OK X-Zfssa-Appliance-Api: 1.0 Content-Type: application/json Content-Length: 331 { "actions": { "href": "/api/alert/v2/actions/actions-000", "category": "smf", "uuid": "actions-uuid1", "failed_services": true, "degraded_services": true, "repaired_services": false, "action-000": { "handler": "email", "address": "admin@example.com", "subject": "failed or degraded service", "href": "/api/alert/v2/actions/actions-000/action-000" }, "action-001": { "handler": "email", "address": "it-team@example.com", "subject": "failed or degraded service", "href": "/api/alert/v2/actions/actions-000/action-001" }, "action-002": { "handler": "syslog", "href": "/api/alert/v2/actions/actions-000/action-002" } } }
경보 조치를 만들 때는 이 사용자정의 응답을 정의 중인 이벤트의 범주인 category 등록 정보에 대한 값을 지정해야 합니다. category 값의 목록은 표 8, 경보 조치 이벤트 범주를 참조하십시오.
요청 예:
POST /api/alert/v1/actions HTTP/1.1 Host: zfs-storage.example.com:215 X-Auth-Session: uerqghq84vbdv Content-Type: application/json Content-Length: 30 {"category": "smf"}
결과 예:
결과는 지정된 이벤트 범주 내 모든 이벤트를 나열합니다. 기본적으로 범주 내 모든 이벤트로 인해 응답 조치가 수행됩니다(모두 true로 설정됨).
HTTP/1.1 201 Created X-Zfssa-Appliance-Api: 1.0 Content-Type: application/json Content-Length: 118 Location: /api/alert/v1/actions/actions-000 { "actions": { "href": "/api/alert/v2/actions/actions-000", "category": "smf", "uuid": "actions-uuid", "failed_services": true, "degraded_services": true, "repaired_services": true } }
지정된 이벤트 범주 내 일부 이벤트로 인해 응답 조치가 수행되지 않아야 할 경우 해당 이벤트를 나타내는 등록 정보를 false로 설정합니다.
다음 예에서는 실패하거나 성능이 저하된 서비스와 복구된 서비스에 대해 다른 응답을 정의할 수 있습니다.
요청 예:
PUT /api/alert/v1/actions/actions-000 HTTP/1.1 Host: zfs-storage.example.com:215 X-Auth-Session: uerqghq84vbdv Content-Type: application/json Content-Length: 30 {"repaired_services": false}
결과 예:
HTTP/1.1 202 Accepted X-Zfssa-Appliance-Api: 1.0 Content-Type: application/json Content-Length: 195 { "actions": { "href": "/api/alert/v2/actions/actions-000", "category": "smf", "uuid": "actions-uuid", "failed_services": true, "degraded_services": true, "repaired_services": false } }
기본적으로 이벤트 경보는 경보 로그에 기록됩니다. 앞선 예에서는 경보 로그에 게시하는 것 이외에도 응답을 정의할 이벤트를 지정했습니다. 해당 이벤트에 대한 응답을 정의하려면 특정 경보 조치의 handler 등록 정보 값을 지정합니다. handler 값의 목록은 표 9, 경보 조치 응답 유형을 참조하십시오.
요청 예:
이 예에서는 actions-000 경보에 대해 admin으로 전자메일을 전송하는 경보 조치를 만듭니다.
POST /api/alert/v1/actions/actions-000 HTTP/1.1 Host: zfs-storage.example.com:215 X-Auth-Session: uerqghq84vbdv Content-Type: application/json Content-Length: 68 {"handler": "email", "address": "admin@example.com", "subject": "failed or degraded service"}
결과 예:
HTTP/1.1 201 Created X-Zfssa-Appliance-Api: 1.0 Content-Type: application/json Content-Length: 177 Location: /api/alert/v1/actions/actions-000/action-000 { "action": { "href": "/api/alert/v1/actions/actions-002/action-000", "handler": "email", "address": "admin@example.com", "subject": "failed or degraded service" } }
동일한 이벤트에 대한 추가 응답을 지정하려면 동일한 경보 조치에 대해 POST 요청을 다시 실행하고 다른 처리기를 지정하거나, 동일한 처리기를 지정하고 처리기에 대해 다른 인수를 지정합니다. 한 요청에서 handler 등록 정보를 2개 이상 지정하면 마지막 등록 정보를 제외한 모든 handler 등록 정보가 무시됩니다.
다음 예가 짧게 줄어듭니다. 해당 요청은 단일 경보 조치 나열에서와 같이 /api/alert/v1/actions/actions-000/action-001 및 /api/alert/v1/actions/actions-000/action-002를 만듭니다.
POST /api/alert/v1/actions/actions-002 HTTP/1.1 ... {"handler": "email", "address": "it-team@example.com", "subject": "failed or degraded service"}
POST /api/alert/v1/actions/actions-002 HTTP/1.1 ... {"handler": "syslog"}
응답을 수정하려면 수정할 응답에 대한 HREF를 지정합니다.
PUT /api/alert/v1/actions/actions-000/action-001 HTTP/1.1 Host: zfs-storage.example.com:215 X-Auth-Session: uerqghq84vbdv Content-Type: application/json Content-Length: 28 {"address": "it-group@example.com"}
응답을 삭제하려면 삭제할 응답에 대한 HREF를 지정합니다.
DELETE /api/alert/v1/actions/actions-000/action-000 HTTP/1.1 Host: zfs-storage.example.com:215 X-Auth-Session: uerqghq84vbdv HTTP/1.1 204 No Content
경보 조치를 삭제하려면 삭제할 경보 조치에 대한 HREF를 지정합니다.
요청 예:
DELETE /api/alert/v1/actions/actions-003 HTTP/1.1 Authorization: Basic Tm8gcGVla2luZyE= Host: zfs-storage.example.com:215
결과 예:
HTTP/1.1 204 No Content X-Zfssa-Appliance-Api: 1.0