TitleistDBA
IS-IT--Management
I have the following query on a database for Altiris.
it returns the device name, total space and free spcace for all of our servers in the company.
SELECT LD.[DEVICE ID],
SUM(LD.[Size in MBytes]) AS 'Total Space',
SUM(LD.[Free Space in MBytes]) AS 'Free Space'
FROM ( [vResourceEx] T0 INNER JOIN [Inv_AeX_OS_Operating_System] T1
ON T0.[Guid] = T1.[_ResourceGuid] ) INNER JOIN [Inv_AeX_AC_Identification] T2
ON T1.[_ResourceGuid] = T2.[_ResourceGuid]
INNER JOIN [INV_AEX_HW_LOGICAL_DISK] LD
ON T2.[_ResourceGuid] = LD.[_ResourceGuid]
WHERE ((NOT T1.[OS Name] = 'Microsoft Windows XP'
AND (NOT T1.[Product ID] LIKE '51873%'
AND NOT T1.[Product ID] LIKE '51874%'))
AND NOT T2.[OS Type] = 'Workstation')
AND substring(LD.[DEVICE ID],1,1) < 'K'
GROUP BY LD.[DEVICE ID]
ORDER BY LD.[DEVICE ID]
The result set looks like this.
DEVICE ID TOTAL SPACE FREEE SPACE
----------- -------------- -----------
A: 0 0
C: 6250963 4518721
D: 26141720 15533886
I need to caclulate the percentage of used disk space.
Do I divide the SUM of total space by the sum of free space to get that?
SELECT SUM(LD.[Size in MBytes])/
SUM(LD.[Free Space in MBytes]) AS 'Percent Used'
Is that correct?
Thanks
it returns the device name, total space and free spcace for all of our servers in the company.
SELECT LD.[DEVICE ID],
SUM(LD.[Size in MBytes]) AS 'Total Space',
SUM(LD.[Free Space in MBytes]) AS 'Free Space'
FROM ( [vResourceEx] T0 INNER JOIN [Inv_AeX_OS_Operating_System] T1
ON T0.[Guid] = T1.[_ResourceGuid] ) INNER JOIN [Inv_AeX_AC_Identification] T2
ON T1.[_ResourceGuid] = T2.[_ResourceGuid]
INNER JOIN [INV_AEX_HW_LOGICAL_DISK] LD
ON T2.[_ResourceGuid] = LD.[_ResourceGuid]
WHERE ((NOT T1.[OS Name] = 'Microsoft Windows XP'
AND (NOT T1.[Product ID] LIKE '51873%'
AND NOT T1.[Product ID] LIKE '51874%'))
AND NOT T2.[OS Type] = 'Workstation')
AND substring(LD.[DEVICE ID],1,1) < 'K'
GROUP BY LD.[DEVICE ID]
ORDER BY LD.[DEVICE ID]
The result set looks like this.
DEVICE ID TOTAL SPACE FREEE SPACE
----------- -------------- -----------
A: 0 0
C: 6250963 4518721
D: 26141720 15533886
I need to caclulate the percentage of used disk space.
Do I divide the SUM of total space by the sum of free space to get that?
SELECT SUM(LD.[Size in MBytes])/
SUM(LD.[Free Space in MBytes]) AS 'Percent Used'
Is that correct?
Thanks