Microsoft SQL Server Monitoring

Last updated on 23 May, 2023

​LogicMonitor comes ready to monitor your Microsoft SQL Server database infrastructure, whether you’re running it on Windows, Linux, Docker containers, or hosted at Azure.

LogicMonitor’s SQL Server monitoring primarily uses SQL database queries to poll internal SQL monitoring tables. Connections are made through JDBC connection strings using Windows authentication or SQL Server authentication.

Note: LogicMonitor can monitor Windows Server Failover Clusters (WSFCs) on SQL Server. See Windows Server Failover Cluster (on SQL Server) Monitoring for details on using our SQL Server monitoring and WSFC monitoring in parallel.


  • WMI (for SQL Server on Windows). LogicMonitor uses the WMI protocol for automated SQL-named instance discovery and SQL services (browser, reporting services, agent, and so on) discovery.
  • SNMP (for SQL Server on Linux). LogicMonitor uses the SNMP protocol for automated SQL Server discovery.
  • LogicMonitor’s Microsoft SQL Server package is compatible with SQL Server 2005 through 2022 using Windows or SQL Server Authentication.

Note: Due to the many potential configurations of SQL Server, LogicMonitor may not be able to provide out-of-the-box compatibility in all environments. It may be necessary for you to manually configure some aspects of the solution.

Adding Resources Into Monitoring

Add your SQL Server hosts into monitoring. For more information on adding resources into monitoring, see Adding Devices.


LogicMonitor must be able to provide the appropriate credentials in order to successfully access each instance of SQL Server. These credentials must belong to a user account with the following minimum SQL Server permissions:

/* make sure to put your complete username in the form of DOMAIN\USERNAME
If the user already exists for a database there will be errors displayed.  These can be ignored
DECLARE @username VARCHAR(100)
--Enter username here
select @username = '<MonitorUserName>'
DECLARE @dbname VARCHAR(50)  
DECLARE @statement NVARCHAR(max)
Use master;
SELECT @statement = 'CREATE USER ['[email protected]+'] FOR LOGIN ['[email protected]+'];
GRANT VIEW ANY DEFINITION TO ['[email protected]+'];
GRANT VIEW SERVER STATE TO ['+ @username+'];
GRANT VIEW ANY DATABASE TO ['+ @username + '];
CREATE USER ['+ @username + '] FOR LOGIN ['+ @username + '];
GRANT SELECT ON SYSJOBS TO ['+ @username + '];
exec sp_executesql @statement
/* this section will create access for Microsoft_SQLServer_Storage datasource only. 
Not needed if not using this module.
FROM MASTER.dbo.sysdatabases
WHERE name NOT IN ('master','model','msdb','tempdb','distribution') -- ignore system databases
OPEN db_cursor 
FETCH NEXT FROM db_cursor INTO @dbname 
SELECT @statement = 'use ['[email protected] +'];'+ 'CREATE USER ['[email protected]+']
FOR LOGIN ['[email protected]+']; '
exec sp_executesql @statement
FETCH NEXT FROM db_cursor INTO @dbname 
CLOSE db_cursor 
DEALLOCATE db_cursor

Note: As best practice, do not use a user account with system administrator privileges for monitoring.

As discussed next, the user account that LogicMonitor uses to connect with SQL Server will be authenticated by either Windows or SQL Server, depending upon the operating system upon which SQL Server is running.

Integrated Security (Windows)

By default, LogicMonitor assumes Integrated Security is used and will attempt to connect with SQL Server using Windows authentication, not SQL authentication. LogicMonitor uses the Windows credentials that are associated with the user on the Collector; therefore, the user on the Collector must have the minimum SQL Server permissions mentioned previously. There is no way to update the user associated with the Collector to an alternate user with Integrated Security.

If Integrated Security is not configured, connection can be authorized via JDBC credentials, as discussed in the following section. Otherwise, JDBC credentials, even if present as properties on the Collector, are ignored.

Conditional requirement:

  • SQL Server Browser service. Allows the Collector to communicate with SQL Server instances without the need for specifying ports. This is only required if one of the following conditions is present:
    • The SQL Server instance(s) are listening on non-standard ports (ports other than default 1434) and you have elected not to define these ports using the jdbc.mssql.port property (this property is discussed in the following Assign Properties to Resources section of this support article).
    • A SQL Server instance is set to listen on dynamic ports.

JDBC Credentials

For direct SQL authentication in Azure, Docker, or Linux (or Windows if Integrated Security Is Unavailable), JDBC credentials are required. These credentials are configured as properties (jdbc.mssql.user and jdbc.mssql.pass) on the host. If there are different authentications for individual SQL instances then the mssql.<instance name>.user and mssql.<instance name>.pass properties are used instead. For more information on these and other properties available for assignment on SQL Server hosts, see the next section of this support article.

Assign Properties to SQL Server Resources

The following properties can be set on the SQL Server resource within LogicMonitor. LogicMonitor strives to auto-discover all properties needed for SQL Server configurations. However, there may be use cases where you will need to manually enter properties or override auto-discovered properties. For more information on assigning properties, see Resource and Instance Properties.


SQL Server username and password. This cannot be a Windows user account. This account must have the minimum SQL Server permissions described in the previous Provide Credentials section of this support article.Required for Linux, Azure, and Docker operating systems that do not require unique authentication on a per-server instance (if per-instance authentication is required, use the mssql.<instance name>.user and mssql.<instance name>.pass properties instead). (Required for Windows operating systems if Integrated Security is not configured; If Integrated Security is configured, the values entered here will override it.)
jdbc.mssql.portPort numbers used by SQL Server. Multiple ports should be specified with a comma (for example, “1434, 2266, 51000”)Required if Docker containers are used as discovery of instances depends on this property containing all ports for Docker. For other operating systems, if the SQL Browser is running it will automatically assign ports to the connection string; if SQL browser isn’t running and no port is specified for this property, the default UDP port of 1434 will be used.
If SQL Server instance names are automatically discovered, they will be assigned to the “auto.” version of the property. If instance names need to be manually assigned, use the “mssql.” version of the property. Instance values assigned manually (those assigned to mssql.sql_server_instances) will override those that were automatically assigned (those assigned to auto.sql_server_instances). Multiple instance names should be separated by commas (for example, “MSSQLServer, Inventory, Finance”). This property is not valid for Linux and Docker instances. These instances use ports and not names.Required
auto.<instance name>.mssql_url
mssql.<instance name>.mssql_url
The JDBC connection string for the instance. If SQL Server instance JDBC strings are automatically discovered, they will be assigned to the “auto.” version of the property. If URLs need to be manually assigned, use the “mssql.” version of the property. Instance values assigned manually will override those that were automatically assigned. JDBC connection strings should be formatted as follows: jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]. See Microsoft’s documentation system for more information on building JDBC connection strings.Required
mssql.<instance name>.user

mssql.<instance name>.pass
If unique authentications are required for each SQL Server instance, use these properties to assign credentials on a per-instance basis.Optional
mssql.<instance name>.portIf different ports are used for individual instances, use this property to assign ports on a per-instance basisOptional
mssql.deletenamesBy default, old instance names are never deleted in order to preserve history of instances. Set mssql.deletenames to true if you want to delete SQL server instances that no longer are in use. 

Setting this property to true and then running the property source Microsoft_SQLServer_Connections cleans up old instances.  Delete the property after the instances are cleaned up.
auto.sql_browser_runningLogicMonitor will check for the existence of SQL browser and automatically assign a value of TRUE or FALSE.Optional
mssql.integrated_securityPrevents PropertySources from dynamically determining whether to use Windows or SQL authentication. This property is manually set to TRUE or FALSE. A value of TRUE instructs LogicMonitor to only use Windows authentication; a value of FALSE instructs LogicMonitor to only use SQL authentication. If this property is not used, Auto Discovery will attempt both authentication methods.Optional
system.categoriesIf system.categories contains “MSSQL” then the resource will be considered a SQL Server and the appropriate DataSources will apply. Typically, this value will be auto-assigned by the addCategory_MSSQL PropertySource. If it isn’t, it must be manually assigned.Required

Migration to Latest LogicModules

In February 2020, LogicMonitor’s SQL Server package received significant updates to enhance performance and have a lower impact on Collector and SQL Server load. As a result of these updates, some DataSources may create new instances with new names. This is the result of fixes to earlier DataSource versions that were creating non-conforming instance names. If new instances are created, the old instances will no longer collect data but will remain in place (until you manually delete them) for historical purposes.

In addition, the following DataSources were deprecated:

  • Microsoft_SQLServer_AgentJobs. This DataSource has been superseded by Microsoft_SQLServer_SystemJobs, which captures the same data.
  • WinSQLServer-. This DataSource has been superseded by Microsoft_SQLServer_GlobalPerformance, which captures the same data.
  • WinSQLServerConnection-. Used to report the roundtrip time for a connection, this data has largely been found to not be useful.

Troubleshooting: Missing Performance Counters

SQL Server Performance Objects and counters are installed automatically as part of the installation. If these objects and counters are missing, it is likely that the installation process experienced an error which resulted in the counters not being properly installed.

A definitive way to check if failures have occurred is to search for Error: 3409 in your SQL setup logs.

To reset the counters, perform the following steps:

  1. Unload the counters by running unlodctr mssql$ from Run Command.
  2. Identify the file path where performance counters are located. The default path is HKLMSYSTEMServicesCurrentcontrolsetServicesMSSQL$Performance.
  3. Reload the counters by running lodctr from Run Command.

Additional performance counter troubleshooting can be found in Microsoft’s documentation system.

LogicModules in Package

LogicMonitor’s package for SQL Server consists of the following LogicModules. For full coverage, please ensure that all of these LogicModules are imported into your LogicMonitor platform.

addCategory_MSSQLPropertySourceAdds “MSSQL” as a value to the system.categories property for resources identified as running SQL Server. Doesn’t attempt validation.
Microsoft_SQLServer_ConnectionsPropertySourceFinds instance names for SQL Server  and creates the JDBC connection strings used by all DataSources for connections. Adds the version and the edition of SQL Server to the device.
Microsoft_SQLServer_SQLAuthConnectionsPropertySourceCreates the JDBC connection strings used by all DataSources for connecting to SQL Server using SQL Authentication.
Azure_SQLServer_JDBCDataSourceMonitors the global performance metrics of the Azure SQL Server.
Microsoft_SQLServer_AlwaysOnAvailabilityGroupsDataSourceMonitors SQL Server AlwaysON Availability Group performance metrics.
Microsoft_SQLServer_AlwaysOnDatabaseReplicaClusterDataSourceMonitors Cluster-Wide SQL Server Database Replica failover ready state, database join state, and pending suspension.
Microsoft_SQLServer_AlwaysOnDatabaseReplicasDataSourceMonitors the SQL Server AlwaysOn database replica operating state, synchronization health and state, log activity, throughput, transmission and queue size.
Microsoft_SQLServer_AlwaysOnAvailabilityReplicasDataSourceMonitors the SQL Server AlwaysOn local availability replica Operating, Connection, Recovery and Synchronization state.
Microsoft_SQLServer_BackupAgeDataSourceNumber of hours since the last full or log backup. No alerts, since backup age requirements vary.
Microsoft_SQLServer_DatabaseFilesDataSourceThe amount of space used by each database converted to bytes. Uses high-impact SQL commands and should not be run more than once every hour.
Microsoft_SQLServer_DatabasesDataSourceFor each database found on the SQL Server, monitors active sessions, log operations, throughput, cache, latency, file/log sizes, and so on.
Microsoft_SQLServer_DatabaseStorageDataSourceStorage statistics for databases. The PUBLIC permission is required for the monitoring user.  This permission cannot be automatically assigned to new databases.
Microsoft_SQLServer_GlobalPerformanceDataSourceMonitors the global performance metrics of the SQL Server instances.
Microsoft_SQLServer_MonitorUserDataSourceDisplays the number active and inactive sessions that the LM monitoring user has on the SQL instance. Alerts if the monitor user has too many connections open.
Microsoft_SQLServer_SystemJobsDataSourceMonitors all system jobs on the SQL Server.
Microsoft_SQLServer_TroubleshooterDataSourceAttempts to execute a handful of Microsoft SQL queries to ensure proper permissions are configured to retrieve all metrics.
WinSQLServices-DataSourceDisplays all the statuses of the SQL services running. Alerts can be configured if one of the services such as SQL Agent is down.
Microsoft_SQLServer_DatabaseNamesConfigSourceWill alert when a database is created, deleted or renamed
In This Article