/build/static/layout/Breadcrumb_cap_w.png
09/11/2019 73 views

Right now i have alerts but they are not sending the disk % in email and I am not able to filer by device labels. Below is the SQL statement I want to be able to filter by device label rather than just AND OS_NAME like '%server%',

SELECT MACHINE_DISKS.PERCENT_USED AS MACHINE_DISKS_PERCENT_USED, MACHINE_DISKS.DISK_FREE as DISK_FREE_SPACE_GB, MACHINE_DISKS.DISK_FREE AS FREE_SPACE,  MACHINE.NAME AS SYSTEM_NAME FROM MACHINE_DISKS JOIN MACHINE ON (MACHINE.ID = MACHINE_DISKS.ID) WHERE   MACHINE_DISKS.PERCENT_USED > '85' AND MACHINE_DISKS.NAME LIKE '%Drive C:%'

AND OS_NAME like '%server%'

Below is how they are coming through now. I am trying to get Drive Size GB, Space Used GB, and % Free as headers rather than description,Mac Address, and IP are. 


Computer Name

System Description

MAC Address

IP Address



0 Comments   [ + ] Show comments

Comments


All Answers

0

Give this a go:

SELECT MACHINE.NAME,
D.NAME as "Disk Name", 
D.DISK_SIZE as 'Drive Size', 
D.DISK_USED as 'Space Used', 
round((D.DISK_FREE/D.DISK_SIZE)*100, 1) as '% Free'
FROM MACHINE
JOIN MACHINE_DISKS D on MACHINE.ID = D.ID
JOIN MACHINE_LABEL_JT on MACHINE_ID = MACHINE.ID
JOIN LABEL on LABEL.ID = LABEL_ID
WHERE 
D.NAME like "Drive C:%"
and D.PERCENT_USED > 85
AND LABEL.NAME = 'Special computers'


Answered 09/12/2019 by: chucksteel
Red Belt