To get started with plugins in general, please visit https://developer.morpheusdata.com.
A good place to start with reports in general would be this example:
To interrogate the database in terms running and stopped times, this SQL statement would be a good place to start from.
(Parameterization and additional filters will be needed, depending on the use case details. The dates can be calculated in the report logic and schedules for specific for recurring execution.)
SELECT
au.server_name AS 'VM Name',
CASE
WHEN csvr.id IS NULL THEN 'Deleted'
WHEN au.ref_type = 'container' THEN 'VM'
ELSE 'Discovered'
END AS ref_type,
SUM(
CASE
WHEN au.status = 'stopped' THEN
TIMESTAMPDIFF(MINUTE, start_date, end_date)
ELSE 0
END
) AS 'Minutes Stopped',
SUM(
CASE
WHEN au.status = 'running' THEN
TIMESTAMPDIFF(MINUTE, start_date, end_date)
ELSE 0
END
) AS minutes_running,
au.zone_name AS 'Cloud Name',
cs.name AS 'Group Name'
FROM
account_usage au
LEFT JOIN compute_zone cz ON au.zone_id = cz.id
LEFT JOIN compute_site_zones csz ON cz.id = csz.zone_id
LEFT JOIN compute_site cs ON csz.site_id = cs.id
LEFT JOIN compute_server csvr ON au.server_id = csvr.id
WHERE
au.ref_type in ('container', 'discoveredServer')
GROUP BY
au.server_name,
CASE
WHEN csvr.id IS NULL THEN 'Deleted'
WHEN au.ref_type = 'container' THEN 'VM'
ELSE 'Discovered'
END,
au.zone_name,
au.refuuid,
cs.name,
csvr.id;`Preformatted text`
Regards.
(Thanks Chris T for the help in resolving!!)