Skip to content

Instantly share code, notes, and snippets.

@Drarok
Forked from anonymous/gist:234562aa7013aec995a9
Last active August 29, 2015 14:01
Show Gist options
  • Save Drarok/8259d275f39c22eedb68 to your computer and use it in GitHub Desktop.
Save Drarok/8259d275f39c22eedb68 to your computer and use it in GitHub Desktop.
SELECT
ServerObject.Name,
storageYesterday.Committed AS committedYesterday,
storageToday.Committed AS committedToday,
ROUND((storageToday.Committed - storageYesterday.Committed) / 1073741824) AS DifferenceGB
FROM
ServerObject
LEFT OUTER JOIN
StorageUsedByVm AS storageYesterday ON
storageYesterday.VcenterId = ServerObject.VcenterId
AND storageYesterday.Date = CURRENT_DATE() - INTERVAL 1 DAY
LEFT OUTER JOIN
StorageUsedByVm AS storageToday ON
storageToday.VcenterId = ServerObject.VcenterId
AND storageToday.Date = CURRENT_DATE()
WHERE
ServerObject.Disabled = 0
GROUP BY
ServerObject.VcenterId
ORDER BY
DifferenceGB DESC
LIMIT
5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment