11.3. Example Reports

The following examples provide an introduction to reports produced from queries to the rhevm_history database. The database gives users access to a rich data set and enables a variety of complex reporting scenarios. These examples illustrate only basic reporting requirements.

11.3.1. Resource Utilization on a Single Host

This example produces a resource utilization report for a single host. The resource utilization report provides CPU- and memory-usage percentage information from readings taken at one-minute intervals. This kind of report is useful for gaining insight into the load factor of an individual host over a short period of time. The report is defined by the following SQL query. Ensure the values provided for the host_name and history_datetime components of the where clause are substituted with the appropriate values for your environment and that the latest configuration is in use.

Example 11.1. Report query for resource utilization on a single host

 select history_datetime as DateTime, cpu_usage_percent as CPU, memory_usage_percent as Memory
    from v3_0_host_configuration_view, v3_0_host_samples_history_view
    where v3_0_host_configuration_view.host_id = v3_0_host_samples_history_view.host_id
    and host_name = 'example.labname.abc.company.com'
    and v3_0_host_configuration_view.history_id in (select max(a.history_id)
    						from v3_0_host_configuration_view as a
    						where v3_0_host_configuration_view.host_id = a.host_id)
    and history_datetime >= '2011-07-01 18:45'
    and history_datetime <= '2011-07-31 21:45'

This query returns a table of data with one row per minute:

Table 11.1. Resource Utilization for a Single Host Example Data

DateTime CPU Memory
2010-07-01 18:45 42 0
2010-07-01 18:46 42 0
2010-07-01 18:47 42 1
2010-07-01 18:48 33 0
2010-07-01 18:49 33 0
2010-07-01 18:50 25 1

Compose the data into a graph or chart using third party data analysis and visualization tools such as OpenOffice.org Calc and Microsoft Excel. For this example, a line graph showing the utilization for a single host over time is a useful visualization. Figure 11.1, “Single host utilization line graph” was produced using the Chart Wizard tool in OpenOffice.org Calc.
Single host utilization line graph

Figure 11.1. Single host utilization line graph