# Some metricbeat.mssql.performance Metrics Not Returning Values

**URL:** <https://discuss.elastic.co/t/some-metricbeat-mssql-performance-metrics-not-returning-values/218493>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [February 10, 2020, 12:48am UTC](https://discuss.elastic.co/t/some-metricbeat-mssql-performance-metrics-not-returning-values/218493 "2020-02-10T00:48:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wtg-bko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wtg-bko/32/63384_2.png) [@wtg-bko](https://discuss.elastic.co/u/wtg-bko)\
**Post date:** [February 10, 2020, 12:48am UTC](https://discuss.elastic.co/t/some-metricbeat-mssql-performance-metrics-not-returning-values/218493/1 "2020-02-10T00:48:36Z")

</div>

Hi,

I want to report a bug I discovered. Some of the metrics in metricbeat.mssql.performance module did not return any values for me and I tried to debug this but did not find any useful logs from metricbeat itself. I turned on sql profile and managed to find that this is the sql statement it runs to collect the performance metrics:  
SELECT object\_name,  
counter\_name,  
instance\_name,  
cntr\_value  
FROM sys.dm\_os\_performance\_counters  
WHERE counter\_name = 'SQL Compilations/sec'  
OR counter\_name = 'SQL Re-Compilations/sec'  
OR counter\_name = 'User Connections'  
OR counter\_name = 'Page splits/sec'  
OR ( counter\_name = 'Lock Waits/sec'  
AND instance\_name = '\_Total' )  
OR counter\_name = 'Page splits/sec'  
OR ( object\_name = 'SQLServer:Buffer Manager'  
AND counter\_name = 'Page life expectancy' )  
OR counter\_name = 'Batch Requests/sec'  
OR ( counter\_name = 'Buffer cache hit ratio'  
AND object\_name = 'SQLServer:Buffer Manager' )  
OR ( counter\_name = 'Target pages'  
AND object\_name = 'SQLServer:Buffer Manager' )  
OR ( counter\_name = 'Database pages'  
AND object\_name = 'SQLServer:Buffer Manager' )  
OR ( counter\_name = 'Checkpoint pages/sec'  
AND object\_name = 'SQLServer:Buffer Manager' )  
OR ( counter\_name = 'Lock Waits/sec'  
AND instance\_name = '\_Total' )  
OR ( counter\_name = 'Transactions'  
AND object\_name = 'SQLServer:General Statistics' )  
OR ( counter\_name = 'Logins/sec'  
AND object\_name = 'SQLServer:General Statistics' )  
OR ( counter\_name = 'Logouts/sec'  
AND object\_name = 'SQLServer:General Statistics' )  
OR ( counter\_name = 'Connection Reset/sec'  
AND object\_name = 'SQLServer:General Statistics' )  
OR ( counter\_name = 'Active Temp Tables'  
AND object\_name = 'SQLServer:General Statistics' )

I noticed that for me, this statement did not return any results for the object\_names that was prefixed with "SQLServer:". On my sql server all these counters have object\_names beginning with "MSSQL$INSTANCE1:" instead of "SQLServer:". I have also checked on my other box where I only have one instance, the counter\_name begins with "SQLServer:" though.

I didn't see any settings to configure this in the yml file instead so this might a bug/something hard coded that needs to be patched as other people might have the same issue.

FYI, my @@SERVICENAME is just "INSTANCE1" so the "MSSQL$" in the counter\_name could be just some additional prefix from SQL Server that needs to be taken into account too. Not sure if it is the same in other editions of SQL Server but I am running this version where I had issue:  
Microsoft SQL Server 2016 (SP2-CU5) (KB4475776) - 13.0.5264.1 (X64) .

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 9, 2020, 12:55am UTC](https://discuss.elastic.co/t/some-metricbeat-mssql-performance-metrics-not-returning-values/218493/2 "2020-03-09T00:55:50Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
