Notification

Icon
Error

Top 5 CPU utilization

Posted: Tuesday, April 23, 2019 10:17:49 AM(UTC)
Esben.D

Esben.D

Member Administration Original PosterPosts: 1,631
0
Like
This report is also highlighted in this blog post.

The report gives a top 5 of assets which have the highest average CPU usage as scanned by the performance counters. Please note that performance counter scanning has to be manually enabled. Additionally, this feature is only available in Lansweeper 7.1 or higher.

Code:
Select Top 5 tblAssets.AssetID,
  tblAssets.AssetName,
  Cast(Avg(tblPerformanceCountersScanMetric.Value) As int) As
  [Average CPU usage in %],
  Coalesce(tsysOS.Image, tsysAssetTypes.AssetTypeIcon10) As icon,
  Max(tblPerformanceCountersScan.ScanDateTime) As [Last scan]
From tblAssets
  Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
  Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
  Inner Join tblPerformanceCountersScan On tblAssets.AssetID =
    tblPerformanceCountersScan.AssetId
  Inner Join tblPerformanceCountersScanMetric On tblPerformanceCountersScan.Id =
    tblPerformanceCountersScanMetric.PerformanceCountersScanId
  Left Join tblPerformanceCountersScanMetricIdentifier On
    tblPerformanceCountersScanMetricIdentifier.Id =
    tblPerformanceCountersScanMetric.PerformanceCountersScanMetricIdentifierId
  Inner Join tsysPerformanceCounterMetric On tsysPerformanceCounterMetric.Id =
    tblPerformanceCountersScanMetric.Metric
  Left Join tsysOS On tsysOS.OScode = tblAssets.OScode
Where tsysPerformanceCounterMetric.[Group] = 'CPU' And tblAssetCustom.State = 1
Group By tblAssets.AssetID,
  tblAssets.AssetName,
  Coalesce(tsysOS.Image, tsysAssetTypes.AssetTypeIcon10)
Having Max(tblPerformanceCountersScan.ScanDateTime) > GetDate() - 7
Order By [Average CPU usage in %] Desc
no1welshboyo
#1no1welshboyo Member Posts: 2  
posted: 4/24/2019 10:04:47 AM(UTC)
Hi,

Whenever I try and create this report I get the following error message

"In aggregate and grouping expressions, the ORDER BY clause can contain only aggregate functions and grouping expressions"

Any ideas what is wrong?

Many thanks
Esben.D
#2Esben.D Member Administration Original PosterPosts: 1,631  
posted: 4/24/2019 10:43:04 AM(UTC)
It was a typo at the end of the report. I've updated the original.
no1welshboyo
#3no1welshboyo Member Posts: 2  
posted: 4/24/2019 10:52:35 AM(UTC)
Thats great that works now thank you!

Active Discussions

Lansweeper Update DNS record
by  Lewis_Spokane   Go to last post Go to first unread
Last post: Today at 12:17:26 AM(UTC)
Lansweeper Trigger deploy when seen
by  bbazian  
Go to last post Go to first unread
Last post: Yesterday at 9:13:02 PM(UTC)
Lansweeper Restoring server from backup, retaining Lansweeper
by  JacobH   Go to last post Go to first unread
Last post: Yesterday at 8:48:39 PM(UTC)
Lansweeper LSAgent has forgotten x64 Windows applications
by  Esben.D  
Go to last post Go to first unread
Last post: Yesterday at 3:37:55 PM(UTC)
Lansweeper Not finding some switches on IP range scan
by  acstanley   Go to last post Go to first unread
Last post: Yesterday at 1:23:36 PM(UTC)
Lansweeper Generate report based upon filter?
by  pryan67  
Go to last post Go to first unread
Last post: Yesterday at 1:20:58 PM(UTC)
Lansweeper LsAgent on Ubuntu 18.04 - Not getting updated in the console
by  rpokkyarath   Go to last post Go to first unread
Last post: Yesterday at 10:15:22 AM(UTC)
Lansweeper Auditing deletes
by  B.L.  
Go to last post Go to first unread
Last post: Yesterday at 9:48:45 AM(UTC)