天天看點

SQL Server 性能基線和監控

就講講監控那些值,基線抓的是那些值。如何做告警

環境:windows 2008r2,sql server 2008r2 sp1

性能基線:

  cpu:

    \Processor(_Total)\% Processor Time

\Processor(_Total)\% Privileged Time

    \SQLServer:SQL Statistics\Batch Requests/sec

\SQLServer:SQL Statistics\SQL Compilations/sec

\SQLServer:SQL Statistics\SQL Re-Compilations/sec

\System\Processor Queue Length

\System\Context Switches/sec

  Memory:

    \Memory\Available Bytes

\Memory\Pages/sec

\Memory\Page Faults/sec

\Memory\Pages Input/sec

\Memory\Pages Output/sec

\Process(sqlservr)\Private Bytes

\SQLServer:Buffer Manager\Buffer cache hit ratio

\SQLServer:Buffer Manager\Page life expectancy

\SQLServer:Buffer Manager\Lazy writes/sec

\SQLServer:Memory Manager\Memory Grants Pending

\SQLServer:Memory Manager\Target Server Memory (KB)

\SQLServer:Memory Manager\Total Server Memory (KB)

  Disk:

    \PhysicalDisk(_Total)\% Disk Time

\PhysicalDisk(_Total)\Current Disk Queue Length

\PhysicalDisk(_Total)\Avg. Disk Queue Length

\PhysicalDisk(_Total)\Disk Transfers/sec

\PhysicalDisk(_Total)\Disk Bytes/sec

\PhysicalDisk(_Total)\Avg. Disk sec/Read

\PhysicalDisk(_Total)\Avg. Disk sec/Write

  SQL Server:

    \SQLServer:Access Methods\FreeSpace Scans/sec

\SQLServer:Access Methods\Full Scans/sec

\SQLServer:Access Methods\Table Lock Escalations/sec

\SQLServer:Access Methods\Worktables Created/sec

\SQLServer:General Statistics\Processes blocked

\SQLServer:General Statistics\User Connections

\SQLServer:Latches\Total Latch Wait Time (ms)

\SQLServer:Locks(_Total)\Lock Timeouts (timeout > 0)/sec

\SQLServer:Locks(_Total)\Lock Wait Time (ms)

\SQLServer:Locks(_Total)\Number of Deadlocks/sec

\SQLServer:SQL Statistics\Batch Requests/sec

以上是性能基線監控的資訊,當然性能警告也是監控這些資訊,其中的閥值是根據基線抓取後展現。

關于性能警告我是使用powershell 寫了一個腳本,運作在SQL Agent 中。如果出現警告,就通過dbmail 發送郵件

關于powershell 腳本和一些配置資訊看如下:

<a></a>

其中涉及到2個配置檔案:computernamexml,alter_cpuxml分别如下:

其中 alter 就是閥值,如第一條,如果 閥值 &gt; 性能計數器值,就會發出警告。

    本文轉自 Fanr_Zh 部落格園部落格,原文連結:http://www.cnblogs.com/Amaranthus/archive/2012/05/18/2507189.html,如需轉載請自行聯系原作者