Permalink
Browse files

Add smarter threshold for PLE alert in the Dashboard

  • Loading branch information...
gboge committed Oct 17, 2017
1 parent 907fea4 commit 8d6e13b48416aaaca4e21011bfe28e088934e3bd
Showing with 11 additions and 3 deletions.
  1. +11 −3 KServer.cs
View
@@ -1240,10 +1240,18 @@ public static DataTable DashboardGetLocks(this smo.Server s, int durationInMinut
public static DataTable DashboardPle(this smo.Server s)
{
smo.Database d = s.Databases["master"];
string sql = @"SELECT[cntr_value] as PLE
FROM sys.dm_os_performance_counters (NOLOCK)
string sql = @"CREATE TABLE #MSVER(ID INT, Name SYSNAME, Internal_Value INT, Value NVARCHAR(512))
INSERT INTO #MSVER EXEC master.dbo.xp_msver
SELECT opc.cntr_value as PLE
, CASE WHEN c.value_in_use < t.Internal_Value THEN c.value_in_use ELSE t.Internal_Value END AS value_in_use
FROM sys.dm_os_performance_counters opc (NOLOCK)
CROSS APPLY sys.configurations c
CROSS APPLY #MSVER t
WHERE object_name LIKE '%Manager%'
AND counter_name = 'Page life expectancy'";
AND counter_name = 'Page life expectancy'
AND c.name LIKE 'max server memory%'
AND t.Name = N'PhysicalMemory'
DROP TABLE #MSVER";
return d.ExecuteWithResults(sql).Tables[0];
}

0 comments on commit 8d6e13b

Please sign in to comment.