MySQL 서버 연결 사용률 모니터

Microsoft.MySQLServer.ManagedServer.Unix.ConnectionsUsePct.Monitor (UnitMonitor)

Knowledge Base article:

요약

현재 사용 중인 MySQL 서버 연결 비율입니다. MySQL 서버에서는 전역 변수 max_connections에 설정된 수만큼만 연결을 허용합니다. 이 모니터는 상태 변수 ‘threads_connected’의 연결 수를 max_connections 변수로 나눕니다. 모니터 임계값은 에이전트에 대한 폴링에 반환된 평균 값에 대해 분석됩니다. 여기서 샘플 수 매개 변수가 평균 계산에 포함된 샘플 수를 제어합니다.

원인

비정상 상태는 MySQL 서버의 현재 연결 비율이 높음을 나타냅니다. 이 문제는 MySQL 서버에 대한 연결 수가 너무 많거나 연결이 잘못 닫히기 때문에 발생할 수 있습니다.

해결 방법

전역 변수 max_connections는 MySQL에 대한 최대 동시 연결 수를 결정합니다. 이 값을 더 큰 수로 조정하고 MySQL 서버를 다시 시작하는 것이 좋습니다. 이 수를 조정하면 클라이언트 연결에 영구 연결이 잘못 사용되지 않습니다. 모니터 임계값은 에이전트에 대한 폴링에 반환된 평균 값에 대해 분석됩니다. 여기서 샘플 수 매개 변수가 평균 계산에 포함된 샘플 수를 제어합니다.

구성

기본 구성

매개 변수

기본값

경고 임계값

80보다 큼

오류 임계값

90보다 큼

샘플 수

3

모든 인스턴스나 특정 인스턴스 또는 그룹에 대해 위에서 정의한 매개 변수 값을 변경하는 데 재정의를 사용할 수 있습니다.

Element properties:

TargetMicrosoft.MySQLServer.ManagedServer.Unix
Parent MonitorMicrosoft.MySQLServer.ConnectionsPerformanceRollup
CategoryPerformanceHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityMatchMonitorHealth
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.Oss.WSManEnumeration.GreaterThanThreshold.ThreeState.MonitorType
RemotableTrue
AccessibilityPublic
Alert Message
MySQL 서버 연결 사용률
MySQL 서버에 대한 현재 연결 사용률({0}\%)이 높습니다.
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.MySQLServer.ManagedServer.Unix.ConnectionsUsePct.Monitor" Accessibility="Public" Target="Microsoft.MySQLServer.ManagedServer.Unix" TypeID="Oss!Microsoft.Oss.WSManEnumeration.GreaterThanThreshold.ThreeState.MonitorType" Enabled="onStandardMonitoring" ParentMonitorID="Microsoft.MySQLServer.ConnectionsPerformanceRollup">
<Category>PerformanceHealth</Category>
<AlertSettings AlertMessage="Microsoft.MySQLServer.ManagedServer.Unix.ConnectionsUsePct.AlertMessage">
<AlertOnState>Warning</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>MatchMonitorHealth</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Data/Context/Value$</AlertParameter1>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState HealthState="Success" MonitorTypeStateID="StatusOK" ID="UnderThreshold"/>
<OperationalState HealthState="Warning" MonitorTypeStateID="StatusWarning" ID="OverWarningThreshold"/>
<OperationalState HealthState="Error" MonitorTypeStateID="StatusError" ID="OverErrorThreshold"/>
</OperationalStates>
<Configuration>
<Interval>300</Interval>
<TargetSystem>$Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$</TargetSystem>
<Uri>http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/MySQL_ServerStatistics?__cimnamespace=root/mysql</Uri>
<WSManFilter/>
<ObjectName>MySQL Server</ObjectName>
<CounterName>Connection Use Pct</CounterName>
<InstanceXPath>/DataItem/WsManData/*[local-name(.)='MySQL_ServerStatistics']/*[local-name(.)='InstanceID']</InstanceXPath>
<InstanceName>$Target/Property[Type="Microsoft.MySQLServer.Installation"]/InstanceID$</InstanceName>
<Value>$Data/WsManData/*[local-name(.)='MySQL_ServerStatistics']/*[local-name(.)='ConnectionsUsePct']$</Value>
<WarningThreshold>80</WarningThreshold>
<ErrorThreshold>90</ErrorThreshold>
<NumSamples>3</NumSamples>
</Configuration>
</UnitMonitor>