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 Linux self-hosted environments including physical servers, virtual machines, and containerized Linux deployments.
Prerequisites
Ensure your environment meets our compatibility and prerequisites.
Set up the NRDOT Collector
Install the NRDOT Collector on your Linux flavour:
중요
It is recommended to install the NRDOT Collector on the same host as your SQL Server instance to view infrastructure-level metrics for query performance monitoring.
- Debian / Ubuntu
For AMD64 (x86_64) Architecture:
$NRDOT_VERSION=$(curl -s https://api.github.com/repos/newrelic/nrdot-collector-releases/releases/latest | grep '"tag_name":' | awk -F'"' '{print $4}') && curl -L "https://github.com/newrelic/nrdot-collector-releases/releases/download/${NRDOT_VERSION}/nrdot-collector_${NRDOT_VERSION}_linux_amd64.deb" --output nrdot-collector.deb && sudo dpkg -i nrdot-collector.debFor ARM64 Architecture:
$NRDOT_VERSION=$(curl -s https://api.github.com/repos/newrelic/nrdot-collector-releases/releases/latest | grep '"tag_name":' | awk -F'"' '{print $4}') && curl -L "https://github.com/newrelic/nrdot-collector-releases/releases/download/${NRDOT_VERSION}/nrdot-collector_${NRDOT_VERSION}_linux_arm64.deb" --output nrdot-collector.deb && sudo dpkg -i nrdot-collector.deb- RHEL / CentOS
For AMD64 (x86_64) Architecture:
$NRDOT_VERSION=$(curl -s https://api.github.com/repos/newrelic/nrdot-collector-releases/releases/latest | grep '"tag_name":' | awk -F'"' '{print $4}') && curl -L "https://github.com/newrelic/nrdot-collector-releases/releases/download/${NRDOT_VERSION}/nrdot-collector_${NRDOT_VERSION}_linux_x86_64.rpm" --output nrdot-collector.rpm && sudo rpm -ivh nrdot-collector.rpmFor ARM64 Architecture:
$NRDOT_VERSION=$(curl -s https://api.github.com/repos/newrelic/nrdot-collector-releases/releases/latest | grep '"tag_name":' | awk -F'"' '{print $4}') && curl -L "https://github.com/newrelic/nrdot-collector-releases/releases/download/${NRDOT_VERSION}/nrdot-collector_${NRDOT_VERSION}_linux_arm64.rpm" --output nrdot-collector.rpm && sudo rpm -ivh nrdot-collector.rpmConfigure database user
Run the following script as a root user/sysadmin to create the newrelic monitoring user and grant global read permissions.
To create a
newrelicmonitoring user in Linux, create a file namednr-grant-permission.sqlon your Linux instance with the following content:USE [master];GOCREATE LOGIN [newrelic] WITH PASSWORD = '<PASSWORD>';GO-- Instance-level permissionsGRANT VIEW SERVER STATE TO [newrelic];GRANT VIEW ANY DEFINITION TO [newrelic];GRANT VIEW ANY DATABASE TO [newrelic];GO-- Grant read access privileges to all user databasesDECLARE @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; -- Only online databasesOPEN db_cursor;FETCH NEXT FROM db_cursor INTO @name;WHILE @@FETCH_STATUS = 0BEGINBEGIN TRYEXEC('USE [' + @name + '];IF NOT EXISTS (SELECT 1 FROM sys.database_principals WHERE name = ''newrelic'')CREATE USER [newrelic] FOR LOGIN [newrelic];');END TRYBEGIN CATCHPRINT 'Error on ' + @name + ': ' + ERROR_MESSAGE();END CATCHFETCH NEXT FROM db_cursor INTO @name;ENDCLOSE db_cursor;DEALLOCATE db_cursor;GOTo execute the script, run the following command. Replace
<Your_SA_Password>with your SQL Server administrator password:bash$sqlcmd -S localhost -U sa -P '<Your_SA_Password>' -C -i nr-grant-permission.sql(Optional) To verify that the user was created successfully and has the correct permissions, run the following command. Replace
<Your_SA_Password>with your SQL Server administrator password:bash$sqlcmd -S localhost -U sa -P '<Your_SA_Password>' -C -Q "SELECT sp.name AS [User], p.permission_name AS [Permission_Granted] FROM sys.server_permissions p JOIN sys.server_principals sp ON p.grantee_principal_id = sp.principal_id WHERE sp.name = 'newrelic';"Expected Output:
User Permission_Granted-------------------------------------------------------------------------------------<your_username> CONNECT SQL<your_username> VIEW ANY DEFINITION<your_username> VIEW ANY DATABASE<your_username> VIEW SERVER STATE
This output confirms that your user has been created successfully with the required server-level permissions.
Configure NRDOT Collector
Select your configuration type based on your monitoring needs:
팁
Note: The max_concurrent_queries option controls how many metric queries the receiver executes in parallel against SQL Server during each scrape cycle.
receivers: nrsqlserver: max_concurrent_queries: 4 # default is 4 if omitted or set to 0Configuration parameters
The following table describes the key configuration parameters for the nrsqlserver receiver:
| Parameter | Description |
|---|---|
<YOUR_USERNAME> | Enter your database username for authentication |
<YOUR_PASSWORD> | Enter your database password for authentication |
<YOUR_SERVER> | Enter your SQL Server hostname or IP address |
port | Enter your SQL Server port number. The default value is 1433. |
<YOUR_OTLP_ENDPOINT> | Enter the New Relic OTLP endpoint. For more information, refer to New Relic OTLP endpoints documentation. |
<YOUR_LICENSE_KEY> | Enter your New Relic license key. |
collection_interval | Interval in seconds to collect database metrics. Default: 15s |
팁
Note: If you enable all available metrics, increase the limit_mib value (e.g., 1000) to prevent the memory limiter from dropping data.
Update the collector configuration file
Run the following command to edit the service configuration:
bash$sudo nano /etc/nrdot-collector/nrdot-collector.confUpdate the config path to point to your new mssql-config.yaml file:
bash$OTELCOL_CONFIG="/etc/nrdot-collector/mssql-config.yaml"Validate NRDOT Collector Configuration
Validate the NRDOT Collector configuration to ensure it's correctly formatted and will work properly:
bash$sudo /usr/bin/nrdot-collector validate --config=/etc/nrdot-collector/mssql-config.yaml
Restart NRDOT collector
After updating your configuration, restart the NRDOT Collector service:
$sudo systemctl restart nrdot-collector팁
Always restart the NRDOT collector service after making configuration changes to ensure the new settings take effect.
Next steps
After setting up Linux self-hosted monitoring: