prometheus-community / windows_exporter

Prometheus exporter for Windows machines
MIT License
2.88k stars 691 forks source link

Unable to get mssql metrics per database #1039

Closed Source1024 closed 9 months ago

Source1024 commented 2 years ago

Hello, all. I try to get some mssql metrics, for example: windows_mssql_databases_log_used_percent. I have many databases on the server, but when I check metrics in http://myserver:9182/metrics, I see just one row: windows_mssql_databases_log_used_percent{database="",mssql_instance="MSSQLSERVER"} 4.294967295e+09. This is bug, and database parameter is not set? Or I make something wrong?

Source1024 commented 2 years ago

Also many counters have zero value, for example: windows_mssql_bufman_page_life_expectancy_seconds.

breed808 commented 2 years ago

The two comments imply that more than one metric is being returned?

Do the WMI classes (E.G. Win32_PerfRawData_MSSQLSERVER_SQLServerBufferManager) also return zero values?

It'd help to enable debug logging on the exporter and see if the collector is logging any errors.

Source1024 commented 2 years ago

Thank you8 for help, but I already use other exporter for ms sql.

junly917 commented 1 year ago

Hello I also encountered the same problem, database get can not reach, using windows_exporter debug mode debugging shows can not get counter, when using windows performance counters can not get database name, how should I modify this problem?

prometheus metric display metric:

windows_mssql_databases_log_shrinks{database="",mssql_instance="MSSQLSERVER"} 1.1695195947008e+13
# HELP windows_mssql_databases_log_truncations (Databases.LogTruncations)
# TYPE windows_mssql_databases_log_truncations gauge
windows_mssql_databases_log_truncations{database="",mssql_instance="MSSQLSERVER"} 1.1669426143232e+13
# HELP windows_mssql_databases_log_used_percent (Databases.PercentLogUsed)
# TYPE windows_mssql_databases_log_used_percent gauge
windows_mssql_databases_log_used_percent{database="",mssql_instance="MSSQLSERVER"} 11
# HELP windows_mssql_databases_pending_repl_transactions (Databases.ReplPendingTransactions)
# TYPE windows_mssql_databases_pending_repl_transactions gauge
windows_mssql_databases_pending_repl_transactions{database="",mssql_instance="MSSQLSERVER"} 1.16393613722e+13
# HELP windows_mssql_databases_repl_transactions (Databases.ReplTranactions)
# TYPE windows_mssql_databases_repl_transactions counter
windows_mssql_databases_repl_transactions{database="",mssql_instance="MSSQLSERVER"} 1.1643656339456e+13
# HELP windows_mssql_databases_shrink_data_movement_bytes (Databases.ShrinkDataMovementBytes)
# TYPE windows_mssql_databases_shrink_data_movement_bytes counter
windows_mssql_databases_shrink_data_movement_bytes{database="",mssql_instance="MSSQLSERVER"} 0
# HELP windows_mssql_databases_tracked_transactions (Databases.Trackedtransactions)
# TYPE windows_mssql_databases_tracked_transactions counter
windows_mssql_databases_tracked_transactions{database="",mssql_instance="MSSQLSERVER"} 0
# HELP windows_mssql_databases_transactions (Databases.Transactions)
# TYPE windows_mssql_databases_transactions counter
windows_mssql_databases_transactions{database="",mssql_instance="MSSQLSERVER"} 0
# HELP windows_mssql_databases_write_transactions (Databases.WriteTransactions)
# TYPE windows_mssql_databases_write_transactions counter
windows_mssql_databases_write_transactions{database="",mssql_instance="MSSQLSERVER"} 2.82574488338433e+14
# HELP windows_mssql_databases_xtp_controller_dlc_fetch_latency_seconds (Databases.XTPControllerDLCLatencyPerFetch)
# TYPE windows_mssql_databases_xtp_controller_dlc_fetch_latency_seconds gauge
windows_mssql_databases_xtp_controller_dlc_fetch_latency_seconds{database="",mssql_instance="MSSQLSERVER"} 0

windows_exporter debug mode display message

time="2023-09-12T18:51:10+08:00" level=debug msg="missing counter \"Redones/sec\", have [Recovery Qu
eue Log Send Queue File Bytes Received/sec Mirrored Write Transactions/sec Total Log requiring undo
Log remaining for undo Redone Bytes/sec Log Bytes Received/sec Transaction Delay Redo Bytes Remainin
g Redo blocked/sec]" source="perflib.go:73"
time="2023-09-12T18:51:10+08:00" level=debug msg="missing counter \"XTP Controller DLC Latency/Fetch
\", have [Transactions/sec Log Truncations Bulk Copy Rows/sec Bulk Copy Throughput/sec Tracked trans
actions/sec Log File(s) Used Size (KB) Repl. Trans. Rate Log Flush Wait Time Log Cache Reads/sec Shr
ink Data Movement Bytes/sec Write Transactions/sec Commit table entries Log Flush Waits/sec Log Flus
h Write Time (ms) Log File(s) Size (KB) Repl. Pending Xacts Log Pool Requests/sec DBCC Logical Scan
Bytes/sec Log Bytes Flushed/sec Log Cache Hit Ratio Base_Base Log Pool Cache Misses/sec Backup/Resto
re Throughput/sec Log Flushes/sec Log Shrinks Group Commit Time/sec Log Pool Disk Reads/sec Log Grow
ths Data File(s) Size (KB) Percent Log Used XTP Memory Used (KB) Active Transactions Log Cache Hit R
atio]" source="perflib.go:73"
time="2023-09-12T18:51:10+08:00" level=debug msg="mssql class collector dbreplica succeeded after 0.
139655s." source="mssql.go:1928"
time="2023-09-12T18:51:10+08:00" level=debug msg="missing counter \"XTP Controller DLC Peak Latency\
", have [Log File(s) Used Size (KB) Repl. Trans. Rate Log Flush Wait Time Log Cache Reads/sec Shrink
 Data Movement Bytes/sec Write Transactions/sec Commit table entries Log Bytes Flushed/sec Log Flush
 Waits/sec Log Flush Write Time (ms) Log File(s) Size (KB) Repl. Pending Xacts Log Pool Requests/sec
 DBCC Logical Scan Bytes/sec Log Shrinks Log Cache Hit Ratio Base_Base Log Pool Cache Misses/sec Bac
kup/Restore Throughput/sec Log Flushes/sec Group Commit Time/sec Log Cache Hit Ratio Log Pool Disk R
eads/sec Log Growths Data File(s) Size (KB) Percent Log Used XTP Memory Used (KB) Active Transaction
s Transactions/sec Log Truncations Bulk Copy Rows/sec Bulk Copy Throughput/sec Tracked transactions/
sec]" source="perflib.go:73"
time="2023-09-12T18:51:10+08:00" level=debug msg="missing counter \"XTP Controller Log Processed/sec
\", have [Log Flush Wait Time Log File(s) Used Size (KB) Repl. Trans. Rate Write Transactions/sec Co
mmit table entries Log Cache Reads/sec Shrink Data Movement Bytes/sec Log Pool Requests/sec DBCC Log
ical Scan Bytes/sec Log Bytes Flushed/sec Log Flush Waits/sec Log Flush Write Time (ms) Log File(s)
Size (KB) Repl. Pending Xacts Backup/Restore Throughput/sec Log Flushes/sec Log Shrinks Log Cache Hi
t Ratio Base_Base Log Pool Cache Misses/sec Group Commit Time/sec XTP Memory Used (KB) Active Transa
ctions Log Cache Hit Ratio Log Pool Disk Reads/sec Log Growths Data File(s) Size (KB) Percent Log Us
ed Transactions/sec Log Truncations Tracked transactions/sec Bulk Copy Rows/sec Bulk Copy Throughput
/sec]" source="perflib.go:73"
time="2023-09-12T18:51:10+08:00" level=debug msg="mssql class collector databases succeeded after 0.
168954s." source="mssql.go:1928"
time="2023-09-12T18:51:10+08:00" level=debug msg="collector mssql succeeded after 0.170943s." source
="exporter.go:213"
github-actions[bot] commented 10 months ago

This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.