Our Microsoft SQL Server integration collects and sends inventory and metrics from your MS SQL Server environment to our platform, where you can see the health of your MS SQL Server environment. We collect both database and instance-level metrics so that you can pinpoint the source of any problems.
To install the Microsoft SQL Server integration, you must run through the following steps:
In an administrator account, run the install script using an absolute path. Use the corresponding example for your environment:
bash
$
msiexec.exe /qn /i PATH_TO\nri-mssql-amd386.msi
bash
$
msiexec.exe /qn /i PATH_TO\nri-mssql-amd64.msi
Go to C:\Program Files\New Relic\newrelic-infra\integrations.d\ and rename the mssql-config.yml.sample file to mssql-config.yml.
Edit the mssql-config.yml configuration file with your favorite editor. Check out some configuration file examples..
Linux installation
Install the infrastructure agent, and replace the INTEGRATION_FILE_NAME variable with nri-mssql.
Change the directory to the integrations configuration folder by running:
bash
$
cd /etc/newrelic-infra/integrations.d
Copy the sample configuration file by running:
bash
$
sudocp mssql-config.yml.sample mssql-config.yml
Edit the mssql-config.yml configuration file with your favorite editor. Check out some configuration file examples..
Enable your Microsoft SQL Server
For the Microsoft SQL Server to be monitored, you need a user with CONNECT, VIEW SERVER STATE, and VIEW ANY DEFINITION access permissions.
ヒント
Check the Microsoft documentation for details on creating logins and users in Microsoft SQL Server. There is also documentation for server scope permissions (the newrelic user will use 3), and on database roles (the newrelic user will not get any, and remain only public).
Create a new login and grant the necessary permissions:
Create a new login and grant CONNECT, VIEW SERVER and VIEW ANY DEFINITION permissions:
USE master;
CREATE LOGIN newrelic WITH PASSWORD = MY_TEMPORAL_PASSWORD;--insert new password here
GRANTCONNECTSQLTO newrelic;
GRANTVIEW SERVER STATE TO newrelic;
GRANTVIEWANY DEFINITION TO newrelic;
Use the following statements to grant public DB access privileges to the user:
DECLARE@name SYSNAME
DECLARE db_cursor CURSOR
READ_ONLY FORWARD_ONLY
FOR
SELECT NAME
FROM master.sys.databases
WHERE NAME NOTIN('master','msdb','tempdb','model','rdsadmin','distribution')
EXECUTE('USE "'+@name+'"; CREATE USER [Domain\User] FOR LOGIN [Domain\User];');
FETCHnextFROM db_cursor INTO@name
END
CLOSE db_cursor
DEALLOCATE db_cursor
このドキュメントはインストールの役に立ちましたか?
Configure the integration
Edit the config in the integration's YAML config file, mssql-config.yml. An integration's YAML-format configuration is where you can place required login credentials and configure how data is collected. Which options you change depend on your setup and preference. You can check our example configuration files.
The configuration file has common settings applicable to all integrations like interval, timeout, inventory_source. To read all about these common settings refer to our Configuration Format document.
重要
If you're still using our Legacy configuration and definition files, refer to this document for help.
mssql-config.yml sample files
This is the basic configuration used to collect metrics and inventory from your localhost. It uses default connection on port 1433:
integrations:
-name: nri-mssql
env:
HOSTNAME: localhost
PORT:1433
USERNAME: mssql_user
PASSWORD: mssql_password
interval: 15s
labels:
environment: production
inventory_source: config/mssql
This is the basic configuration used to collect metrics and inventory from your localhost. In this case we use a domain user for authentication:
integrations:
-name: nri-mssql
env:
HOSTNAME: localhost
PORT:1433
USERNAME: domain_name\domain_user
PASSWORD: domain_user_password
interval: 15s
labels:
environment: production
inventory_source: config/mssql
This configuration collects metrics every 15 seconds and inventory every 60 seconds:
integrations:
-name: nri-mssql
env:
METRICS:true
HOSTNAME: localhost
PORT:1433
USERNAME: mssql_user
PASSWORD: mssql_password
interval: 15s
labels:
environment: production
-name: nri-mssql
env:
INVENTORY:true
HOSTNAME: localhost
PORT:1433
USERNAME: mssql_user
PASSWORD: mssql_password
interval: 60s
labels:
environment: production
inventory_source: config/mssql
This configuration monitors the mssql_instance1 and mssql_instance2 instances on the same SQL Server. When connecting directly to an instance you'll need to remove the PORT setting. The SQL Browser service also needs to be running on the server:
integrations:
-name: nri-mssql
env:
HOSTNAME: localhost
USERNAME: mssql_user
PASSWORD: mssql_password
INSTANCE: mssql_instance1
interval: 15s
labels:
environment: production
inventory_source: config/mssql
-name: nri-mssql
env:
HOSTNAME: localhost
USERNAME: mssql_user
PASSWORD: mssql_password
INSTANCE: mssql_instance2
interval: 15s
labels:
environment: production
inventory_source: config/mssql
Use to connect to MS SQL using SSL without validation of the certificate:
integrations:
-name: nri-mssql
env:
METRICS:true
HOSTNAME: localhost
PORT:1433
USERNAME: mssql_user
PASSWORD: mssql_password
ENABLE_SSL:true
TRUST_SERVER_CERTIFICATE:true
interval: 15s
labels:
environment: production
If the integration causes some overhead on your SQL server, disabling the Buffer Pool and Database Partition Reserve metrics can help to optimize the integration's performance. In this example, we also increased the sampling interval to 30 seconds to reduce the sampling frequency:
integrations:
-name: nri-mssql
env:
HOSTNAME: localhost
PORT:1433
USERNAME: mssql_user
PASSWORD: mssql_password
ENABLE_BUFFER_METRICS:false
ENABLE_DATABASE_RESERVE_METRICS:false
interval: 30s
labels:
environment: production
inventory_source: config/mssql
Keep in mind the following:
If you enable ENABLE_BUFFER_METRICS, a query starts running involving the sys.sysdatabases and sys.dm_os_buffer_descriptors internal tables to obtain the buffer's pool size for each database. This query could cause overhead on some SQL Servers. If you disable ENABLE_BUFFER_METRICS, the metric bufferpool.sizePerDatabaseInBytes won't be reported in MssqlDatabaseSample and buferpool.sizeInBytes won't be reported in MssqlInstanceSample.
If you enable ENABLE_DATABASE_RESERVE_METRICS, the reserved size is queried for each database and may cause some load on your server, depending on its size and usage. When it's disabled, both pageFileTotal and pageFileAvailable metrics stop being reported in MssqlDatabaseSample.
You can use custom a custom query to collect additional metrics. Custom metrics will be added to the MssqlCustomQuerySample event sample.
If you need multiple custom SQL queries, add them to mssql-custom-query.yml, and reference that file on your configuration. For more examples of custom queries, check our sample file on github.
ヒント
CUSTOM_METRICS_CONFIG is only enabled if CUSTOM_METRICS_QUERY is not present.
To find your integration data, go to one.newrelic.com > All capabilities > Infrastructure > Third-party services and select one of the Microsoft SQL Server integration links.
Microsoft SQL Server data is attached to the following event types:
The Microsoft SQL Server integration collects the following metric data attributes. Some metric name are prefixed with a category indicator and a period, such as asserts. or flush..
These attributes can be found by querying the MssqlDatabaseSample event.
Metric
Description
bufferpool.sizePerDatabaseInBytes
The size of the buffer pool per database. It is reported when ENABLE_BUFFER_METRICS is set to true.
io.stallInMilliseconds
Wait time of stall since last restart, in milliseconds.
log.transactionGrowth
Total number of times the transaction log for the database has been expanded since the last restart.
pageFileAvailable
Available page file size, in bytes. It is reported when ENABLE_DATABASE_RESERVE_METRICS is set to true.
pageFileTotal
Total page file size, in bytes. It is reported when ENABLE_DATABASE_RESERVE_METRICS is set to true.
The Microsoft SQL Server integration collects the following instance metrics. These attributes can be found by querying the MssqlInstanceSample event.
Metric
Description
access.pageSplitsPerSecond
The number of page splits per second.
activeConnections
The number of active connections.
buffer.checkpointPagesPerSecond
The number of pages flushed to disk per second by a checkpoint or other operation that require all dirty pages to be flushed.
bufferpool.batchRequestsPerSecond
The number of batch requests per second on the buffer pool.
bufferpool.pageLifeExptancyInMilliseconds
The life expectancy of a page in the buffer pool, in milliseconds.
bufferpool.sizeInBytes
The size of the buffer pool, in bytes. It is reported when ENABLE_BUFFER_METRICS is set to true.
instance.backgroundProcessesCount
The number of background processes on the instance.
instance.blockedProcessesCount
The number of blocked processes on the instance.
instance.diskInBytes
The amount of disk space on the instance, in bytes.
instance.dormantProcessesCount
The number of dormant processes on the instance.
instance.forcedParameterizationsPerSecond
The number of forced parameterizations per second on the instance.
instance.preconnectProcessesCount
The number of preconnect processes on the instance.
instance.runnableProcessesCount
The number of runnable processes on the instance.
instance.runnableTasks
The number of runnable tasks on the instance.
instance.runningProcessesCount
The number of running processes on the instance.
instance.sleepingProcessesCount
The number of sleeping processes on the instance.
instance.suspendedProcessesCount
The number of suspended processes on the instance.
instance.transactionsPerSecond
The number of transactions per second on the instance.
memoryAvailable
The available physical memory, in bytes.
memoryTotal
The total physical memory, in bytes.
memoryUtilization
The percentage of memory utilization.
stats.connections
The number of user connections.
stats.deadlocksPerSecond
The number of lock requests per second that resulted in a deadlock since the last restart.
stats.killConnectionErrorsPerSecond
The number of kill connection errors per second since the last restart.
stats.lockWaitsPerSecond
The number of times per second that MS SQL Server is unable to retain a lock right away for a resource.
stats.sqlCompilations
The number of MS SQL compilations per second.
stats.sqlRecompilationsPerSecond
The number of MS SQL re-compilations per second.
stats.userErrorsPerSecond
The number of user errors per second since the last restart.
system.bufferPoolHitPercent
The percentage of buffer pools hits on the instance.
system.waitTimeInMillisecondsPerSecond
The number of milliseconds per second spent waiting across the instance.
These attributes can be found by querying the MssqlWaitSample event.
Metric
Description
system.waitTimeCount
Total wait time for this wait type, in milliseconds. This time is inclusive of signal_wait_time_ms.
system.waitTimeInMillisecondsPerSecond
The number of waits on this wait type, in milliseconds. This counter is incremented at the start of each wait.