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.
LogicMonitor’s Microsoft SQL Server package is confirmed to be compatible with SQL Server 2005 through 2019.
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.
As Microsoft releases newer versions of SQL Server, LogicMonitor will test and extend coverage as necessary.
- 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.
Add 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:
GRANT VIEW ANY DEFINITION TO <USERNAME> GRANT VIEW SERVER STATE TO <USERNAME> GRANT VIEW ANY DATABASE TO <USERNAME> GO USE MSDB CREATE USER <USERNAME> FOR LOGIN <USERNAME> GRANT SELECT ON SYSJOBS TO <USERNAME> GRANT SELECT ON SYSJOBHISTORY TO <USERNAME> GRANT SELECT ON SYSJOBACTIVITY TO <USERNAME>
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.
- 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 (Azure, Docker, or Linux (or Windows if Integrated Security Is Unavailable))
For direct SQL authentication, 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, then the Windows user assigned to the Collector is used and any value entered here is ignored.)|
|jdbc.mssql.port||Port 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.|
|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.|
|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>.port||If different ports are used for individual instances, use this property to assign ports on a per-instance basis||Optional.|
|auto.sql_browser_running||LogicMonitor will check for the existence of SQL browser and automatically assign a value of TRUE or FALSE.||Optional.|
|mssql.integrated_security||Prevents 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.categories||If 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:
- Unload the counters by running unlodctr mssql$ from Run Command.
- Identify the file path where performance counters are located. The default path is HKLMSYSTEMServicesCurrentcontrolsetServicesMSSQL$Performance.
- 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_MSSQL||PropertySource||Adds “MSSQL” as a value to the system.categories property for resources identified as running SQL Server. Doesn’t attempt validation.|
|Microsoft_SQLServer_Connections||PropertySource||Creates the JDBC connection strings used by all DataSources for connecting to SQL Server using Windows Integrated Security.|
|Microsoft_SQLServer_SQLAuthConnections||PropertySource||Creates the JDBC connection strings used by all DataSources for connecting to SQL Server using SQL Authentication.|
|Microsoft_SQLServer_SystemJobs||DataSource||Monitors all system jobs on the SQL Server.|
|Microsoft_SQLServer_GlobalPerformance||DataSource||Monitors the global performance metrics of the SQL Server instances.|
|Microsoft_SQLServer_AlwaysOnDatabaseReplicaCluster||DataSource||Monitors Cluster-Wide SQL Server Database Replica failover ready state, database join state, and pending suspension.|
|Microsoft_SQLServer_AlwaysOnAvailabilityReplicas||DataSource||Monitors the SQL Server AlwaysOn local availability replica Operating, Connection, Recovery and Synchronization state.|
|Microsoft_SQLServer_Databases||DataSource||For each database found on the SQL Server, monitors active sessions, log operations, throughput, cache, latency, file/log sizes, and so on.|
|Azure_SQLServer_JDBC||DataSource||Monitors the global performance metrics of the Azure SQL Server.|
|Microsoft_SQLServer_AlwaysOnDatabaseReplicas||DataSource||Monitors the SQL Server AlwaysOn database replica operating state, synchronization health and state, log activity, throughput, transmission and queue size.|
|Microsoft_SQLServer_AlwaysOnAvailabilityGroups||DataSource||Monitors SQL Server AlwaysON Availability Group performance metrics.|
|Microsoft_SQLServer_Troubleshooter||DataSource||Attempts to execute a handful of Microsoft SQL queries to ensure proper permissions are configured to retrieve all metrics.|
|WinSQLServices-||DataSource||Displays all the statuses of the SQL services running. Alerts can be configured if one of the services such as SQL Agent is down.|
When setting static datapoint thresholds on the various metrics tracked by this package, LogicMonitor follows the technology owner’s best practice KPI recommendations. If necessary, we encourage you to adjust these predefined thresholds to meet the unique needs of your environment. For more information on tuning datapoint thresholds, see Tuning Static Thresholds for Datapoints.