이 콘텐츠는 선택한 언어로 제공되지 않습니다.
25.4. Methods
25.4.1. Searching Events 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
The
events collection provides search queries similar to other resource collections. An additional feature when searching the events collection is the ability to search from a certain event. This queries all of events since a specified event.
Querying from an event requires an additional
from parameter added before the search query. This from argument references an event id code.
Example 25.3. Searching from an event
GET /ovirt-engine/api/events;from=1012?search=type%3D30 HTTP/1.1 Accept: application/xml
GET /ovirt-engine/api/events;from=1012?search=type%3D30 HTTP/1.1
Accept: application/xml
This displays all events with
type set to 30 since id="1012"
Example 25.4. Searching using a specific event severity
GET /ovirt-engine/api/events?search=severity>normal HTTP/1.1 Accept: application/xml
GET /ovirt-engine/api/events?search=severity>normal HTTP/1.1
Accept: application/xml
This displays all events with severity higher than
normal. Severity levels include normal, warning, error and alert.
25.4.2. Paginating Events 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
A virtualization environment generates a large amount of events after a period of time. However, the API only displays a default number of events for one search query. To display more than the default, the API separates results into pages with the
page command in a search query.
The following search query tells the API to paginate results using a
page value in combination with the sortby clause:
sortby time asc page 1
The
sortby clause defines the base element to order of the results and whether the results are ascending or descending. For search queries of events, set the base element to time and the order to ascending (asc) so the API displays all events from the creation of your virtualization environment.
The
page condition defines the page number. One page equals the default number of events to list. Pagination begins at page 1. To view more pages, increase the page value:
sortby time asc page 2
sortby time asc page 3
sortby time asc page 4
Example 25.5. Paginating events
This example paginates
event resources. The URL-encoded request is:
GET /ovirt-engine/api/events?search=sortby%20time%20asc%20page%201 HTTP/1.1 Accept: application/xml
GET /ovirt-engine/api/events?search=sortby%20time%20asc%20page%201 HTTP/1.1
Accept: application/xml
Increase the
page value to view the next page of results.
GET /ovirt-engine/api/events?search=sortby%20time%20asc%20page%202 HTTP/1.1 Accept: application/xml
GET /ovirt-engine/api/events?search=sortby%20time%20asc%20page%202 HTTP/1.1
Accept: application/xml
Use an additional
from argument to set the starting id.
GET /ovirt-engine/api/events?search=sortby%20time%20asc%20page%202&from=30 HTTP/1.1 Accept: application/xml
GET /ovirt-engine/api/events?search=sortby%20time%20asc%20page%202&from=30 HTTP/1.1
Accept: application/xml
25.4.3. Adding Events 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
The API can add custom events with a
POST request to the events collection. A new event requires the description, severity, origin, and custom_id elements. Custom events can also include flood_rate, user id, and the id codes of any resources relevant to the event. host and storage_domain elements can contain the external_status element to set an external health status.
Example 25.6. Adding a custom event to the event list
25.4.4. Removing Events 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Removal of an event from the event list requires a
DELETE request.
Example 25.7. Removing an event
DELETE /ovirt-engine/api/events/1705 HTTP/1.1 HTTP/1.1 204 No Content
DELETE /ovirt-engine/api/events/1705 HTTP/1.1
HTTP/1.1 204 No Content