Preview
We're still working on this feature, but we'd love for you to try it out!
This feature is currently provided as part of a preview pursuant to our pre-release policies.
Set up Microsoft SQL Server monitoring using the NRDOT Collector on Windows self-hosted environments including physical servers, virtual machines, and standalone Windows installations. To monitor in a Windows RDS environment, refer to Windows RDS instrumentation.
To install this through the New Relic UI instead, go to one.newrelic.com > Integrations & Agents > MSSQL (OpenTelemetry) . Follow the on-screen instructions to set up the integration. This page covers the CLI install path only.
Based on your SQL Server security configuration, you can choose from three authentication methods to connect the NRDOT Collector to your SQL Server instance:
Prerequisites
Before monitoring your Microsoft SQL Server with NRDOT, make sure your environment meets these requirements:
- New Relic account with a valid license key
- New Relic OTLP endpoint for your region
- SQL Server requirements, you'll need:
- SQL Server 2017 or later
- Administrative access to SQL Server (
sysadminrole or equivalent) - Network connectivity between collector and SQL Server on port
1433or custom port - SQL Server Management Studio (SSMS) or
sqlcmdutility - Windows domain or SQL Server authentication
- Network connectivity to New Relic OTLP endpoint
Enroll to preview
This integration is available as part of the New Relic public preview program. Contact your Organization Manager to opt in from the Previews & Trials page.
Install NRDOT Collector
Download and install the NRDOT Collector using PowerShell:
$[Net.ServicePointManager]::SecurityProtocol = 'tls12, tls'; $NRDOT_VERSION = (Invoke-RestMethod -Uri "https://api.github.com/repos/newrelic/nrdot-collector-releases/releases/latest").tag_name; $WebClient = New-Object System.Net.WebClient; $WebClient.Headers.Add("User-Agent", "Mozilla/5.0"); $WebClient.DownloadFile("https://github.com/newrelic/nrdot-collector-releases/releases/download/$NRDOT_VERSION/nrdot-collector_${NRDOT_VERSION}_windows_x64.msi", "$env:TEMP\nrdot-collector.msi"); Start-Process msiexec.exe -ArgumentList "/i `"$env:TEMP\nrdot-collector.msi`" /qn /norestart /L*V `"$env:TEMP\nrdot_install.log`"" -Wait; Get-Service nrdot-collector -ErrorAction SilentlyContinueCreate monitoring user
Run this script as root user/sysadmin user to create the newrelic monitoring user and grant the necessary permissions for collecting SQL Server metrics.
In your SQL Server Management Studio (SSMS), run the following script to create the newrelic monitoring user. Replace <YOUR_PASSWORD> with your desired password:
USE [master];GOCREATE LOGIN [newrelic] WITH PASSWORD = '<YOUR_PASSWORD>';GO
GRANT VIEW SERVER STATE TO [newrelic];GRANT VIEW ANY DEFINITION TO [newrelic];GRANT VIEW ANY DATABASE TO [newrelic];GO
DECLARE @name SYSNAME;DECLARE db_cursor CURSOR READ_ONLY FORWARD_ONLY FORSELECT [name]FROM [master].[sys].[databases]WHERE [name] NOT IN ('master', 'msdb', 'model', 'rdsadmin', 'distribution')AND [state] = 0;OPEN db_cursor;FETCH NEXT FROM db_cursor INTO @name;WHILE @@FETCH_STATUS = 0BEGIN BEGIN TRY EXEC('USE [' + @name + ']; IF NOT EXISTS (SELECT 1 FROM sys.database_principals WHERE name = ''newrelic'') BEGIN CREATE USER [newrelic] FOR LOGIN [newrelic]; END; GRANT VIEW DATABASE STATE TO [newrelic];'); END TRY BEGIN CATCH PRINT 'Error on ' + @name + ': ' + ERROR_MESSAGE(); END CATCH FETCH NEXT FROM db_cursor INTO @name;ENDCLOSE db_cursor;DEALLOCATE db_cursor;GO팁
To securely manage sensitive information, such as database credentials, store them in secret management tools.
Configure NRDOT Collector
Create a configuration file named as
mssql-config.yamlin PowerShell as an Administrator:bash$New-Item -Path "C:\Program Files\nrdot-collector\mssql-config.yaml" -ItemType FileAdd your environment-specific values to the following configuration and copy it to the
mssql-config.yamlfile created in the previous step:full configuration
This configuration focuses on essential database monitoring for your SQL Server environment. To enable comprehensive monitoring with all available metrics, refer to the configuration reference.
1receivers:2 nrsqlserver:3 collection_interval: 15s4 username: newrelic5 password: YOUR_PASSWORD6 server: sqlserver.example.com7 port: 14338
9 # Enable comprehensive database metrics10 metrics:11 sqlserver.database.count:12 enabled: true13 sqlserver.database.io:14 enabled: true15 sqlserver.database.latency:16 enabled: true17 sqlserver.database.operations:18 enabled: true19 sqlserver.database.tempdb.space:20 enabled: true21 sqlserver.database.tempdb.version_store.size:22 enabled: true23 sqlserver.deadlock.rate:24 enabled: true25 sqlserver.os.wait.duration:26 enabled: true27 sqlserver.processes.blocked:28 enabled: true29 sqlserver.memory.grants.pending.count:30 enabled: true31 sqlserver.database.file.size:32 enabled: true33 sqlserver.memory.area:34 enabled: true35
36 # Enable top query and query sample log collection37 events:38 db.server.query_sample:39 enabled: true40 db.server.top_query:41 enabled: true42
43 # Top query collection configuration44 top_query_collection:45 lookback_time: 60s46 max_query_sample_count: 100047 top_query_count: 25048 collection_interval: 60s49
50 collect_full_query_text: true51 allowed_comment_keys:52 - nr_service_guid53
54 # Query sample collection configuration55 query_sample_collection:56 max_rows_per_query: 10057
58processors:59 memory_limiter:60 check_interval: ${env:NR_MEM_LIMITER_CHECK_INTERVAL:-1s}61 limit_mib: ${env:NR_MEM_LIMITER_LIMIT_MIB:-200}62 spike_limit_mib: ${env:NR_MEM_LIMITER_SPIKE_MIB:-50}63
64 batch:65
66exporters:67 otlp:68 endpoint: https://otlp.nr-data.net:431869 headers:70 api-key: YOUR_LICENSE_KEY71 tls:72 insecure: false73 compression: gzip74
75service:76 telemetry:77 metrics:78 level: none79
80 pipelines:81 metrics:82 receivers: [nrsqlserver]83 processors: [memory_limiter, batch]84 exporters: [otlp]85
86 logs:87 receivers: [nrsqlserver]88 processors: [memory_limiter, batch]89 exporters: [otlp]Update Windows Service Registry
Update the Windows Service Registry to use the new
mssql-config.yamlfile using one of the following methods:For PowerShell: Run the following command as Administrator:
bash$Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\nrdot-collector" -Name "ImagePath" -Value '"C:\Program Files\nrdot-collector\nrdot-collector.exe" --config "C:\Program Files\nrdot-collector\mssql-config.yaml"'For Command Prompt: If PowerShell isn't available, use Command Prompt instead and run the following command as Administrator:
bash$sc config "nrdot-collector" binPath= "\"C:\Program Files\nrdot-collector\nrdot-collector.exe\" --config \"C:\Program Files\nrdot-collector\mssql-config.yaml\""
Validate the NRDOT Collector configuration to ensure it's correctly formatted and will work properly.
bash$& "C:\Program Files\nrdot-collector\nrdot-collector.exe" validate --config="C:\Program Files\nrdot-collector\mssql-config.yaml"팁
To correlate your application performance with database operations, you can set up database service identification. For more information, refer to set up database service identification.
Restart NRDOT Collector
After updating your configuration, restart the NRDOT Collector service:
$net stop nrdot-collector$net start nrdot-collector팁
Always restart the NRDOT Collector service after making configuration changes to ensure the new settings take effect.
Find and use your data
Once your data is being collected, you can access comprehensive SQL Server database monitoring through New Relic UI.
To find your SQL Server database entity in New Relic:
Go to https://one.newrelic.com > All Capabilities > Databases.
From the Entity type dropdown, select MSSQL instance, then click Apply.
Select your SQL Server database from the list of entities.
After setting up SQL Server monitoring with NRDOT, you can:
- Create custom dashboards to visualize your database metrics
- Set up alerts for critical database performance thresholds
- Explore your data using New Relic query capabilities
Prerequisites
Before monitoring your Microsoft SQL Server with NRDOT using Windows Authentication, make sure your environment meets these requirements:
- New Relic account with a valid license key
- New Relic OTLP endpoint for your region
- SQL Server requirements, you'll need:
- SQL Server 2017 or later
- Administrative access to SQL Server (
sysadminrole or equivalent) - Network connectivity between collector and SQL Server on port
1433or custom port - SQL Server Management Studio (SSMS) or
sqlcmdutility
- Windows domain environment with Active Directory
- SQL Server configured to accept Windows Authentication
- Domain user account with appropriate SQL Server permissions
- Network connectivity to New Relic OTLP endpoint
Enroll to preview
This integration is available as part of the New Relic public preview program. Contact your Organization Manager to opt in from the Previews & Trials page.
Install NRDOT Collector
Download and install the NRDOT Collector using PowerShell:
$[Net.ServicePointManager]::SecurityProtocol = 'tls12, tls'; $NRDOT_VERSION = (Invoke-RestMethod -Uri "https://api.github.com/repos/newrelic/nrdot-collector-releases/releases/latest").tag_name; $WebClient = New-Object System.Net.WebClient; $WebClient.Headers.Add("User-Agent", "Mozilla/5.0"); $WebClient.DownloadFile("https://github.com/newrelic/nrdot-collector-releases/releases/download/$NRDOT_VERSION/nrdot-collector_${NRDOT_VERSION}_windows_x64.msi", "$env:TEMP\nrdot-collector.msi"); Start-Process msiexec.exe -ArgumentList "/i `"$env:TEMP\nrdot-collector.msi`" /qn /norestart /L*V `"$env:TEMP\nrdot_install.log`"" -Wait; Get-Service nrdot-collector -ErrorAction SilentlyContinueCreate monitoring user
Ensure your SQL Server is configured for Windows Authentication and verify connectivity.
팁
To securely manage sensitive information, such as database credentials, store them in secret management tools.
Configure NRDOT Collector
Create a configuration file named as
mssql-config.yamlin PowerShell as an Administrator:bash$New-Item -Path "C:\Program Files\nrdot-collector\mssql-config.yaml" -ItemType FileAdd the following configuration to the
mssql-config.yamlfile created in the previous step:full configuration
This configuration focuses on essential database monitoring for your Windows SQL Server environment. To enable comprehensive monitoring with all available metrics, refer to the configuration reference.
1receivers:2 nrsqlserver:3 collection_interval: 15s4 datasource: "server=sqlserver.example.com;port=1433;integrated security=true;encrypt=true;TrustServerCertificate=true;"5
6 # Enable comprehensive database metrics7 metrics:8 sqlserver.database.count:9 enabled: true10 sqlserver.database.io:11 enabled: true12 sqlserver.database.latency:13 enabled: true14 sqlserver.database.operations:15 enabled: true16 sqlserver.database.tempdb.space:17 enabled: true18 sqlserver.database.tempdb.version_store.size:19 enabled: true20 sqlserver.deadlock.rate:21 enabled: true22 sqlserver.os.wait.duration:23 enabled: true24 sqlserver.processes.blocked:25 enabled: true26 sqlserver.memory.grants.pending.count:27 enabled: true28 sqlserver.database.file.size:29 enabled: true30 sqlserver.memory.area:31 enabled: true32
33 # Enable top query and query sample log collection34 events:35 db.server.query_sample:36 enabled: true37 db.server.top_query:38 enabled: true39
40 # Top query collection configuration41 top_query_collection:42 lookback_time: 60s43 max_query_sample_count: 100044 top_query_count: 25045 collection_interval: 60s46
47 collect_full_query_text: true48 allowed_comment_keys:49 - nr_service_guid50
51 # Query sample collection configuration52 query_sample_collection:53 max_rows_per_query: 10054
55processors:56 memory_limiter:57 check_interval: ${env:NR_MEM_LIMITER_CHECK_INTERVAL:-1s}58 limit_mib: ${env:NR_MEM_LIMITER_LIMIT_MIB:-200}59 spike_limit_mib: ${env:NR_MEM_LIMITER_SPIKE_MIB:-50}60
61 batch:62
63exporters:64 otlp:65 endpoint: https://otlp.nr-data.net:431866 headers:67 api-key: YOUR_LICENSE_KEY68 tls:69 insecure: false70 compression: gzip71
72service:73 telemetry:74 metrics:75 level: none76
77 pipelines:78 metrics:79 receivers: [nrsqlserver]80 processors: [memory_limiter, batch]81 exporters: [otlp]82
83 logs:84 receivers: [nrsqlserver]85 processors: [memory_limiter, batch]86 exporters: [otlp]팁
This configuration focuses on essential database monitoring for your Windows authentication environment. To enable comprehensive monitoring with all available metrics, refer to the configuration reference.
Update Windows Service Registry
Update the Windows Service Registry to use the new
mssql-config.yamlfile using one of the following methods:For PowerShell: Run the following command as Administrator:
bash$Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\nrdot-collector" -Name "ImagePath" -Value '"C:\Program Files\nrdot-collector\nrdot-collector.exe" --config "C:\Program Files\nrdot-collector\mssql-config.yaml"'For Command Prompt: If PowerShell isn't available, use Command Prompt instead and run the following command as Administrator:
bash$sc config "nrdot-collector" binPath= "\"C:\Program Files\nrdot-collector\nrdot-collector.exe\" --config \"C:\Program Files\nrdot-collector\mssql-config.yaml\""
Validate the NRDOT Collector configuration to ensure it's correctly formatted and will work properly:
bash$& "C:\Program Files\nrdot-collector\nrdot-collector.exe" validate --config="C:\Program Files\nrdot-collector\mssql-config.yaml"팁
To correlate your application performance with database operations, you can set up database service identification. For more information, refer to set up database service identification.
Restart NRDOT Collector
After updating your configuration, restart the NRDOT Collector service:
$net stop nrdot-collector$net start nrdot-collector팁
Always restart the NRDOT Collector service after making configuration changes to ensure the new settings take effect.
Find and use your data
Once your data is being collected, you can access comprehensive SQL Server database monitoring through New Relic UI.
To find your SQL Server database entity in New Relic:
Go to https://one.newrelic.com > All Capabilities > Databases.
From the Entity type dropdown, select MSSQL instance, then click Apply.
Select your SQL Server database from the list of entities.
After setting up SQL Server monitoring with NRDOT, you can:
- Create custom dashboards to visualize your database metrics
- Set up alerts for critical database performance thresholds
- Explore your data using New Relic query capabilities
Prerequisites
Before monitoring your Microsoft SQL Server with NRDOT using gMSA Authentication, make sure your environment meets these requirements:
- New Relic account with a valid license key
- New Relic OTLP endpoint for your region
- SQL Server requirements, you'll need:
- SQL Server 2017 or later
- Administrative access to SQL Server (
sysadminrole or equivalent) - Network connectivity between collector and SQL Server to port 1433 or custom port
- SQL Server Management Studio (SSMS) or
sqlcmdutility
- Active Directory environment with gMSA support
- Windows host must be domain-joined and authorized to use the gMSA account
- Network connectivity to New Relic OTLP endpoint
Enroll to preview
This integration is available as part of the New Relic public preview program. Contact your Organization Manager to opt in from the Previews & Trials page.
Install NRDOT Collector
Download and install the NRDOT Collector using PowerShell:
$[Net.ServicePointManager]::SecurityProtocol = 'tls12, tls'; $NRDOT_VERSION = (Invoke-RestMethod -Uri "https://api.github.com/repos/newrelic/nrdot-collector-releases/releases/latest").tag_name; $WebClient = New-Object System.Net.WebClient; $WebClient.Headers.Add("User-Agent", "Mozilla/5.0"); $WebClient.DownloadFile("https://github.com/newrelic/nrdot-collector-releases/releases/download/$NRDOT_VERSION/nrdot-collector_${NRDOT_VERSION}_windows_x64.msi", "$env:TEMP\nrdot-collector.msi"); Start-Process msiexec.exe -ArgumentList "/i `"$env:TEMP\nrdot-collector.msi`" /qn /norestart /L*V `"$env:TEMP\nrdot_install.log`"" -Wait; Get-Service nrdot-collector -ErrorAction SilentlyContinueCreate monitoring user
In your SQL Server Management Studio (SSMS), run the following script to create a login for your gMSA account and grant the necessary permissions. Replace all occurrences of <YOUR_DOMAIN>\<YOUR_GMSA_USERNAME> with your actual domain and gMSA account name.
USE [master];GO
-- Provision an engine login identity for the gMSACREATE LOGIN [<YOUR_DOMAIN>\<YOUR_GMSA_USERNAME>$] FROM WINDOWS;GO
-- Grant monitoring permissionsGRANT VIEW SERVER STATE TO [<YOUR_DOMAIN>\<YOUR_GMSA_USERNAME>$];GRANT VIEW ANY DEFINITION TO [<YOUR_DOMAIN>\<YOUR_GMSA_USERNAME>$];GRANT VIEW ANY DATABASE TO [<YOUR_DOMAIN>\<YOUR_GMSA_USERNAME>$];GO
-- Grant access to all databases (required for query monitoring and tempdb metrics)DECLARE @name SYSNAME;DECLARE db_cursor CURSOR READ_ONLY FORWARD_ONLY FORSELECT [name] FROM [master].[sys].[databases]WHERE [name] NOT IN ('master','msdb','model','rdsadmin','distribution')AND [state] = 0;OPEN db_cursor;FETCH NEXT FROM db_cursor INTO @name;WHILE @@FETCH_STATUS = 0BEGIN BEGIN TRY EXEC('USE [' + @name + ']; IF NOT EXISTS (SELECT 1 FROM sys.database_principals WHERE name = ''<YOUR_DOMAIN>\<YOUR_GMSA_USERNAME>$'') BEGIN CREATE USER [<YOUR_DOMAIN>\<YOUR_GMSA_USERNAME>$] FOR LOGIN [<YOUR_DOMAIN>\<YOUR_GMSA_USERNAME>$]; END; GRANT VIEW DATABASE STATE TO [<YOUR_DOMAIN>\<YOUR_GMSA_USERNAME>$];'); END TRY BEGIN CATCH PRINT 'Error on ' + @name + ': ' + ERROR_MESSAGE(); END CATCH FETCH NEXT FROM db_cursor INTO @name;ENDCLOSE db_cursor;DEALLOCATE db_cursor;GO팁
To securely manage sensitive information, such as database credentials, store them in secret management tools.
Run as gMSA account
After installing the NRDOT Collector, configure the service to run as your gMSA account using PowerShell. Replace YOUR_DOMAIN\YOUR_gMSA_ACCOUNT$ with your domain and gMSA account name. You must include the $ at the end, as it is required for gMSA accounts.
$# Stop the NRDOT Collector service$Stop-Service nrdot-collector$
$# Configure service to use gMSA account$# Use cmd /c to avoid PowerShell treating $ as a variable$cmd /c 'sc config nrdot-collector obj= "YOUR_DOMAIN\YOUR_gMSA_ACCOUNT$" password= ""'$
$# Verify the configuration$Get-WmiObject Win32_Service -Filter "Name='nrdot-collector'" | Select Name, StartName$
$# start the NRDOT Collector service$Start-Service nrdot-collectorConfigure NRDOT Collector
Create a configuration file named as
mssql-config.yamlin PowerShell as an Administrator:bash$New-Item -Path "C:\Program Files\nrdot-collector\mssql-config.yaml" -ItemType FileAdd the following configuration to the
mssql-config.yamlfile created in the previous step:full configuration
This configuration focuses on essential database monitoring for your Windows SQL Server environment. To enable comprehensive monitoring with all available metrics, refer to the configuration reference.
1receivers:2 nrsqlserver:3 collection_interval: 15s4 datasource: "server=sqlserver.example.com;port=1433;integrated security=true;encrypt=true;TrustServerCertificate=true;"5
6 # Enable comprehensive database metrics7 metrics:8 sqlserver.database.count:9 enabled: true10 sqlserver.database.io:11 enabled: true12 sqlserver.database.latency:13 enabled: true14 sqlserver.database.operations:15 enabled: true16 sqlserver.database.tempdb.space:17 enabled: true18 sqlserver.database.tempdb.version_store.size:19 enabled: true20 sqlserver.deadlock.rate:21 enabled: true22 sqlserver.os.wait.duration:23 enabled: true24 sqlserver.processes.blocked:25 enabled: true26 sqlserver.memory.grants.pending.count:27 enabled: true28 sqlserver.database.file.size:29 enabled: true30 sqlserver.memory.area:31 enabled: true32
33 # Enable top query and query sample log collection34 events:35 db.server.query_sample:36 enabled: true37 db.server.top_query:38 enabled: true39
40 # Top query collection configuration41 top_query_collection:42 lookback_time: 60s43 max_query_sample_count: 100044 top_query_count: 25045 collection_interval: 60s46
47 collect_full_query_text: true48 allowed_comment_keys:49 - nr_service_guid50
51 # Query sample collection configuration52 query_sample_collection:53 max_rows_per_query: 10054
55processors:56 memory_limiter:57 check_interval: ${env:NR_MEM_LIMITER_CHECK_INTERVAL:-1s}58 limit_mib: ${env:NR_MEM_LIMITER_LIMIT_MIB:-200}59 spike_limit_mib: ${env:NR_MEM_LIMITER_SPIKE_MIB:-50}60
61 batch:62
63exporters:64 otlp:65 endpoint: https://otlp.nr-data.net:431866 headers:67 api-key: YOUR_LICENSE_KEY68 tls:69 insecure: false70 compression: gzip71
72service:73 telemetry:74 metrics:75 level: none76
77 pipelines:78 metrics:79 receivers: [nrsqlserver]80 processors: [memory_limiter, batch]81 exporters: [otlp]82
83 logs:84 receivers: [nrsqlserver]85 processors: [memory_limiter, batch]86 exporters: [otlp]팁
To correlate your application performance with database operations, you can set up database service identification. For more information, refer to set up database service identification.
Update Windows Service Registry
Update the Windows Service Registry to use the new
mssql-config.yamlfile using one of the following methods:For PowerShell: Run the following command as Administrator:
bash$Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\nrdot-collector" -Name "ImagePath" -Value '"C:\Program Files\nrdot-collector\nrdot-collector.exe" --config "C:\Program Files\nrdot-collector\mssql-config.yaml"'For Command Prompt: If PowerShell isn't available, use Command Prompt instead and run the following command as Administrator:
bash$sc config "nrdot-collector" binPath= "\"C:\Program Files\nrdot-collector\nrdot-collector.exe\" --config \"C:\Program Files\nrdot-collector\mssql-config.yaml\""
Validate the NRDOT Collector configuration to ensure it's correctly formatted and will work properly:
bash$& "C:\Program Files\nrdot-collector\nrdot-collector.exe" validate --config="C:\Program Files\nrdot-collector\mssql-config.yaml"
Restart NRDOT Collector
After updating your configuration, restart the NRDOT Collector service:
$net stop nrdot-collector$net start nrdot-collector팁
Always restart the NRDOT Collector service after making configuration changes to ensure the new settings take effect.
Find and use your data
Once your data is being collected, you can access comprehensive SQL Server database monitoring through New Relic UI.
To find your SQL Server database entity in New Relic:
Go to https://one.newrelic.com > All Capabilities > Databases.
From the Entity type dropdown, select MSSQL instance, then click Apply.
Select your SQL Server database from the list of entities.
After setting up SQL Server monitoring with NRDOT, you can:
- Create custom dashboards to visualize your database metrics
- Set up alerts for critical database performance thresholds
- Explore your data using New Relic query capabilities