MySQL Server 表缓存命中百分比监视器

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

Knowledge Base article:

摘要

与请求的锁数目相比,等待获取 MyISAM 表锁的次数所占百分比。MySQL 对 MyISAM、MEMORY 和 MERGE 表使用表级锁定。此监视器阈值是按照轮询过程中返回给代理的平均值分析的,其中“样本数”参数控制平均值计算中所包含的样本数。

原因

运行不正常状态表示表缓存命中率低。表缓存可能没有足够存储空间可用于保存打开的表。此外,过量的并发连接可导致表缓存存储空间急剧减小。

解决方案

要解决表命中百分比低的问题,可增大 table_cache size 以允许存储更多的表。

配置

默认配置

参数

默认值

警告阈值

小于 80

错误阈值

小于 70

样本数

3

替代可用于更改以上为所有实例或为特定实例或组定义的参数值。

Element properties:

TargetMicrosoft.MySQLServer.ManagedServer.Unix
Parent MonitorMicrosoft.MySQLServer.TableCachePerformanceRollup
CategoryPerformanceHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityMatchMonitorHealth
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.Oss.WSManEnumeration.LessThanThreshold.ThreeState.MonitorType
RemotableTrue
AccessibilityPublic
Alert Message
MySQL Server 表缓存命中百分比
MySQL Server 的当前表缓存命中百分比 ({0}\%) 低
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.MySQLServer.ManagedServer.Unix.TableCacheHitPct.Monitor" Accessibility="Public" Target="Microsoft.MySQLServer.ManagedServer.Unix" TypeID="Oss!Microsoft.Oss.WSManEnumeration.LessThanThreshold.ThreeState.MonitorType" Enabled="onStandardMonitoring" ParentMonitorID="Microsoft.MySQLServer.TableCachePerformanceRollup">
<Category>PerformanceHealth</Category>
<AlertSettings AlertMessage="Microsoft.MySQLServer.ManagedServer.Unix.TableCacheHitPct.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="OverThreshold"/>
<OperationalState HealthState="Warning" MonitorTypeStateID="StatusWarning" ID="UnderWarningThreshold"/>
<OperationalState HealthState="Error" MonitorTypeStateID="StatusError" ID="UnderErrorThreshold"/>
</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>Table Cache Hit 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(.)='TCacheHitPct']$</Value>
<WarningThreshold>80</WarningThreshold>
<ErrorThreshold>70</ErrorThreshold>
<NumSamples>3</NumSamples>
</Configuration>
</UnitMonitor>