Microsoft SQL Server is one of the most used databases today. Because it often has an important role in your business, you need to make sure you get alerted if there is a problem with your databases. This article describes how OP5 Monitor can monitor both important environmental parts of the operating system and how to perform queries to the database. In this document, we assume that Microsoft SQL Server is the main application running on the server.
This will be done
The suggested configuration components for monitoring Microsoft SQL Server are:
- Basic checks on the server like CPU, memory, disc usage, swap usage etc.
- Advanced checks of the operating system by checking several performance counters in the operating system
- Queries to databases
- Checking backup jobs
Concerning SQL 2012
To use it with Microsoft SQL server 2012 or later, you will have to change the TDS version in "/etc/freetds.conf" to "8.0".
Check commands
Add the required check commands, if they don't already exist in your configuration, with the import functionality in OP5 Monitor ('Configure' -> 'Commands' -> 'Check Command Import'):
List of commands
Plugin name | check_command |
---|---|
check_nt | check_mssql_db_file_size |
check_mssql_log_file_size | |
check_nt_memory_page_per_sec | |
check_nt_physical_disk_time | |
check_mssql_num_deadlocks | |
check_mssql_num_user_connections | |
negate | check_mssql_cache_hit_ratio |
check_sql | check_mssql_backup_job |
check_mssql_query_string_regex | |
check_mssql_query_count | |
check_mssql_query_reponstime |
Description of the commands
In the table below are descriptions of the so-called performance check_commands used to monitor a Microsoft SQL Server.
command_name | description |
---|---|
check_mssql_db_file_size and check_mssql_log_file_size |
|
check_nt_memory_page_per_sec |
|
check_nt_physical_disk_time |
|
check_mssql_num_deadlocks |
|
check_mssql_num_user_connections |
|
check_mssql_cache_hit_ratio |
|
The table below describes the check_command you may use when monitoring Microsoft SQL Server by queries
command_name | description |
---|---|
check_mssql_backup_job |
|
check_mssql_query_string_regex |
|
check_mssql_query_count |
|
check_mssql_query_reponstime |
|
Adding the services
Add the required services, ('Configure' -> 'Host: <your-mssql-server>' -> 'Go' -> 'Services for host <your-mssql-server>' -> 'Add new service' -> 'Go'):
When you added the host you had probably already added services like CPU usage, mem usage, disk usage and so on. The table below describes services you probably want to add. (Arguments are just examples, you need to adjust them to suit your environment).
Performance services
service_description | check_command | check_command_args |
---|---|---|
MSSQL Services | check_nt_service | SQLSERVERAGENT,MSSQLSERVER |
MSSQL DB File Size OP5 | check_mssql_db_file_size | 1024!1256 |
MSSQL Log File Size OP5 | check_mssql_log_file_size | 1024!1256 |
NT Memory Page/SecP | check_nt_memory_page_per_sec | 20!30 |
NT Physical Disk Time | check_nt_physical_disk_time | 45!55 |
MSSQL Cache Hit Ratio | check_mssql_cache_hit_ratio | 90!80 |
MSSQL Num Deadlocks | check_mssql_num_deadlocks | 1 |
MSSQL Num User Connections | check_mssql_num_user_connections | 200!250 |
Query services
service_description | check_command | check_command_args |
---|---|---|
MSSQL Backup job ? master | check_mssql_backup_jobn | user!passwd!job name |
MSSQL Select String | check_mssql_query_string_regex | user!password!db!select field from table where?!.*The job succeeded..* |
MSSQL query count | check_mssql_query_count | user!password!db!select field from table where?!10!20 |
MSSQL respons time | check_mssql_query_reponstime | user!password!db!select field from table where?!5!10 |
Use the "Test this service" button for the services to see if they work. Once they are correct and working as they should, you may add the services to all of your Microsoft SQL Servers with the clone function.
Monitoring a cluster
It is not unusual that a Microsoft SQL Server is running in a clustered environment. Of course we can monitor your Microsoft SQL Server in that kind of environment to. Please read the how-to about Monitoring Microsoft clustered servers.
Comments
0 comments
Please sign in to leave a comment.