• /
  • Log in
  • Free account
Docs

Microsoft SQL Server monitoring integration

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.

Read on to install the integration, and to see what data we collect.

Compatibility and requirements

Our integration is compatible with Microsoft SQL Server 2008 R2 SP3 or higher.

Before installing the integration, make sure that you meet the following requirements:

Quick start

The quickest way to get started is through our guided install.

Tip

Try our guided install for yourself. (If you're hosted in the EU, use our EU guided install.)

Microsoft SQL users and privileges

In the Microsoft SQL Server that is to be monitored, execute the following script to create a new user and grant CONNECT, VIEW SERVER STATE, and read access permissions to that user.

See the Microsoft documentation for details on creating logins and users in Microsoft SQL Server.

Tip

The Microsoft SQL Server Integration currently only supports SQL Authentication.

  1. Use the following statements to create a new login and to grant CONNECT and VIEW SERVER STATE permissions to the login.

    USE master;
        CREATE LOGIN newrelic WITH PASSWORD = 'tmp_password'; --insert new password here
        GRANT CONNECT SQL TO newrelic;
        GRANT VIEW SERVER STATE TO newrelic;
        GRANT VIEW ANY DEFINITION TO newrelic;
  2. Use the following statements to grant read 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 NOT IN ('master','msdb','tempdb','model','rdsadmin','distribution')
    OPEN db_cursor
    FETCH NEXT FROM db_cursor INTO @name WHILE @@FETCH_STATUS = 0
    BEGIN
    EXECUTE('USE "' + @name + '"; CREATE USER newrelic FOR LOGIN newrelic;' );
    FETCH next FROM db_cursor INTO @name
    END
    CLOSE db_cursor
    DEALLOCATE db_cursor
  3. Run the following command to verify that the user was successfully created.

    sqlcmd -U user_name -S host_name

Install and activate

To install the Microsoft SQL Server integration:

  1. Download the latest .MSI installer image from:

  2. In an admin account, run the install script using an absolute path.

  3. Rename C:\Program Files\New Relic\newrelic-infra\integrations.d\mssql-config.yml.sample to mssql-config.yml, and edit according to your instance.

  4. Restart the infrastructure agent.

Additional notes:

Configure the integration

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.

For an example configuration, see the example config file.

Important

With secrets management, you can configure on-host integrations with New Relic Infrastructure's agent to use sensitive data (such as passwords) without having to write them as plain text into the integration's configuration file. For more information, see Secrets management.

Commands

The mssql-config.yml file accepts the following commands:

  • all_data: collects both inventory and metric data from the Microsoft SQL Server environment.

Arguments

The all_data command accepts the following arguments:

  • username: username used to authenticate the MS SQL Server. To use Windows Authentication, specify this argument in the DOMAIN\username form. This field is required.
  • password: password used to authenticate the MS SQL Server. This field is required.
  • hostname: hostname or IP of the MS SQL Server installation. Default: 127.0.0.1.
  • port: port number on which the MS SQL Server is listening. This is only required when instance is not specified.
  • instance: instance the Microsoft SQL Server is connected to. instance can be used in place of port by enabling SQL Browser; if enabled, do not include port in the argument.
  • enable_ssl: indicates whether SSL is used to connect to the MS SQL Server. Default: false.
  • trust_server_certificate: if set to true, server certificate is not verified for SSL. If set to false, certificate will be verified against supplied certificate.
  • certificate_location: certificate file to verify SSL encryption against.
  • timeout: timeout for queries, in seconds. Default: 30.
  • enable_buffer_metrics: enables the collection of buffer pool metrics. These can be resource intensive for large systems. Default: true.
  • enable_database_reserve_metrics: enables the collection of database partition reserve space. These can be resource intensive for large systems. Default: true.
  • custom_metrics_query: an SQL query with the required columns metric_name, metric_type, and metric_value. The metric_type can be gauge, rate, delta, or attribute. Additional columns collected with the query are added to the metric set as attributes.

Tip

If both port and instance are omitted, the default port of 1433 is used.

Example configurations

Example mssql-config.yml file configuration:

For more about the general structure of on-host integration configuration, see Configuration.

Find and use data

To find your integration data go to one.newrelic.com > 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:

  • MssqlDatabaseSample
  • MssqlInstanceSample
  • MssqlWaitSample

For more on how to find and use your data, see Understand integration data.

Metric data

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..

Database metrics

These attributes can be found by querying the MssqlDatabaseSample event.

Metric

Description

bufferpool.sizePerDatabaseInBytes

The size of the buffer pool per database.

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.

pageFileTotal

Total page file size, in bytes.

Instance metrics

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.cacheHitRatio

The ratio of data pages found and read from the buffer cache over all data page requests.

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.

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.bufferPoolHit

The percentage of buffer pools hits on the instance.

system.waitTimeInMillisecondsPerSecond

The number of milliseconds per second spent waiting across the instance.

Wait metrics

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.

Inventory data

The Microsoft SQL Server integration captures the configuration parameters and current settings of the Microsoft SQL Server environment. It collects the results of the sp_configure stored procedure, as well as current running configuration settings from the sys.configurations table.

The data is available on the Inventory page, under the config/mssql source. For more about inventory data, see Understand integration data.

Check the source code

This integration is open source software. That means you can browse its source code and send improvements, or create your own fork and build it.

For more help

If you need more help, check out these support and learning resources:

Docs
Create issueEdit page
Copyright © 2021 New Relic Inc.