Bug 1117681

Summary: new reporting query: system utilisation
Product: [Retired] Beaker Reporter: Dan Callaghan <dcallagh>
Component: reportsAssignee: Amit Saha <asaha>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.17CC: aigao, asaha, azelinka, dcallagh, ebaak, jhutar, rmancy, xma
Target Milestone: 0.18Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-04 05:41:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dan Callaghan 2014-07-09 08:11:03 UTC
A useful report is "utilisation" of particular systems: what proportion of a given time period where they reserved for. We currently have nothing covering that in our supported reporting queries, we should add it.

Here is a query I wrote for a user, in Teiid syntax:

    SELECT fqdn,
        CAST(SUM(TIMESTAMPDIFF(SQL_TSI_SECOND,
            CASE WHEN reservation.start_time < {ts '2014-07-01 00:00:00'}
                THEN {ts '2014-07-01 00:00:00'}
                ELSE reservation.start_time
                END,
            CASE WHEN reservation.finish_time IS NULL
                OR reservation.finish_time > {ts '2014-07-10 00:00:00'}
                THEN {ts '2014-07-10 00:00:00'}
                ELSE reservation.finish_time
                END))
            AS FLOAT)
        / TIMESTAMPDIFF(SQL_TSI_SECOND,
            {ts '2014-07-01 00:00:00'},
            {ts '2014-07-10 00:00:00'})
    FROM Beaker.reservation
    INNER JOIN Beaker.system
        ON reservation.system_id = system.id
    WHERE reservation.start_time >= {ts '2014-07-01 00:00:00'}
        AND (reservation.finish_time < {ts '2014-07-10 00:00:00'}
            OR reservation.finish_time IS NULL)
        -- add clauses here to select particular systems
    GROUP BY system.fqdn;

Comment 3 Amit Saha 2014-07-18 06:25:22 UTC
gerrit.beaker-project.org/#/c/3213/

Comment 4 Dan Callaghan 2014-08-06 05:52:36 UTC
The new reporting query is now available here:

https://git.beaker-project.org/cgit/beaker/tree/Server/bkr/server/reporting-queries/machine-utilization.sql?h=develop

Comment 5 xuezhi ma 2014-08-06 06:31:21 UTC
verified:

steps:
1. Get sql from https://git.beaker-project.org/cgit/beaker/tree/Server/bkr/server/reporting-queries/machine-utilization.sql?h=develop
2. Run the sql on database.
The sql can be run successfully.
3. Run the sql in description in teiid.
The sql can be run successfully too.

Change it to verified.

Comment 6 Dan Callaghan 2014-09-04 05:41:17 UTC
Beaker 0.18.0 has been released.