Skip to content

Windows Counters

0. Overview MetricsWindows

UID: windows_countersVersion: 1.3.1 Panels: ~35 Datasource: InfluxDB (Telegraf)

Purpose

This dashboard shows key Windows performance counters for monitoring:

  • CPU: Processor usage and distribution
  • Memory: Available and used RAM
  • Disk: Free space and I/O operations
  • Network: Incoming and outgoing network traffic

This panel provides a real-time view of operating system resource consumption to correlate SQL Server performance with host-level activity.

Importance for SQL Server

SQL Server depends directly on the Windows operating system for access to CPU, memory, disk, and network. A problem at the Windows level always impacts SQL Server performance, making this dashboard essential for complete diagnostics.

Variables

VariableDescriptionQuery
$hostnameHostname of the server to monitorSHOW TAG VALUES FROM "win_cpu" WITH KEY = "host"

Color Codes

ColorCodeMeaning
Green#00db88Correct - Optimal state
Magenta#ad21d8e8To Check - Review
Red#F2495CWrong - Critical state

Sections

Overview

General information about the selected server.


Telegraf Version stat

Telegraf version installed on the server.

Importance: Telegraf is the agent that collects operating system metrics. An outdated version may have known bugs, security issues, or lack important new metrics. Keeping Telegraf updated ensures the accuracy and availability of monitoring data.

Color mapping:

VersionColorNote
1.30.0GreenUpdated version
1.25.0MagentaUpdate available
Others-Verify

Uptime stat

Time elapsed since the last server startup.

Importance: Low uptime indicates a recent server restart. This is critical for SQL Server because:

  • The buffer pool is completely emptied after a restart
  • Cached execution plans are lost
  • Performance statistics are reset
  • Active connections are interrupted

After a restart, SQL Server needs time to "warm up" its cache, which can cause temporary performance degradation.

Thresholds:

ValueColorStatus
< 2 daysRedRecent restart
>= 2 daysGreenNormal

CPU Count stat

Number of CPU cores on the server.

Importance: The number of cores directly affects SQL Server's parallel processing capacity:

  • SQL Server uses schedulers (one per logical core by default)
  • Queries with parallel operators benefit from more cores
  • SQL Server licensing is core-based
  • The max degree of parallelism parameter should be configured based on available cores

CPU Usage gauge

Current CPU usage percentage.

Importance: CPU usage is one of the most critical indicators for SQL Server:

  • Sustained high CPU indicates inefficient queries or excessive load
  • SQL Server competes with other system processes for CPU
  • 100% CPU causes SOS_SCHEDULER_YIELD wait types
  • Directly affects query response times

Correlation with SQL Server: When CPU is high, check in SQL Server:

  • Queries with high cpu_time in sys.dm_exec_requests
  • Inefficient execution plans (table scans, missing indexes)
  • Excessive plan recompilations

Thresholds:

ValueColorStatus
< 70%GreenNormal
70% - 90%OrangeReview load
> 90%RedCritical

Processes stat

Total number of processes running on the server.

Importance: An excessive number of processes may indicate:

  • Unnecessary software installed on the database server
  • Zombie or orphan processes consuming resources
  • Non-essential services that should be disabled

Microsoft recommends keeping SQL Server servers dedicated with minimal additional software to maximize available resources.


Memory

Free Memory stat

Remaining free memory on the server.

Importance: Windows free memory is critical for SQL Server:

  • SQL Server uses memory for the buffer pool (data cache)
  • Too little free memory can cause Windows to page to disk
  • Paging to disk severely degrades SQL Server performance
  • Windows needs memory for the operating system, services, and other applications

Correlation with SQL Server: If there is low free memory:

  • Verify the max server memory configuration in SQL Server
  • Review the Page Life Expectancy (PLE)
  • Look for excessive memory grants in queries
  • Evaluate if there is internal or external memory pressure

Thresholds:

ValueColorStatus
< 1 GBRedCritical
1 GB - 2 GBOrangeReview
> 2 GBGreenNormal

Critical Configuration

SQL Server should have max server memory configured to leave at least 4-6 GB free for Windows on dedicated servers. Without this configuration, SQL Server can consume all available memory.


Total Memory stat

Total memory assigned to the server.

Importance: Total memory determines the maximum size of the SQL Server buffer pool:

  • More memory = more cached data = fewer disk reads
  • SQL Server Standard Edition has a 128 GB buffer pool limit
  • Total memory should be sized according to active database sizes

Disk

Disk Free Space (%) bargauge

Percentage of free space on each server disk.

Importance: Disk free space is vital for SQL Server:

  • Data files (MDF/NDF) and logs (LDF) grow based on activity
  • TempDB can grow significantly with complex queries
  • Backups require temporary space
  • Without space, SQL Server cannot write and transactions fail

Correlation with SQL Server: Monitor especially:

  • Data disk: database growth
  • Log disk: large transactions, log shipping
  • TempDB disk: queries with sorts, hash joins, versioning
  • Backup disk: backup retention

Thresholds:

ValueColorStatus
< 10%RedCritical - very low space
10% - 20%OrangeReview
> 20%GreenNormal

Recommendation

It is recommended to maintain at least 20% free space on each disk to avoid performance issues and allow growth of data and log files. On SSD drives, free space also affects write performance.


Disk Free Space (MB) stat

Numeric value of free space on each disk in megabytes.

Importance: The absolute value in MB is important for planning:

  • How much time remains before running out of space
  • Whether there is enough space for maintenance operations (index rebuilds)
  • Database growth planning

Detailed CPU

CPU Usage Over Time timeseries

Graph showing CPU usage evolution over time.

Importance: CPU history allows identifying:

  • Usage patterns (peaks at specific times)
  • Load growth trends
  • Correlation with SQL Server events (backups, jobs, ETL)
  • Anomalies requiring investigation

Included metrics:

  • Percent Privileged Time: Time in kernel mode (system operations, I/O). High privileged time may indicate disk or network problems.
  • Percent User Time: Time executing application code (including SQL Server). This is the "useful" work.
  • Percent Interrupt Time: Time handling hardware interrupts. High interrupt time may indicate driver or hardware problems.

Correlation with SQL Server:

High MetricPossible Cause in SQL Server
User TimeCPU-intensive queries, compilations
Privileged TimeI/O waits, disk reads
Interrupt TimeNetwork issues, storage drivers

Disk I/O

Disk I/O timeseries

Read and write operations per disk.

Importance: Disk I/O is frequently the main bottleneck for SQL Server:

  • High reads may indicate insufficient buffer pool (low PLE)
  • High writes may be checkpoints, logs, or TempDB
  • High disk latency causes PAGEIOLATCH_* wait types

Included metrics:

  • Disk Reads/sec: Read operations per second. Sustained high reads indicate memory pressure.
  • Disk Writes/sec: Write operations per second. High writes on log indicate high transactional activity.
  • Avg. Disk Queue Length: Average number of operations waiting. Values > 2 per physical disk indicate saturation.

Correlation with SQL Server:

I/O SymptomCheck in SQL Server
High Queue LengthWait stats: PAGEIOLATCH_*, WRITELOG
High ReadsPage Life Expectancy, missing indexes
High Writes on logLarge transactions, log shipping lag
High Writes on tempdbSpills, version store, temp tables

Network

Network Traffic timeseries

Incoming and outgoing network traffic.

Importance: Network traffic affects SQL Server in:

  • Response time to remote clients
  • Backup speed to network locations
  • Replication and Always On Availability Groups
  • Linked servers and distributed queries

Included metrics:

  • Bytes Received/sec: Incoming data. High incoming traffic may be bulk inserts or restores.
  • Bytes Sent/sec: Outgoing data. High outgoing traffic may be queries returning large amounts of data.

Correlation with SQL Server:

  • Network saturation causes ASYNC_NETWORK_IO wait types
  • Affects Always On synchronous commit latency
  • Impacts backups/restores to network locations

Interpretation Guide

Critical Indicators

MetricCritical ValueAction
CPU Usage> 90% sustainedReview queries, heavy processes
Free Memory< 1 GBEvaluate memory configuration
Disk Free Space< 10%Free up space urgently
Disk Queue> 2Possible I/O bottleneck

Correlation with SQL Server

This dashboard is fundamental for correlating SQL Server problems with the operating system:

Symptom in SQL ServerCheck in Windows
Slow queriesHigh CPU, High Disk Queue
Low Page Life ExpectancyLow Free Memory
Connection timeoutsNetwork Traffic, CPU
Slow backupsDisk I/O, Disk Free Space

Combined Diagnostics: Windows + SQL Server

For effective diagnostics, it is necessary to correlate Windows metrics with SQL Server metrics. This section explains how to combine both sources of information.

Diagnostic Methodology

  1. Identify the symptom in SQL Server (slow queries, timeouts, errors)
  2. Review wait statistics in SQL Server to identify the wait type
  3. Correlate with Windows metrics according to the following table
  4. Take corrective actions based on the combined analysis

Detailed Correlation Matrix

Wait Type in SQL ServerWindows MetricWhat to Look ForRecommended Action
SOS_SCHEDULER_YIELDCPU UsageCPU > 90% sustainedOptimize queries, add cores
PAGEIOLATCH_*Disk Queue, Disk ReadsQueue > 2, High ReadsMore memory, SSD, optimize queries
WRITELOGDisk Writes (log disk)High latency on logSSD for logs, separate disks
ASYNC_NETWORK_IONetwork TrafficNetwork saturationOptimize result sets, check network
RESOURCE_SEMAPHOREFree MemoryFree memory < 2 GBAdjust max server memory
CXPACKET/CXCONSUMERCPU Usage per coreUnbalanced coresAdjust MAXDOP

Common Scenarios

Scenario 1: Slow Queries with High CPU

  1. Windows shows CPU > 85%
  2. SQL Server shows SOS_SCHEDULER_YIELD waits
  3. Diagnosis: SQL Server is CPU-bound
  4. Actions:
    • Identify queries with high cpu_time in sys.dm_exec_requests
    • Review execution plans looking for table scans
    • Verify missing indexes
    • Consider adding cores

Scenario 2: Slow Queries with High I/O

  1. Windows shows Disk Queue > 2
  2. SQL Server shows PAGEIOLATCH_SH or PAGEIOLATCH_EX waits
  3. Diagnosis: SQL Server is I/O-bound
  4. Actions:
    • Verify Page Life Expectancy (if low, add RAM)
    • Review missing indexes causing table scans
    • Consider migrating to SSD
    • Verify that data, log, and tempdb disks are separate

Scenario 3: Low Memory with Low PLE

  1. Windows shows Free Memory < 2 GB
  2. SQL Server shows PLE < 300 seconds
  3. Diagnosis: External memory pressure or incorrect configuration
  4. Actions:
    • Verify that max server memory is configured
    • Identify other processes consuming memory
    • Consider adding more RAM
    • Review excessive memory grants in queries

Scenario 4: Recent Restart (Low Uptime)

  1. Windows shows Uptime < 2 days
  2. SQL Server shows degraded performance
  3. Diagnosis: Cold buffer pool post-restart
  4. Actions:
    • Wait for the buffer pool to "warm up" naturally
    • Run frequent queries to pre-load data
    • Investigate the cause of the restart
    • Document the event for pattern analysis

Windows Best Practices for SQL Server

This section details the Windows configurations recommended by Microsoft for servers running SQL Server.

Memory Configuration

Recommendations:

  1. Reserve memory for Windows: Configure max server memory in SQL Server leaving:

    • 4 GB free for servers with 16 GB or less
    • 6-8 GB free for servers with 32-64 GB
    • 10% of total RAM for servers with more than 64 GB
  2. Disable kernel paging:

    • In system properties > Advanced > Performance > Advanced
    • Configure virtual memory manually if necessary
  3. Lock Pages in Memory: Grant this privilege to the SQL Server service account to prevent Windows from paging the buffer pool to disk.

Power Plan

Critical Configuration

The Windows Power Plan dramatically affects SQL Server performance.

Recommended configuration:

  • Always use the High Performance plan
  • Never use "Balanced" or "Power Saver" on production servers

How to verify and change:

  1. Control Panel > Power Options
  2. Select "High performance"
  3. Verify in advanced settings that minimum processor state is 100%

Impact of incorrect Power Plan:

  • Inconsistent query latency
  • Spinlocks and CPU waits
  • Unpredictable performance

Antivirus Exclusions

Antivirus software can cause severe performance problems if it scans SQL Server files.

Files and folders to exclude:

TypeExtensions/Paths
Data files*.mdf, *.ndf
Log files*.ldf
Backups*.bak, *.trn
Full-text*.ndf in FT folders
Data folderC:\Program Files\Microsoft SQL Server\MSSQLXX.INSTANCE\MSSQL\DATA\
Log folderTransaction log location
Backup folderBackup location
TempDBTempDB file location

Processes to exclude:

  • sqlservr.exe
  • sqlagent.exe
  • sqlwriter.exe
  • msmdsrv.exe (if using Analysis Services)
  • ReportingServicesService.exe (if using SSRS)

Windows Update Scheduling

Recommendations:

  1. Use WSUS or SCCM to control updates on production servers
  2. Schedule updates outside of production hours
  3. Test updates first in development/QA environments
  4. Coordinate with maintenance windows for SQL Server
  5. Avoid automatic updates that could restart the server without notice

Recommended configuration:

  • Configure active hours to avoid restarts during production
  • Use group policies to control Windows Update behavior
  • Document all applied updates

Other Important Configurations

ConfigurationRecommendationReason
Windows FirewallAllow SQL Server ports (1433, 1434)Connectivity
Remote DesktopEnable only for administrationRemote access
Windows DefenderExclude SQL Server filesPerformance
Unnecessary servicesDisableReduce attack surface and resources
Instant File InitializationEnable (SE_MANAGE_VOLUME_NAME)Fast file creation
Perform Volume Maintenance TasksGrant to SQL Server accountEnables IFI

Telegraf Metrics

This dashboard uses metrics collected by Telegraf in InfluxDB:

MeasurementDescription
win_cpuCPU metrics
win_memMemory metrics
win_diskDisk metrics
win_systemSystem metrics
win_netNetwork metrics
internal_gatherTelegraf information
sqlserver_server_propertiesSQL Server properties

Telegraf Configuration

For this dashboard to work correctly, Telegraf must be configured with the following inputs:

toml
[[inputs.win_perf_counters]]
  # CPU
  [[inputs.win_perf_counters.object]]
    ObjectName = "Processor"
    Counters = ["% Idle Time", "% Interrupt Time", "% Privileged Time", "% User Time"]
    Instances = ["_Total"]
    Measurement = "win_cpu"

  # Memory
  [[inputs.win_perf_counters.object]]
    ObjectName = "Memory"
    Counters = ["Available Bytes", "Committed Bytes"]
    Measurement = "win_mem"

  # Disk
  [[inputs.win_perf_counters.object]]
    ObjectName = "LogicalDisk"
    Counters = ["% Free Space", "Free Megabytes", "Disk Reads/sec", "Disk Writes/sec"]
    Instances = ["*"]
    Measurement = "win_disk"

Microsoft References

Official Documentation

Performance and Optimization

Security and Antivirus

Power Management

Windows Server for SQL Server