Skip to content

Commit

Permalink
Upload SCOM Data Collector Queries.
Browse files Browse the repository at this point in the history
  • Loading branch information
Blake Drumm committed Aug 12, 2021
1 parent 5274eb4 commit 0f19c9a
Show file tree
Hide file tree
Showing 99 changed files with 1,560 additions and 5 deletions.
Binary file modified .vs/slnx.sqlite
Binary file not shown.
24 changes: 24 additions & 0 deletions SQL Queries/Data Warehouse/ConfigChurn_DW.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
select ManagedEntityTypeSystemName, DiscoverySystemName, count(*) As 'Changes'
from
(select distinct
MP.ManagementPackSystemName,
MET.ManagedEntityTypeSystemName,
PropertySystemName,
D.DiscoverySystemName, D.DiscoveryDefaultName,
MET1.ManagedEntityTypeSystemName As 'TargetTypeSystemName', MET1.ManagedEntityTypeDefaultName 'TargetTypeDefaultName',
ME.Path, ME.Name,
C.OldValue, C.NewValue, C.ChangeDateTime
from dbo.vManagedEntityPropertyChange C
inner join dbo.vManagedEntity ME on ME.ManagedEntityRowId=C.ManagedEntityRowId
inner join dbo.vManagedEntityTypeProperty METP on METP.PropertyGuid=C.PropertyGuid
inner join dbo.vManagedEntityType MET on MET.ManagedEntityTypeRowId=ME.ManagedEntityTypeRowId
inner join dbo.vManagementPack MP on MP.ManagementPackRowId=MET.ManagementPackRowId
inner join dbo.vManagementPackVersion MPV on MPV.ManagementPackRowId=MP.ManagementPackRowId
left join dbo.vDiscoveryManagementPackVersion DMP on DMP.ManagementPackVersionRowId=MPV.ManagementPackVersionRowId
AND CAST(DefinitionXml.query('data(/Discovery/DiscoveryTypes/DiscoveryClass/@TypeID)') AS nvarchar(max)) like '%'+MET.ManagedEntityTypeSystemName+'%'
left join dbo.vManagedEntityType MET1 on MET1.ManagedEntityTypeRowId=DMP.TargetManagedEntityTypeRowId
left join dbo.vDiscovery D on D.DiscoveryRowId=DMP.DiscoveryRowId
where ChangeDateTime > dateadd(hh,-24,getutcdate())
) As #T
group by ManagedEntityTypeSystemName, DiscoverySystemName
order by count(*) DESC
25 changes: 25 additions & 0 deletions SQL Queries/Data Warehouse/ConfigChurn_Properties_DW.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
select distinct
ME.Path,
ME.Name,
MET.ManagedEntityTypeSystemName,
PropertySystemName,
C.OldValue,
C.NewValue,
C.ChangeDateTime,
MP.ManagementPackSystemName,
D.DiscoverySystemName,
D.DiscoveryDefaultName,
MET1.ManagedEntityTypeSystemName As 'TargetTypeSystemName',
MET1.ManagedEntityTypeDefaultName 'TargetTypeDefaultName'
from dbo.vManagedEntityPropertyChange C
inner join dbo.vManagedEntity ME on ME.ManagedEntityRowId=C.ManagedEntityRowId
inner join dbo.vManagedEntityTypeProperty METP on METP.PropertyGuid=C.PropertyGuid
inner join dbo.vManagedEntityType MET on MET.ManagedEntityTypeRowId=ME.ManagedEntityTypeRowId
inner join dbo.vManagementPack MP on MP.ManagementPackRowId=MET.ManagementPackRowId
inner join dbo.vManagementPackVersion MPV on MPV.ManagementPackRowId=MP.ManagementPackRowId
left join dbo.vDiscoveryManagementPackVersion DMP on DMP.ManagementPackVersionRowId=MPV.ManagementPackVersionRowId
AND CAST(DefinitionXml.query('data(/Discovery/DiscoveryTypes/DiscoveryClass/@TypeID)') AS nvarchar(max)) like '%'+MET.ManagedEntityTypeSystemName+'%'
left join dbo.vManagedEntityType MET1 on MET1.ManagedEntityTypeRowId=DMP.TargetManagedEntityTypeRowId
left join dbo.vDiscovery D on D.DiscoveryRowId=DMP.DiscoveryRowId
where ChangeDateTime > dateadd(hh,-24,getutcdate())
ORDER BY ChangeDateTime DESC
13 changes: 13 additions & 0 deletions SQL Queries/Data Warehouse/DW_AggregationHistory.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SELECT ds.DatasetDefaultName,
sdah.AggregationDateTime,
sdah.AggregationTypeId,
sdah.FirstAggregationStartDateTime,
sdah.FirstAggregationDurationSeconds,
sdah.LastAggregationStartDateTime,
sdah.LastAggregationDurationSeconds,
sdah.DirtyInd,
sdah.DataLastReceivedDateTime,
sdah.AggregationCount
FROM StandardDatasetAggregationHistory sdah
JOIN Dataset ds ON sdah.DatasetId = ds.DatasetId
ORDER BY StandardDatasetAggregationHistoryRowId DESC
29 changes: 29 additions & 0 deletions SQL Queries/Data Warehouse/DW_AggregationStatus.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
WITH AggregationInfo AS (
SELECT
AggregationType = CASE
WHEN AggregationTypeId = 0 THEN 'Raw'
WHEN AggregationTypeId = 20 THEN 'Hourly'
WHEN AggregationTypeId = 30 THEN 'Daily'
ELSE NULL
END
,AggregationTypeId
,MIN(AggregationDateTime) as 'TimeUTC_NextToAggregate'
,COUNT(AggregationDateTime) as 'Count_OutstandingAggregations'
,DatasetId
FROM StandardDatasetAggregationHistory
WHERE LastAggregationDurationSeconds IS NULL
GROUP BY DatasetId, AggregationTypeId
)
SELECT
SDS.SchemaName
,AI.AggregationType
,AI.TimeUTC_NextToAggregate
,Count_OutstandingAggregations
,SDA.MaxDataAgeDays
,SDA.LastGroomingDateTime
,SDS.DebugLevel
,AI.DataSetId
FROM StandardDataSet AS SDS WITH(NOLOCK)
JOIN AggregationInfo AS AI WITH(NOLOCK) ON SDS.DatasetId = AI.DatasetId
JOIN dbo.StandardDatasetAggregation AS SDA WITH(NOLOCK) ON SDA.DatasetId = SDS.DatasetId AND SDA.AggregationTypeID = AI.AggregationTypeID
ORDER BY SchemaName DESC
Loading

0 comments on commit 0f19c9a

Please sign in to comment.