Applications Systems
"Performance Counter Not Found" for AppInsight for SQL
You may encounter an issue with AppInsight for SQL Performance Counter not displaying in SAM. When viewing the AppInsight for SQL page and related resources, you may receive an error "Performance counter not found." This article provides potential solutions to get performance counters to display.
First published date
Last published date
Overview
If AppInsight for SQL cannot find a performance counter on a monitored system, an error message may appear in SAM logs, or the AppInsight for SQL page and related resources may display "Performance counter not found" errors as shown in the following code example and screenshot.
WARN SolarWinds.APM.Probes.PerformanceCounters.MultiCounterHelper - Counter failed. Target:127.0.0.1, Instance:, Category:Memory, Counter:Pages/Sec, ErrorCode:Unhandled, OSError:0x80131500. Message: Unable to collect WMI mapping information for given category value: Memory and counter: Pages/Sec for target: 127.0.0.1
Product section
Cause
- Performance Counters are not present or are corrupted and shows invalid in the logs:
ERROR SolarWinds.APM.Probes.Management.ManagementDataFetcher - Fetching WMI query failed by 'SolarWinds.APM.Probes.Management.WinRM.WinRmConnection'. SolarWinds.Net.WMI.WmiResponseException: Invalid query Scope: SERVER\root\CIMV2[\DOMAIN\account] ErrorCode: 0x80041017 ---> System.Management.ManagementException: Invalid query
- The Instance name contains the SERVERNAME\ before the Instance name
Resolution
1- Check the Instance name
Eventually, using SERVERNAME\INSTANCE generates errors. Check the Instance name in the SQL by verifying the Task Manager instance name.
Ensure the SQL instance is correct when you assign the AppInsight for SQL template. If you're using a default instance name (MSSQLSERVER) then leave it blank, it will detect it automatically. Do not use SERVERNAME\INSTANCE
2- Rebuild Performance Counters
On the monitored SQL Server, run the following CMD commands to rebuild the performance counters
cd %windir%\system32\
lodctr /R
cd %windir%\sysWOW64\
lodctr /R
winmgmt /resyncperf.
3- Check for counters
To resolve this issue, start by checking for counters on the SQL database that is monitored by AppInsight for SQL (not the Orion SQL database).
- Access the monitored SQL database that displays the error message.
- Run this query to verify if counters exist in the database:
-- Scripts are not supported under any SolarWinds support program or service.
-- Scripts are provided AS IS without warranty of any kind. SolarWinds further
-- disclaims all warranties including, without limitation, any implied warranties
-- of merchantability or of fitness for a particular purpose. The risk arising
-- out of the use or performance of the scripts and documentation stays with you.
-- In no event shall SolarWinds or anyone else involved in the creation,
-- production, or delivery of the scripts be liable for any damages whatsoever
-- (including, without limitation, damages for loss of business profits, business
-- interruption, loss of business information, or other pecuniary loss) arising
-- out of the use of or inability to use the scripts or documentation.
SELECT
RTRIM(object_name) as Category,
RTRIM(counter_name) as [Counter],
RTRIM(instance_name) as Instance,
cntr_value as RawValue,
cntr_type as CounterType
FROM sys.dm_os_performance_counters
ORDER BY CASE cntr_type WHEN 1073939712 THEN -1 ELSE cntr_type END
Query results should resemble this example:
If the query returns no values, the issue may be related to your SQL Server installation. Contact Microsoft Support.
Try using the Instance name column to find the name of the missing database and its associated counter. If no databases exist for the counter, then the errors described above are valid and you'll need to work with your DBA and/or Microsoft to resolve the issue.
4- Remove Startup Parameter to allow script to create performance counters
During the initial configuration of SQL Server for the SQL database monitored by AppInsight for SQL, performance counters may have been disabled to reduce SQL overhead. If so, some diagnostics such as parameter "-x" will not be available, as shown in the next screenshot.
Try using SQL Server Configuration Manager to remove Startup Parameters so the script included in the Check for counters section can create performance counters.
- Open SQL Server Configuration Manager for the SQL database that is monitored by AppInsight for SQL (not the Orion SQL database).
- In SQL Server Configuration Manager, click SQL Server Services.
-
In the details pane, right-click SQL Server (<instancename>), and then click Properties.
- Switch to the Startup Parameters tab and examine properties for that service.
:
- Remove the Startup Parameter.
- Reboot the SQL Server.
- Run the script in the Check for counters section.
- Check to see if performance counters were created.
See also:
AppInsight for SQL Performance Counter Not Found
5- Check if there is more than one instance running on the server.
You can run more than one instance in the same SQL Server.
Each instance can have its port.
If you assign instance A using port 33333 and assign also instance B using port 33333, it could show databases from instance A in the Appinsight for SQL assigned to instance B.
Make sure you assign the correct instance and port.