Ce contenu n'est pas disponible dans la langue sélectionnée.
2.21. Example: Checking System Events using Python
Red Hat Virtualization Manager records and logs many system events. These event logs are accessible through the user interface, the system log files, and using the API. The ovirtsdk library exposes events using the
events
collection.
Example 2.22. Checking System Events using Python
In this example the
events
collection is listed. Note that:
- The
query
parameter of thelist
method is used to ensure that all available pages of results are returned. By default thelist
method will only return the first page of results which defaults to a maximum of100
records in length. - The resultant list is reversed to ensure that events are included in the output in the order that they occurred.
Output from this script will look like this - albeit with different events depending on the state of the environment:
2012-09-25T18:40:10.065-04:00 NORMAL CODE 30 - User admin@internal logged in. 2012-09-25T18:40:10.368-04:00 NORMAL CODE 153 - VM vm1 was started by admin@internal (Host: Atlantic). 2012-09-25T18:40:10.470-04:00 NORMAL CODE 30 - User admin@internal logged in.
2012-09-25T18:40:10.065-04:00 NORMAL CODE 30 - User admin@internal logged in.
2012-09-25T18:40:10.368-04:00 NORMAL CODE 153 - VM vm1 was started by admin@internal (Host: Atlantic).
2012-09-25T18:40:10.470-04:00 NORMAL CODE 30 - User admin@internal logged in.