이 문서에서는 운영 데이터베이스에서 모니터링 데이터를 쿼리하고 Azure Managed Grafana에서 대시보드를 만드는 방법을 설명합니다.
Azure Monitor SCOM 관리되는 인스턴스에 연결된 Azure Managed Grafana에서 SQL 쿼리를 사용하여 Azure Monitor SCOM 관리되는 인스턴스에 저장된 운영 데이터베이스에서 모니터링되는 데이터를 가져올 수 있습니다.
필수 조건
Azure Managed Grafana 포털에서 모니터링 데이터를 쿼리하기 전에 SCOM 관리되는 인스턴스가 Azure Managed Grafana에 연결되어 있는지 확인합니다. 자세한 내용은 Azure Managed Grafana의 대시보드를 참조하세요.
Azure/SCOM 관리되는 인스턴스/운영 대시보드에서 Azure Managed Grafana 인스턴스의 요구 사항에 따라 가져오고 편집할 수 있는 즉시 사용 가능한 대시보드는 거의 없습니다.
Azure Managed Grafana에서 대시보드 만들기
대시보드를 만들려면 다음 단계를 수행합니다.
- Grafana로 이동하고 시각화 추가를 선택합니다. 사용 가능한 옵션에 따라 시각화 유형을 선택할 수 있습니다.
- 패널 옵션에서 제목 및 설명을 입력합니다.
- 쿼리 아래에서 코드를 선택하고 쿼리를 입력합니다.
- 쿼리 실행을 선택합니다.
샘플 쿼리
다음은 SCOM 관리되는 인스턴스에서 Azure Managed Grafana 사용을 시작하기 위한 몇 가지 유용한 샘플 쿼리 및 대시보드입니다.
- 워크로드의 상태
- 워크로드 상태 및 새 경고 수
- 워크로드에 대한 상위 이벤트
- 워크로드의 상위 경고
- 워크로드 카운터에 대한 성능 데이터 쿼리
다음 쿼리는 특정 워크로드/모니터링 개체에서 상태, 경고 및 상위 이벤트를 빌드하는 데 도움이 됩니다.
참고 항목
- <관리 팩 이름 접두사>를 실제 관리 팩 이름(예: SQL 워크로드의 경우 Microsoft.SQL%)으로 바꿉니다.
- <모니터링 개체 형식>을 구성 요소 클래스(예: SQL Server 역할의 경우 %.DBEngine)로 바꿉니다.
워크로드의 상태
SELECT HealthState =
CASE
WHEN MEV.HealthState = 1 THEN 'Healthy'
WHEN MEV.HealthState = 2 THEN 'Warning'
WHEN MEV.HealthState = 3 THEN 'Critical'
ELSE 'Uninitialized'
END,
CAST(COUNT(*) AS DECIMAL(5, 2)) AS servers
FROM ${Database}.[dbo].[ManagedEntityGenericView] MEV
INNER JOIN ${Database}.[dbo].[ManagedTypeView] MTV ON MTV.Id = MEV.MonitoringClassId and MTV.name like '%.<Monitoring Object Type>'
INNER JOIN ${Database}.[dbo].[ManagementPackView] MPV ON MPV.Id = MTV.ManagementPackId and MPV.name like '<MP name Prefix>'
GROUP BY MEV.HealthState
ORDER BY MEV.HealthState
워크로드 상태 및 새 경고 수
SELECT MEV.Name
,HealthState =
CASE
WHEN MEV.HealthState = 1 THEN 'Healthy'
WHEN MEV.HealthState = 2 THEN 'Warning'
WHEN MEV.HealthState = 3 THEN 'Critical'
ELSE 'Uninitialized'
END
,NewAlerts = COUNT(AV.ResolutionState)
FROM ${Database}.[dbo].[ManagedEntityGenericView] MEV
INNER JOIN ${Database}.[dbo].[ManagedTypeView] MTV ON MTV.Id = MEV.MonitoringClassId and MTV.name like '%.<Monitoring Object Type>'
INNER JOIN ${Database}.[dbo].[ManagementPackView] MPV ON MPV.Id = MTV.ManagementPackId and MPV.name like '%<MP name prefix>%'
INNER JOIN ${Database}.[dbo].[AlertView] AV ON AV.MonitoringClassId = MTV.Id and AV.ResolutionState = 0 AND $__timeFilter(TimeRaised)
GROUP BY MEV.Name, HealthState, AV.ResolutionState
워크로드에 대한 상위 이벤트
SELECT EventDescription = LT5.LTValue
,Count(*) Occurences
,AffectedSQLServers = Count(DISTINCT(EV.LoggingComputer))
FROM ${Database}.[dbo].[EventView] EV
INNER JOIN ${Database}.[dbo].[ManagedTypeView] MTV ON MTV.Id = EV.ClassId
INNER JOIN ${Database}.[dbo].[ManagementPackView] MPV ON MPV.Id = MTV.ManagementPackId and MPV.name like '%<MP Name Prefix>%'
INNER JOIN ${Database}.dbo.LocalizedText LT5 ON EV.EventNumberStringId = LT5.LTStringId AND LT5.LanguageCode = 'ENU'
WHERE $__timeFilter(TimeGenerated) AND LevelId < 3
GROUP BY Number, LT5.LTValue
ORDER BY Occurences, AffectedSQLServers DESC;
워크로드의 상위 경고
SELECT AV.AlertStringName AS Alert
,Occurrence = COUNT(AV.ResolutionState)
,AffectedServers = COUNT(MEV.name)
FROM ${Database}.[dbo].[AlertView] AV
INNER JOIN ${Database}.[dbo].[ManagedTypeView] MTV ON MTV.Id = AV.MonitoringClassId and MTV.name like '%<Monitoring Object Type>'
INNER JOIN ${Database}.[dbo].[ManagementPackView] MPV ON MPV.Id = MTV.ManagementPackId and MPV.name like '%M<MP Name Prefix>%'
INNER JOIN ${Database}.[dbo].[ManagedEntityGenericView] MEV ON MTV.Id = MEV.MonitoringClassId
where AV.ResolutionState = 0 and $__timeFilter(TimeRaised)
GROUP BY AV.AlertStringName, AV.ResolutionState
워크로드 카운터에 대한 성능 데이터 쿼리
SELECT PD.TimeSampled
,CASE
WHEN BME.Path IS NOT NULL AND BME.Path <> '' THEN CONCAT(BME.Path, '\', COALESCE(BME.Name, ''))
ELSE COALESCE(BME.Name, '') END AS TagetObjectPath
,ObjectName = PC.ObjectName
,CounterName = PC.CounterName
,Value = PD.SampleValue
FROM dbo.PerformanceDataAllView PD
INNER JOIN dbo.PerformanceSource PS ON PD.PerformanceSourceInternalId = PS.PerformanceSourceInternalId
INNER JOIN dbo.PerformanceCounter PC ON PS.PerformanceCounterId = PC.PerformanceCounterId and CounterName = 'Receive I/Os/sec'
INNER JOIN dbo.BaseManagedEntity BME ON PS.BaseManagedEntityId = BME.BaseManagedEntityId AND BME.IsDeleted = 0
INNER JOIN [dbo].[ManagedTypeView] MTV ON MTV.Id = BME.BaseManagedTypeId
INNER JOIN [dbo].[ManagementPackView] MPV ON MPV.Id = MTV.ManagementPackId and MPV.name like 'Microsoft.SQL%'