# windows_exporter config - SQL Server
# Roles: Microsoft SQL Server (any edition), optionally SSRS/SSAS
#
# Collectors enabled beyond defaults:
#   cpu_info      - CPU model/core count as metric labels
#   physical_disk - Per-disk IO, latency, and queue depth (critical for SQL tuning)
#   mssql         - ~300 SQL Server metrics across buffer mgr, locks, memory, query
#                   stats, wait stats, transactions, databases, and availability groups
#   process       - Per-process CPU/memory for SQL Server engine and agent
#   tcp           - TCP state counts; helpful for connection pool and listener health

collectors:
  enabled: "[defaults],cpu_info,physical_disk,mssql,process,tcp"

collector:
  logical_disk:
    volume-exclude: "^(HarddiskVolume|HarddiskVolumeShadowCopy)"

  mssql:
    # Enable all sub-collectors for full SQL Server observability
    enabled:
      - accessmethods       # extent/page allocations, forwarded records, index searches
      - availreplica        # Always On AG replica network traffic and message stats
      - bufman              # buffer pool hit ratio, page reads/writes, memory grants
      - databases           # per-database transaction log, file sizes, active txns
      - dbreplica           # Always On AG database replica send/redo queue stats
      - genstats            # active connections, logins/logouts, temp object counts
      - locks               # lock requests, timeouts, deadlocks per resource type
      - memmgr              # SQL memory grants, stolen, target, and total server memory
      - sqlerrors           # per-error-type counts (useful for alerting on deadlocks)
      - sqlstats            # batch requests, compilations, re-compilations per second
      - transactions        # active transactions, snapshot isolation, version store
      - waitstats           # per-wait-type latency (key for query performance triage)

  process:
    # SQL Server engine, Agent, SSRS, SSAS - adjust pattern to match instance names
    include: "^(sqlservr|sqlagent|reportingservicesservice|msmdsrv|sqlwriter).*"
    cmdline: false

  service:
    # SQL Server services (engine, agent, browser, SSRS, SSAS) + baseline
    include: "(?i)(mssql\\$|sqlserveragent|sqlbrowser|reportserver|msolap|sqlwriter|eventlog|winmgmt|w32tm)"
