Skip to content

mssql collector: windows_mssql_bufman_buffer_cache_lookups reports zero despite non-zero value in sys.dm_os_performance_counters #2094

Open
@ltiwanaupgrade

Description

@ltiwanaupgrade

Current Behavior

Summary

On windows_exporter v0.30.2, the mssql collector metric windows_mssql_bufman_buffer_cache_lookups consistently reports a value of 0. This metric corresponds to the Buffer cache hit ratio Base performance counter.

However, querying the sys.dm_os_performance_counters DMV directly on the SQL Server shows a non-zero value for this counter. This indicates the exporter is failing to correctly parse or read this specific performance counter, even though other mssql metrics, including others in the bufman class, are collected successfully.

This bug prevents the direct calculation of the buffer cache hit ratio using the intended metrics.

Expected Behavior

The windows_mssql_bufman_buffer_cache_lookups metric should reflect the non-zero value reported by the SQL Server's performance counters.

Steps To Reproduce

1. Server 2019 with MSSQL 2019
2. Run `"C:\Program Files\windows_exporter\windows_exporter.exe" --config.file="C:\Program Files\windows_exporter\config.yml"`
3. With following `config.yml`:

collectors:
  enabled: cpu,cs,logical_disk,memory,net,os,system,textfile,mssql,service
collector:
  service:
    include: MSSQLSERVER

Environment

  • windows_exporter Version: 0.30.2
  • Windows Server Version: Windows Server 2019 Datacenter (10.0)
  • Collector: mssql
  • SQL Server Version: Microsoft SQL Server 2019 (RTM-CU32) (KB5054833) - 15.0.4430.1 (X64)

windows_exporter logs

Level	Date and Time	Source	Event ID	Task Category
Information	6/24/2025 7:10:59 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T14:10:59.400Z level=INFO source=tls_config.go:350 msg=""TLS is disabled."" http2=false address=[::]:9182

"
Information	6/24/2025 7:10:59 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T14:10:59.400Z level=INFO source=tls_config.go:347 msg=""Listening on"" address=[::]:9182

"
Information	6/24/2025 7:10:59 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T14:10:59.399Z level=INFO source=main.go:241 msg=""starting windows_exporter in 1.1638556s"" version=0.30.2 branch=HEAD revision=a20e1854d1b6753ef3cdf88d251015eb9116b3d0 goversion=go1.23.5 builddate=20250202-22:24:39 maxprocs=2

"
Information	6/24/2025 7:10:59 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T14:10:59.398Z level=INFO source=main.go:223 msg=""Enabled collectors: cpu, cs, logical_disk, memory, net, os, system, textfile, mssql, service""

"
Information	6/24/2025 7:10:59 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T14:10:59.398Z level=INFO source=main.go:306 msg=""Running as NT SERVICE\\windows_exporter""

"
Information	6/24/2025 7:10:58 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T14:10:58.255Z level=INFO source=textfile.go:108 msg=""textfile directories: C:\\Program Files\\windows_exporter\\textfile_inputs"" collector=textfile

"
Information	6/24/2025 7:10:58 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T14:10:58.253Z level=WARN source=os.go:108 msg=""The os collect holds a number of deprecated metrics and will be removed mid 2025. See https://github.com/prometheus-community/windows_exporter/pull/1596 for more information."" collector=os

"
Information	6/24/2025 7:10:58 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T14:10:58.251Z level=WARN source=cs.go:75 msg=""The cs collector is deprecated and will be removed in a future release. Logical processors has been moved to cpu_info collector. Physical memory has been moved to memory collector. Hostname has been moved to os collector.""

"
Information	6/24/2025 7:10:58 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T14:10:58.237Z level=INFO source=config.go:83 msg=""loading configuration file: C:\\Program Files\\windows_exporter\\config.yml""

"
Information	6/24/2025 7:10:58 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

attempting to start exporter service
"
Information	6/24/2025 7:10:56 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T14:10:56.857Z level=INFO source=main.go:291 msg=""windows_exporter has shut down""

"
Information	6/24/2025 7:10:56 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T14:10:56.855Z level=INFO source=main.go:275 msg=""Shutting down windows_exporter via service control""

"
Information	6/24/2025 7:10:56 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

service stop received
"
Information	6/24/2025 6:36:44 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T13:36:44.834Z level=INFO source=tls_config.go:350 msg=""TLS is disabled."" http2=false address=[::]:9182

"
Information	6/24/2025 6:36:44 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T13:36:44.834Z level=INFO source=tls_config.go:347 msg=""Listening on"" address=[::]:9182

"
Information	6/24/2025 6:36:44 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T13:36:44.833Z level=INFO source=main.go:241 msg=""starting windows_exporter in 380.6713ms"" version=0.30.2 branch=HEAD revision=a20e1854d1b6753ef3cdf88d251015eb9116b3d0 goversion=go1.23.5 builddate=20250202-22:24:39 maxprocs=2

"
Information	6/24/2025 6:36:44 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T13:36:44.832Z level=INFO source=main.go:223 msg=""Enabled collectors: cpu, cs, logical_disk, memory, net, os, system, textfile, mssql, service""

"
Information	6/24/2025 6:36:44 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T13:36:44.832Z level=INFO source=main.go:306 msg=""Running as NT SERVICE\\windows_exporter""

"
Information	6/24/2025 6:36:44 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T13:36:44.461Z level=INFO source=textfile.go:108 msg=""textfile directories: C:\\Program Files\\windows_exporter\\textfile_inputs"" collector=textfile

"
Information	6/24/2025 6:36:44 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T13:36:44.459Z level=WARN source=os.go:108 msg=""The os collect holds a number of deprecated metrics and will be removed mid 2025. See https://github.com/prometheus-community/windows_exporter/pull/1596 for more information."" collector=os

"
Information	6/24/2025 6:36:44 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T13:36:44.459Z level=WARN source=cs.go:75 msg=""The cs collector is deprecated and will be removed in a future release. Logical processors has been moved to cpu_info collector. Physical memory has been moved to memory collector. Hostname has been moved to os collector.""

"
Information	6/24/2025 6:36:44 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

time=2025-06-24T13:36:44.453Z level=INFO source=config.go:83 msg=""loading configuration file: C:\\Program Files\\windows_exporter\\config.yml""

"
Information	6/24/2025 6:36:44 AM	windows_exporter	3299	None	"The description for Event ID 3299 from source windows_exporter cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

attempting to start exporter service
"

Anything else?

Diagnostic Evidence

A direct query to the SQL Server's sys.dm_os_performance_counters DMV confirms that the underlying counter (Buffer cache hit ratio Base) is not zero:

SQL Query:

SELECT
    object_name,
    counter_name,
    cntr_value,
    cntr_type
FROM
    sys.dm_os_performance_counters
WHERE
    object_name LIKE '%Buffer Manager%'
    AND counter_name IN ('Buffer cache hit ratio', 'Buffer cache hit ratio Base');

Query Result:

object_name              counter_name                  cntr_value    cntr_type
------------------------ ----------------------------- ------------- -----------
SQLServer:Buffer Manager Buffer cache hit ratio          755           537003264
SQLServer:Buffer Manager Buffer cache hit ratio base      755           1073939712

This result proves the data is available but is being misinterpreted by the exporter.

Observed Behavior

The /metrics endpoint returns 0 for windows_mssql_bufman_buffer_cache_lookups:

# HELP windows_mssql_bufman_background_writer_pages (BufferManager.Backgroundwriterpages)
# TYPE windows_mssql_bufman_background_writer_pages counter
windows_mssql_bufman_background_writer_pages{mssql_instance="MSSQLSERVER"} 1.73758e+06
# HELP windows_mssql_bufman_buffer_cache_hits (BufferManager.Buffercachehitratio)
# TYPE windows_mssql_bufman_buffer_cache_hits gauge
windows_mssql_bufman_buffer_cache_hits{mssql_instance="MSSQLSERVER"} 4
# HELP windows_mssql_bufman_buffer_cache_lookups (BufferManager.Buffercachehitratio_Base)
# TYPE windows_mssql_bufman_buffer_cache_lookups gauge
windows_mssql_bufman_buffer_cache_lookups{mssql_instance="MSSQLSERVER"} 0
# HELP windows_mssql_bufman_checkpoint_pages (BufferManager.Checkpointpages)
# TYPE windows_mssql_bufman_checkpoint_pages counter
windows_mssql_bufman_checkpoint_pages{mssql_instance="MSSQLSERVER"} 510
# HELP windows_mssql_bufman_database_pages (BufferManager.Databasepages)
# TYPE windows_mssql_bufman_database_pages gauge
windows_mssql_bufman_database_pages{mssql_instance="MSSQLSERVER"} 134471
# HELP windows_mssql_bufman_extension_allocated_pages (BufferManager.Extensionallocatedpages)
# TYPE windows_mssql_bufman_extension_allocated_pages gauge
windows_mssql_bufman_extension_allocated_pages{mssql_instance="MSSQLSERVER"} 0
# HELP windows_mssql_bufman_extension_free_pages (BufferManager.Extensionfreepages)
# TYPE windows_mssql_bufman_extension_free_pages gauge
windows_mssql_bufman_extension_free_pages{mssql_instance="MSSQLSERVER"} 0
# HELP windows_mssql_bufman_extension_in_use_as_percentage (BufferManager.Extensioninuseaspercentage)
# TYPE windows_mssql_bufman_extension_in_use_as_percentage gauge
windows_mssql_bufman_extension_in_use_as_percentage{mssql_instance="MSSQLSERVER"} 0
# HELP windows_mssql_bufman_extension_outstanding_io (BufferManager.ExtensionoutstandingIOcounter)
# TYPE windows_mssql_bufman_extension_outstanding_io gauge
windows_mssql_bufman_extension_outstanding_io{mssql_instance="MSSQLSERVER"} 0
# HELP windows_mssql_bufman_extension_page_evictions (BufferManager.Extensionpageevictions)
# TYPE windows_mssql_bufman_extension_page_evictions counter
windows_mssql_bufman_extension_page_evictions{mssql_instance="MSSQLSERVER"} 0
# HELP windows_mssql_bufman_extension_page_reads (BufferManager.Extensionpagereads)
# TYPE windows_mssql_bufman_extension_page_reads counter
windows_mssql_bufman_extension_page_reads{mssql_instance="MSSQLSERVER"} 0
# HELP windows_mssql_bufman_extension_page_unreferenced_seconds (BufferManager.Extensionpageunreferencedtime)
# TYPE windows_mssql_bufman_extension_page_unreferenced_seconds gauge
windows_mssql_bufman_extension_page_unreferenced_seconds{mssql_instance="MSSQLSERVER"} 0
# HELP windows_mssql_bufman_extension_page_writes (BufferManager.Extensionpagewrites)
# TYPE windows_mssql_bufman_extension_page_writes counter
windows_mssql_bufman_extension_page_writes{mssql_instance="MSSQLSERVER"} 0
# HELP windows_mssql_bufman_free_list_stalls (BufferManager.Freeliststalls)
# TYPE windows_mssql_bufman_free_list_stalls counter
windows_mssql_bufman_free_list_stalls{mssql_instance="MSSQLSERVER"} 572
# HELP windows_mssql_bufman_integral_controller_slope (BufferManager.IntegralControllerSlope)
# TYPE windows_mssql_bufman_integral_controller_slope gauge
windows_mssql_bufman_integral_controller_slope{mssql_instance="MSSQLSERVER"} 0
# HELP windows_mssql_bufman_lazywrites (BufferManager.Lazywrites)
# TYPE windows_mssql_bufman_lazywrites counter
windows_mssql_bufman_lazywrites{mssql_instance="MSSQLSERVER"} 92993
# HELP windows_mssql_bufman_page_life_expectancy_seconds (BufferManager.Pagelifeexpectancy)
# TYPE windows_mssql_bufman_page_life_expectancy_seconds gauge
windows_mssql_bufman_page_life_expectancy_seconds{mssql_instance="MSSQLSERVER"} 9488
# HELP windows_mssql_bufman_page_lookups (BufferManager.Pagelookups)
# TYPE windows_mssql_bufman_page_lookups counter
windows_mssql_bufman_page_lookups{mssql_instance="MSSQLSERVER"} 1.211635195e+09
# HELP windows_mssql_bufman_page_reads (BufferManager.Pagereads)
# TYPE windows_mssql_bufman_page_reads counter
windows_mssql_bufman_page_reads{mssql_instance="MSSQLSERVER"} 1.9732113e+07
# HELP windows_mssql_bufman_page_writes (BufferManager.Pagewrites)
# TYPE windows_mssql_bufman_page_writes counter
windows_mssql_bufman_page_writes{mssql_instance="MSSQLSERVER"} 3.919267e+06
# HELP windows_mssql_bufman_read_ahead_issuing_seconds (BufferManager.Readaheadtime)
# TYPE windows_mssql_bufman_read_ahead_issuing_seconds counter
windows_mssql_bufman_read_ahead_issuing_seconds{mssql_instance="MSSQLSERVER"} 9.9567726e+07
# HELP windows_mssql_bufman_read_ahead_pages (BufferManager.Readaheadpages)
# TYPE windows_mssql_bufman_read_ahead_pages counter
windows_mssql_bufman_read_ahead_pages{mssql_instance="MSSQLSERVER"} 1.6503959e+07
# HELP windows_mssql_bufman_target_pages (BufferManager.Targetpages)
# TYPE windows_mssql_bufman_target_pages gauge
windows_mssql_bufman_target_pages{mssql_instance="MSSQLSERVER"} 1.6089088e+07

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions