MySQL Server 键缓存使用百分比监视器

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

Knowledge Base article:

摘要

正在使用的键缓存的百分比。MyISAM 键缓存是一种数据结构,其中包含最常用的索引块。可使用全局变量 "key_buffer_size" 控制键缓存的大小。此监视器阈值是按照轮询过程中返回给代理的平均值分析的,其中“样本数”参数控制平均值计算中所包含的样本数。

原因

运行不正常状态表示使用中的键缓存百分比高。键缓存没有足够空间可用于存储最近使用的键块,并将继续丢弃最近最少使用的键块。

解决方案

要解决键缓存使用百分比高的问题,可增大配置文件中的 key_buffer_size 变量。要完成此操作,可在实例组选项下添加下面的行以及大小:“key_buffer_size=size”。或者,服务器可以以下面的选项开始:"--key_buffer_size=size"

配置

默认配置

参数

默认值

警告阈值

大于 70

错误阈值

大于 85

样本数

3

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

Element properties:

TargetMicrosoft.MySQLServer.ManagedServer.Unix
Parent MonitorMicrosoft.MySQLServer.KeyCachePerformanceRollup
CategoryPerformanceHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityMatchMonitorHealth
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.Oss.WSManEnumeration.GreaterThanThreshold.ThreeState.MonitorType
RemotableTrue
AccessibilityPublic
Alert Message
MySQL Server 键缓存使用百分比
MySQL Server 的当前键缓存使用百分比 ({0}\%) 高
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.MySQLServer.ManagedServer.Unix.KeyCacheUsePct.Monitor" Accessibility="Public" Target="Microsoft.MySQLServer.ManagedServer.Unix" TypeID="Oss!Microsoft.Oss.WSManEnumeration.GreaterThanThreshold.ThreeState.MonitorType" Enabled="onStandardMonitoring" ParentMonitorID="Microsoft.MySQLServer.KeyCachePerformanceRollup">
<Category>PerformanceHealth</Category>
<AlertSettings AlertMessage="Microsoft.MySQLServer.ManagedServer.Unix.KeyCacheUsePct.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>Key Cache 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(.)='KeyCacheUsePct']$</Value>
<WarningThreshold>70</WarningThreshold>
<ErrorThreshold>85</ErrorThreshold>
<NumSamples>3</NumSamples>
</Configuration>
</UnitMonitor>