Notification

Icon
Error

Reporting on low HDD space for 2 servers

Posted: Friday, June 26, 2020 4:41:18 PM(UTC)
Samuel1222

Samuel1222

Member Original PosterPosts: 2
0
Like
Hey, I'm trying to make an alert / report for two servers in the case that they get low disk space.

The report I have right now doesn't seem to care about the free space left and just shows all of the drives, as well as only showing one server instead of both via IP. Please see below

Code:
Select Top 1000000 tsysOS.Image As icon,
  tblAssets.AssetID,
  tblAssets.AssetName,
  tblAssets.Domain,
  tblAssets.IPAddress,
  tblDiskdrives.Caption,
  Ceiling(tblDiskdrives.Freespace / 1024 / 1024 / 1024) As FreeGB,
  Ceiling((tblDiskdrives.Size / 1024 / 1024 / 1024) - (tblDiskdrives.Freespace /
  1024 / 1024 / 1024)) As UsedGB,
  Ceiling(tblDiskdrives.Size / 1024 / 1024 / 1024) As TotalGB,
  tblAssets.Lastseen
From tblAssets
  Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
  Inner Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
  Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
  Inner Join tblDiskdrives On tblAssets.AssetID = tblDiskdrives.AssetID
Where (tblAssets.IPAddress Like '192.168.1.31') Or
  (tblAssets.IPAddress Like '192.168.1.34' And Cast(tblDiskdrives.Freespace /
  1024 / 1024 / 1024 As numeric) < 100 And Cast(tblDiskdrives.Size / 1024 /
  1024 / 1024 As numeric) <> 0 And Cast(tblDiskdrives.Size / 1024 / 1024 /
  1024 As numeric) > 10 And tblAssetCustom.State = 1 And
  tblDiskdrives.DriveType = 3)
Order By tblAssets.Domain,
  tblAssets.AssetName,
  tblDiskdrives.Caption
RC62N
#1RC62N Member Posts: 450  
posted: 6/26/2020 6:03:40 PM(UTC)
Step 1 would be to adjust the logic in your WHERE clause. Change it from
Code:
Where
  (tblAssets.IPAddress Like '192.168.1.31')
  Or ( tblAssets.IPAddress Like '192.168.1.34'
       And Cast(tblDiskdrives.Freespace / 1024 / 1024 / 1024 As numeric) < 100
       And Cast(tblDiskdrives.Size / 1024 / 1024 / 1024 As numeric) <> 0
       And Cast(tblDiskdrives.Size / 1024 / 1024 / 1024 As numeric) > 10
       And tblAssetCustom.State = 1
       And tblDiskdrives.DriveType = 3
     )
to
Code:
Where
  (tblAssets.IPAddress Like '192.168.1.31' Or tblAssets.IPAddress Like '192.168.1.34')
  And Cast(tblDiskdrives.Freespace / 1024 / 1024 / 1024 As numeric) < 100
  And Cast(tblDiskdrives.Size / 1024 / 1024 / 1024 As numeric) <> 0
  And Cast(tblDiskdrives.Size / 1024 / 1024 / 1024 As numeric) > 10
  And tblAssetCustom.State = 1
  And tblDiskdrives.DriveType = 3
Samuel1222
#2Samuel1222 Member Original PosterPosts: 2  
posted: 6/26/2020 8:32:47 PM(UTC)
Hell yeah man that's perfect! Thank you

Active Discussions

Lansweeper Software List by Computer/Server Name
by  Andy.S  
Go to last post Go to first unread
Last post: Yesterday at 8:06:43 AM(UTC)
Lansweeper Asset: Duplicate Serial Number (Built-in)
by  brodiemac-too   Go to last post Go to first unread
Last post: 8/5/2020 1:28:56 PM(UTC)
Lansweeper A Simple Report (or so I thought)
by  Andy.S  
Go to last post Go to first unread
Last post: 8/5/2020 11:30:45 AM(UTC)
Lansweeper Paid Report Writer Service
by  endyk   Go to last post Go to first unread
Last post: 8/4/2020 11:56:20 AM(UTC)
Lansweeper Multiple Computers per User
by  brodiemac-too  
Go to last post Go to first unread
Last post: 7/30/2020 12:43:38 PM(UTC)
Lansweeper Workstations with No AV
by  brodiemac-too   Go to last post Go to first unread
Last post: 7/29/2020 7:44:53 PM(UTC)
Lansweeper AV Audit Report
by  RC62N  
Go to last post Go to first unread
Last post: 7/29/2020 5:17:42 PM(UTC)