25.4. Methods
25.4.1. 搜索事件 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
events 集合提供与其他资源集合类似的搜索查询。搜索事件集合时的附加功能是能够从特定事件搜索。这会查询指定事件之后的所有事件。
从事件查询需要额外添加
from 参数,然后再搜索查询。这一 from 参数引用事件 ID 代码。
例 25.3. 从事件搜索
GET /ovirt-engine/api/events;from=1012?search=type%3D30 HTTP/1.1
Accept: application/xml
这将显示所有事件,其
type 设为 30,因为 id="1012"
HTTP/1.1 200 OK
Content-Type: application/xml
<events>
<event id="1018" href="/ovirt-engine/api/events/1018">
<description>User admin logged in.</description>
<code>30</code>
<severity>normal</severity>
<time>2011-07-11T14:03:22.485+10:00</time>
<user id="80b71bae-98a1-11e0-8f20-525400866c73"
href="/ovirt-engine/api/users/80b71bae-98a1-11e0-8f20-525400866c73"/>
</event>
<event id="1016" href="/ovirt-engine/api/events/1016">
<description>User admin logged in.</description>
<code>30</code>
<severity>normal</severity>
<time>2011-07-11T14:03:07.236+10:00</time>
<user id="80b71bae-98a1-11e0-8f20-525400866c73"
href="/ovirt-engine/api/users/80b71bae-98a1-11e0-8f20-525400866c73"/>
</event>
<event id="1014" href="/ovirt-engine/api/events/1014">
<description>User admin logged in.</description>
<code>30</code>
<severity>normal</severity>
<time>2011-07-11T14:02:16.009+10:00</time>
<user id="80b71bae-98a1-11e0-8f20-525400866c73"
href="/ovirt-engine/api/users/80b71bae-98a1-11e0-8f20-525400866c73"/>
</event>
</events>
例 25.4. 使用特定事件严重性搜索
GET /ovirt-engine/api/events?search=severity>normal HTTP/1.1
Accept: application/xml
这将显示严重性高于
normal 的所有事件。严重级别包括 常规、warning、error 和 alert。
HTTP/1.1 200 OK
Content-Type: application/xml
<events>
<event id="2823" href="/ovirt-engine/api/events/2823">
<description>Host Host-05 has time-drift of 36002 seconds while maximum configured value is 300 seconds.</description>
<code>604</code>
<severity>warning</severity>
<time>2015-07-11T14:03:22.485+10:00</time>
<host href= "/ovirt-engine/api/hosts/44e52bb2-27d6-4d35-8038-0c4b4db89789" id="44e52bb2-27d6-4d35-8038-0c4b4db89789"/>
<cluster href= "/ovirt-engine/api/clusters/00000001-0001-0001-0001-00000000021b" id="00000001-0001-0001-0001-00000000021b"/>
<origin>oVirt</origin>
<custom_id>-1</custom_id>
<flood_rate>30</flood_rate>
</event>
...
</events>