awaragi / prometheus-mssql-exporter

Docker container for exporting MSSQL statistics to Prometheus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple named instances

tp-eallen opened this issue · comments

If you have multiple named instances the sql has issues. For example:
https://github.com/awaragi/prometheus-mssql-exporter/blob/master/src/metrics.js#L224

the line:
AND object_name = 'SQLServer:Buffer Manager'

should be similar to:
SELECT * FROM sys.dm_os_performance_counters WHERE object_name LIKE '%Buffer Manager%';

which is how MS recommends to do it:
https://learn.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-buffer-manager-object?view=sql-server-ver16

For example if you have a named instance the string for the object_name could be:
'MSSQL$MYSQLNAME:Buffer Manager'
which won't match currently