Skip to content

Commit 7943558

Browse files
authored
Create Noisiest-Monitor.sql
1 parent 93f4e04 commit 7943558

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-- Top 50 noisiest monitor
2+
select distinct top 50 count(sce.StateId) as NumStateChanges,
3+
bme.DisplayName AS ObjectName,
4+
bme.Path,
5+
m.DisplayName as MonitorDisplayName,
6+
m.Name as MonitorIdName,
7+
mt.typename AS TargetClass,
8+
MP.MPName
9+
from StateChangeEvent sce with (nolock)
10+
join state s with (nolock) on sce.StateId = s.StateId
11+
join BaseManagedEntity bme with (nolock) on s.BasemanagedEntityId = bme.BasemanagedEntityId
12+
join MonitorView m with (nolock) on s.MonitorId = m.Id
13+
join managedtype mt with (nolock) on m.TargetMonitoringClassId = mt.ManagedTypeId
14+
join ManagementPack MP with (nolock) on MP.ManagementPackId = M.ManagementPackId
15+
where m.IsUnitMonitor = 1
16+
-- Scoped to specific Monitor (remove the "–" below):
17+
-- AND m.MonitorName like (‘%HealthService%’)
18+
-- Scoped to specific Computer (remove the "–" below): sql
19+
-- AND bme.Path like (‘%sql%’)
20+
-- Scoped to within last 7 days
21+
AND sce.TimeGenerated > dateadd(dd,-3,getutcdate())
22+
group by s.BasemanagedEntityId,bme.DisplayName,bme.Path,m.DisplayName,m.Name,mt.typename, MP.MPName
23+
order by NumStateChanges desc

0 commit comments

Comments
 (0)